[ITK] [ITK-users] Get for each voxel of a 4D image inside a mask, their corresponding 4D values

Javier Juan Albarracín javij1 at gmail.com
Wed May 4 14:15:22 EDT 2016


Hello,

I am sorry if the question is too simple but I am a newbie with ITK and 
I don't find the way to solve my problem

I have a 4D image, which is a DSC Perfusion weighted MRI. First of all, 
the type of the image must be  itk::Image<unsigned short, 4>   or  
itk::Image<itk::Vector<unsigned char, N>, 3>  ?? In the later case, I do 
not know at compile time the value of N.

And the core question, supose the image is of size 270x270x171x34, I 
want to extract for each voxel of the image which is inside the 
intracraneal mask, their 34 corresponding values. The intracraneal mask 
is not a rectangular region, but is a brain-like mask (itk::Image<bool, 
3> volume).

In a classic "for loop" scheme (where I come from) the code would be

for (int x = 0; x < image.width(); x++)
{
      for (int y = 0; y < image.height(); y++)
      {
          for (int z = 0; z < image.depth(); z++)
          {
              if (!mask(x, y, z))
                  continue;

              for (int c = 0; c < image.spectrum(); c++)
                  int v = image(x, y, z, c);
              i++;
         }
     }
}


How can do this in ITK?? I have read several ImageRegionIterator 
examples, but I do not find a clean and correct way to do what I want.

Thank you very much.
Regards.

Javier.
_____________________________________
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.php

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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list