[Insight-users] Problem with resampling

Martin Urschler martin at urschler.info
Tue Oct 18 12:15:11 EDT 2005


Chris Farmer wrote:
> typedef itk::VectorResampleImageFilter<RGB8ImageType, RGB8ImageType>
> ResampleFilterType;
> ResampleFilterType::Pointer resampler = ResampleFilterType::New();
> resampler->SetTransform(scaler);
> resampler->SetInput(m_rgbimage);


> RGB8ImageType::Pointer image2 = resampler->GetOutput();
> resampler->Update();
> image2->Update();

this passage is wrong, you are reading the result image (i guess image2) 
before you have updated the filter pipeline...
an image itself is an object that is passed from pipeline stage to 
pipeline stage, you are abviously misusing the image as a part of the 
pipeline!

the right way of doing that is:

resampler->SetInputImage( m_rgbimage); // setup pipeline

try
{
    resampler->Update();
}
catch(itk::Exception& err)
{
...
}

RGB8ImageType::Pointer resultImage = resampler->GetOutput();

I'd suggest some further reading of the software guide which excellently 
explains these basic things...

regards,
Martin


More information about the Insight-users mailing list