[Insight-users] Voxelwise operations within a mask

Martijn Steenwijk martijnsteenwijk at gmail.com
Tue Oct 16 09:41:14 EDT 2012


Dear all,

I would like to perform a voxelwise operation on positive voxels within a
binary mask. Currently I implemented it like this:

               .....

               typedef itk::ImageRegionIterator<SegmentationType>
SegmentationIteratorType
               SegmentationIteratorType mask_it(mask_img,
mask_img->GetLargestPossibleRegion() );
               for(mask_it.GoToBegin(); !mask_it.IsAtEnd(); ++mask_it) {
                        if(mask_it.Get() > 0)
                        {
                             // Operation

                        }
                }


I've the feeling that this is not the most efficient way of doing this. Is
there a way to define the 'region'  to be only the positive voxels in the
mask - and only iterate over those voxels?

Best,
Martijn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121016/70871625/attachment.htm>


More information about the Insight-users mailing list