[Insight-users] Getting a reference to a pixel from an iterator
Cory Quammen
cquammen at cs.unc.edu
Mon Feb 28 09:55:23 EST 2011
> Thanks for confirming there is no way to do this. Using Set() won't work for
> me - what I was trying to do was:
> std::vector<PixelType*> pixels;
> itk::ImageRegionIterator<ImageType> imageIterator =
> itk::ImageRegionIterator<ImageType>(image, region);
> while(!imageIterator.IsAtEnd())
> {
> if(someCondition(pixel))
> pixels.push_back(&pixel);
> }
> ChangePixels(pixels);
You could switch to an ImageRegionIteratorWithIndex and store the
indices of the pixels that pass your condition. After the while loop,
you could operate on these pixel values by using the SetPixel() and
GetPixel() methods of your Image.
Cory
--
Cory Quammen
Computer Integrated Systems for Microscopy and Manipulation (CISMM)
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen
More information about the Insight-users
mailing list