[Insight-users] How to calculate a volume

Luis Ibanez luis.ibanez at kitware.com
Fri Feb 5 13:58:37 EST 2010

Hi Xi,

You could use:

1) StatisticsImageFilter
    and call GetSum()

    and then multiply by the pixel volume,
    as Marius suggested.


2)  itkLabelStatisticsImageFilter.h
      and call GetCount()

    and then multiply by the pixel volume,
    as Marius suggested.


3)  itkImageMomentsCalculator.h
      and call GetTotalMass(), then divide
      by the label value of the mask, and
     multiply by the pixel volume


4)   itkLabelGeometryImageFilter.h
      can call GetVolume( label )
      where "label" is the label value
     of your mask.

For this option you may find useful to
read the Insight Journal paper:

 *  "A Label Geometry Image Filter for Multiple Object Measurement"
 *  by Padfield D., Miller J
 *  http://www.insight-journal.org/browse/publication/301
 *  http://hdl.handle.net/1926/1493


5)  Use itkShapeLabelMapFilter.txx

     and in the output itkShapeLabelObject,


     For this option you will find useful to
     read the following Insight Journal paper:

     by Gaetan Lehmann.
     Biologie du Developpement et de la Reproduction,
     INRA de Jouy-en-Josas, France.



On Tue, Feb 2, 2010 at 4:33 AM,  <M.Staring at lumc.nl> wrote:
> Hi Xi,
> you can multiply the number of voxels that you found by the number of ml
> of one voxel, which is the product of the gridspacing:
> SpacingType spacing = image->GetSpacing();
> double volumeOfOneVoxel = spacing[0] * spacing[1] * spacing[2];
> double totalVolume = nrOfVoxelsInMask * volumeOfOneVoxel;
> Regards,
> Marius
>> -----Original Message-----
>> From: insight-users-bounces at itk.org
>> [mailto:insight-users-bounces at itk.org] On Behalf Of Xi LIANG
>> Sent: dinsdag 2 februari 2010 9:54
>> To: Insight Users
>> Cc: Xi LIANG
>> Subject: [Insight-users] How to calculate a volume
>> Dear all,
>> I am trying to calculate the volume of a 3D mask image. What
>> I did was to count the voxel number, but found some image
>> have different voxel space. Therefore, I think I should
>> calculate them in ml. Is there any example available to
>> calculate the volume? All suggestions are welcome.
>> Best regards,
>> Xi
>> ________________________________
>> Hotmail: Powerful Free email with security by Microsoft. Get
>> it now. <https://signup.live.com/signup.aspx?id=60969>
> _____________________________________
> 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

More information about the Insight-users mailing list