<br>Hi Mario,<br><br>You should simply get the Spacing value from the itkImage, as<br><br>     ImageType::SpacingType spacing =  myImage-&gt;GetSpacing();<br><br>  where <br><br>    spacing[0] is the spacing along X<br>    spacing[1] is the spacing along Y<br>
    spacing[2] is the spacing along Z<br><br><br>The ITK DICOM reader will populate the spacing values <br>for you.<br><br><br>Please note also that is you already have a segmented<br>image, you could use several of the &quot;Label&quot; filters in ITK<br>
in order to compute the volume of a labeled region.<br><br><br>     Regards,<br><br><br>           Luis<br><br><br>--------------------------<br><div class="gmail_quote">On Tue, Apr 20, 2010 at 12:24 PM, Mario Ceresa <span dir="ltr">&lt;<a href="mailto:mrceresa@gmail.com">mrceresa@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hello everybody!<br>
<br>
I&#39;m completely lost on a seemingly stupid problem: how do I calculate<br>
the physical volume of an image (3D CT scan)?<br>
<br>
In the past I would have simply iterated over the interesting pixels<br>
in the image, accumulated them in a variable, say m_Vol, and then:<br>
<br>
std::cout &lt;&lt; &quot;Volume: &quot; &lt;&lt; m_VolLung*spacing[0]*spacing[1]*spacing[2]<br>
<br>
This believing that spacing 0 and 1 came from the &quot;Pixel Spacing&quot; tag<br>
of my DICOM header and spacing[2] from the &quot;Slice Thickness&quot; tag.<br>
<br>
But now I have some CT scan images for which the spacing along z is<br>
always 1 no matter what I try, while the Slice Thickness is different.<br>
<br>
I spent a while dwelling into the ImageHelper::GetSpacingValue of the<br>
gdcm factory but it is *really* complicated...<br>
<br>
Moreover a kind person from the GDCM mailing list pointed me that:<br>
<br>
&quot;Pixel spacing is not guaranteed to be the same as slice thickness.<br>
You can have slices that overlapped also gaps and then with the case<br>
of helical CT the Slice Thickness does not make sense for the<br>
reconstruction.&quot;<br>
<br>
So know I&#39;m not sure which is the best way to proceed, if any of you<br>
could give me an hint I would be more than grateful!<br>
<br>
Thanks and regards,<br>
<br>
Mario<br>
_____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.html</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>
</blockquote></div><br>