[Insight-users] itkImageRegionIterator question

Mathieu Lamard Mathieu.Lamard@enst-bretagne.fr
Fri, 06 Sep 2002 13:33:12 +0200


Dear All,

I am using ITK since few months and I have some problems

Here is my goal :

To have an access the each pixel in an image (value + coordinates).

It seems that itkImageRegionIterator is the good class to perform that.

I have read http://www.itk.org/Doxygen/html/ImageIteratorsPage.html, I 
undersand the concept but I din't reach to use it correctly.


here is my code :

typedef itk::Image<float,2> FloatImageType_a;	
typedef   itk::RescaleIntensityImageFilter<
	 
	    FloatImageType_a,
                             FloatImageType_a > 
RescaleIntensityImageFilterType_a;
RescaleIntensityImageFilterType_a::Pointer 
itkRescaleIntensityImageFilterPtr_a;

...
...


itkClipRescaleIntensityImageFilterPtr_a->SetInput(itkGradientMagnitudeImageFilterPtr_a->GetOutput());
itkClipRescaleIntensityImageFilterPtr_a-> SetOutputMinimum(0);
itkClipRescaleIntensityImageFilterPtr_a-> SetOutputMaximum(255);

/* I try that but it does't work */


typedef   itk::ImageRegionIterator<FloatImageType_a> 
FloatImageRegionIteratorType_a;

FloatImageRegionIteratorType_a 
it(itkClipRescaleIntensityImageFilterPtr_a->GetOutput(),itkClipRescaleIntensityImageFilterPtr_a->GetOutput()->GetRequestedRegion());

it.GoToBegin();
	
while(!it.IsAtEnd())
{
cerr << it.Get() << endl;
++it; 

}


Is some one have the solution of my problem ?
Thanks in advance

Mathieu