<div dir="ltr"><div>I am trying to read a DICOM image with itk and visualize it with vtk and see, I tried to get the resolution with itk but there is no method that allows, I recovers just the length and width of the image in pixels.</div>
<div> if you have an idea how to get the resolution of an image can you help me with please</div><div><br></div><div> thank you <span style="font-family:arial,sans-serif;font-size:13px">Nuwan Jayala </span>for the answer but I did not find the method getspacing in itk.</div>
<div><br></div><div> I tried another example of vtkDistanceWidget class, I tried to read a jpg image and I get the measurement between two points millimeter and it works well. but when I changed the type of image on DICOM , the value of the measurement is not correct, I did not understand where the problem is!!!!!</div>
<div><br></div><div style>Please can you help me please .here is my code with vtkDistanceWidget (the version that works with jpg is commented):</div><div style><br></div><div style><div>int main(int, char *[])</div><div>{</div>
<div><span class="" style="white-space:pre">        </span>/*std::string inputFilename = "C:/nature.jpg";</div><div> </div><div> //Read the image</div><div> vtkSmartPointer<vtkJPEGReader> jpegReader =</div><div>
vtkSmartPointer<vtkJPEGReader>::New();</div><div> jpegReader->SetFileName ( inputFilename.c_str() );*/</div><div><br></div><div><span class="" style="white-space:pre">        </span>std::string inputFilename = "C:/dicom decompress/dicom decompress/GM_23/2801/0/000121988";</div>
<div> </div><div><span class="" style="white-space:pre">        </span>LectureFileDicom(inputFilename);</div><div><br></div><div>typedef itk::FlipImageFilter< ImageType > FlipImageFilterType;</div><div><br></div><div>FlipImageFilterType::Pointer flipFilter = FlipImageFilterType::New ();</div>
<div> flipFilter->SetInput( reader->GetOutput() );</div><div> bool flipAxes[3] = { false, true, false };</div><div>flipFilter->SetFlipAxes(flipAxes);</div><div>flipFilter->Update();</div><div><br></div><div>
Connector->SetInput( flipFilter->GetOutput() );</div><div>Connector->Update();</div><div><br></div><div><br></div><div>vtkSmartPointer<vtkImageViewer2> imageViewer =</div><div> vtkSmartPointer<vtkImageViewer2>::New();</div>
<div> // imageViewer->SetInputConnection( jpegReader->GetOutputPort() );</div><div>imageViewer->SetInput(Connector->GetOutput());</div><div><br></div><div> </div><div> // An interactor</div><div> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =</div>
<div> vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div> imageViewer->SetupInteractor(renderWindowInteractor);</div><div> imageViewer->Render();</div><div> </div><div> vtkSmartPointer<vtkDistanceWidget> distanceWidget =</div>
<div> vtkSmartPointer<vtkDistanceWidget>::New();</div><div> distanceWidget->SetInteractor(renderWindowInteractor);</div><div> // distanceWidget->CreateDefaultRepresentation();</div><div> static_cast<vtkDistanceRepresentation *>(distanceWidget->GetRepresentation())</div>
<div> ->SetLabelFormat("%-#6.3g mm");</div><div> </div><div> // Render an image (lights and cameras are created automatically)</div><div><br></div><div><br></div><div> renderWindowInteractor->Initialize();</div>
<div><br></div><div> distanceWidget->On();</div><div> </div><div> // Begin mouse interaction</div><div> renderWindowInteractor->Start();</div><div> </div><div> return EXIT_SUCCESS;</div><div>}</div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/6/5 Jon Haitz Legarreta <span dir="ltr"><<a href="mailto:jhlegarreta@vicomtech.org" target="_blank">jhlegarreta@vicomtech.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div>Dear Cary,<br></div>ITK will give you the distance in image units, i.e. pixel/voxels. You should ask your image object about its resolution (how many physical distance units each pixel accounts for) and then do the conversion.<br>
<br></div>HTH,<br></div>JON HAITZ<br><div class="gmail_extra"><br clear="all"><div><table align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td></td></tr><tr><td><br></td></tr></tbody></table></div><div class="gmail_quote">
<div class="im">
On 4 June 2013 01:35, Cary lorey <span dir="ltr"><<a href="mailto:developement.unity@gmail.com" target="_blank">developement.unity@gmail.com</a>></span> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<div dir="ltr">Hello,<div><br></div><div>I am trying to calculate the distance between 2 points on an image, I modified the code TestDistanceWidget according to my needs, but the problem when I measure the distance between the 2 points, the value is high, then I want a millimeter distance.</div>
<div><br></div><div>Please please can you help me?</div><div><br></div><div>thank you in advance.</div></div>
<br></div></div><div class="im">_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></div></blockquote></div><br></div></div>
</blockquote></div><br></div>