[Insight-users] a query regarding image processing

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 6 14:28:11 EST 2010


Hi Shahina,


1) The total number of pixels in your image can be found
     with the following call:

    ImageType::RegionType region = image->GetBufferedRegion();
    unsigned int numberOfPixels = region.GetNumberOfPixels();

    Note that ITK images have also the concept of the "largest
    possible region" which applies if you are streaming images
    into memory.

    In that case you could call

    region = image->GetLargestPossibleRegion();
    unsigned int numberOfPixels = region.GetNumberOfPixels();

    Both of these methods will give you values that are independent
    of the actual image content.


2)   You can get the voxel size by:

      ImageType::SpacingType spacing = image->GetSpacing();

      //      spacing[0]       voxel size across X
      //      spacing[1]       voxel size across Y
      //      spacing[2]       voxel size across Z


3)  You should read the "Data Representation" chapter
     of the ITK Software Guide.

         http://www.itk.org/ItkSoftwareGuide.pdf



Note that, if you what you need is the volume of specific
objects contained in the image (a brain, a liver...) then
there are other classes that you will need to use.



    Regards,


         Luis


----------------------------------------------------------------------------
On Sat, Mar 6, 2010 at 12:41 PM, shahina ismail <shainaismail at gmail.com> wrote:
> hi...
>
>    i am in need of counting the voxels in an image to calculate its volume
> using Matlab....its a 3D MR image of the brain..i am trying to multiply the
> voxel size with the number of voxels to get the volume...and i have
> calculated the voxel size....i would appreciate any help regarding the
> same....
>
>
>
> thanks and regards
> shahina.i
>
>
> _____________________________________
> 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