[Insight-users] How to calculate volume of an image
Luis Ibanez
luis.ibanez at kitware.com
Tue Apr 20 14:33:01 EDT 2010
Hi Mario,
You should simply get the Spacing value from the itkImage, as
ImageType::SpacingType spacing = myImage->GetSpacing();
where
spacing[0] is the spacing along X
spacing[1] is the spacing along Y
spacing[2] is the spacing along Z
The ITK DICOM reader will populate the spacing values
for you.
Please note also that is you already have a segmented
image, you could use several of the "Label" filters in ITK
in order to compute the volume of a labeled region.
Regards,
Luis
--------------------------
On Tue, Apr 20, 2010 at 12:24 PM, Mario Ceresa <mrceresa at gmail.com> wrote:
> Hello everybody!
>
> I'm completely lost on a seemingly stupid problem: how do I calculate
> the physical volume of an image (3D CT scan)?
>
> In the past I would have simply iterated over the interesting pixels
> in the image, accumulated them in a variable, say m_Vol, and then:
>
> std::cout << "Volume: " << m_VolLung*spacing[0]*spacing[1]*spacing[2]
>
> This believing that spacing 0 and 1 came from the "Pixel Spacing" tag
> of my DICOM header and spacing[2] from the "Slice Thickness" tag.
>
> But now I have some CT scan images for which the spacing along z is
> always 1 no matter what I try, while the Slice Thickness is different.
>
> I spent a while dwelling into the ImageHelper::GetSpacingValue of the
> gdcm factory but it is *really* complicated...
>
> Moreover a kind person from the GDCM mailing list pointed me that:
>
> "Pixel spacing is not guaranteed to be the same as slice thickness.
> You can have slices that overlapped also gaps and then with the case
> of helical CT the Slice Thickness does not make sense for the
> reconstruction."
>
> So know I'm not sure which is the best way to proceed, if any of you
> could give me an hint I would be more than grateful!
>
> Thanks and regards,
>
> Mario
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100420/78f13d0b/attachment.htm>
More information about the Insight-users
mailing list