[Insight-users] How to calculate volume of an image
Mario Ceresa
mrceresa at gmail.com
Tue Apr 20 12:24:19 EDT 2010
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
More information about the Insight-users
mailing list