[Insight-users] pixel access of filter output image
Jie Zhu
zhujie1979 at gmail.com
Fri Oct 29 11:47:02 EDT 2004
Hi All,
I am having trouble when I try to access pixels in an image output by
a smoothing (or other types of ) filter.
I have a smoothing filter like below and I gave it some input image, I
checked the output image and it is working fine. But if I try to
access pixels in this output image using iterators it just crashes.
Why is this happening?
Thanks a lot,
Jie
typedef float InternalPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
typedef itk::CurvatureAnisotropicDiffusionImageFilter<
InternalImageType,
InternalImageType > SmoothingFilterType;
SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();
smoothing->SetInput( reader->GetOutput() );
typedef itk::ImageLinearIteratorWithIndex< InternalImageType > IteratorType;
IteratorType it( smoothing->GetOutput(), smoothing->GetRequestedRegion() );
it.SetDirection(0);
for ( it.GoToBegin(); ! it.IsAtEnd();it.NextLine()){
it.GoToBeginOfLine();
float pixelValue;
InternalImageType::IndexType tmpIndx;
while ( ! it.IsAtEndOfLine() ){
pixelValue = it.Get(); //<--------------------- crashes here
++it;
}
}
More information about the Insight-users
mailing list