[ITK-users] 4D Image to Matrix inside mask

Javier Juan Albarracín javij1 at gmail.com
Thu May 5 05:48:24 EDT 2016


Hello,

I have a 4D image, which is a DSC Perfusion weighted MRI. Supose the 
image has the dimenisions 270x270x171x34. I want to convert this image 
into a Matrix of size Nx34, where N are the number of voxels inside the 
intracraneal mask. The Matrix class comes from Eigen library. In a 
classic "for loop" scheme 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++)
                  Matrix(i, c) = image(x, y, z, c);
              i++;
         }
     }
}


How can I 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160505/4767f272/attachment.html>


More information about the Insight-users mailing list