[Insight-users] ImageRegionIterator Question

Miller, James V (Research) millerjv at crd.ge.com
Thu Aug 19 08:28:12 EDT 2004


Jian, 

ImageRegionIterator is meant for only query/setting the pixel immediately
under the iterator.  NeighborhoodIterator allows you to query/set pixels
in a neighborhood about center of the neighborhood.  Take a look at
NeighborhoodIterator::SetPixel(const unsigned i, const PixelType &v) and
NeighborhoodIterator::SetPixel(const OffsetType o, const PixelType &v) 
as well as the methods NeighborhoodIterator::SetNext()/SetPrevious()

You should be able to do what you want with a NeighborhoodIterator.  
In a pinch, you could also ask an ImageRegionIterator for its Index, 
manipulate that Index and set a pixel using Image::SetPixel().  But 
Image::SetPixel() is going to be much slower than using a
NeighborhoodIterator.

Jim

-----Original Message-----
From: Jian XIE [mailto:jxie at cs.mu.OZ.AU]
Sent: Wednesday, August 18, 2004 11:59 PM
To: insight-users at itk.org
Subject: [Insight-users] ImageRegionIterator Question


Dear all, I've got a question regarding the ImageRegionIterator. as far
as I understand, there's only one method provided to Set the pixels value,
this pixel is currently the focus of the iterator (Center of neighbor)

However, is it possible to set the other pixel? Because I'm trying to
write a code to do non-maximumsuppression. I have to set the rest of the
pixel in the neighbor to 0 and leave the center pixel value untouch if it
is a local maximum.

// here is my code fragment
// it = neighbor Iterator
// out = imageRegionIterator
for (it.GoToBegin(), out.GoToBegin(); !it.IsAtEnd(); ++it, ++out){

    	// Compare all pixel value with the center, if all smaller then
	// the center pixel, then I set the rest to zero and leave the
	// center pixel unchange
	if(it.GetPixel(offset1)<it.GetPixel(Origin)) && ....
	{
		// but ImageRegionIterator only has a Set method
		// which set the center pixel
		???
		??out.Set()??;
	}


}

How can I get around this problem??

Thanks a lot
Jian
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list