[Insight-users] Masked UnaryFunctorImageFilter

David Doria daviddoria at gmail.com
Sun Oct 24 18:35:32 EDT 2010


Instead of applying a Functor to EVERY pixel using UnaryFunctorImageFilter,
is there a way to pass it (or something else) a mask to tell it only to
apply the function on the masked pixels?

I often find myself doing:

  while(!imageIterator.IsAtEnd())
    {
    // If the pixel is not enabled in the mask, skip it
    if(imageIterator.Get() == 0)
      {
      output->SetPixel(imageIterator.GetIndex(), 0);
      continue;
      }

    PixelType value = MyFunctor(imageIterator.GetIndex());
   ....

    output->SetPixel(imageIterator.GetIndex(), value);
    ++imageIterator;
    }

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101024/efb8eaf6/attachment.htm>


More information about the Insight-users mailing list