[Insight-users] Upsample Image

Peter Neher p.neher at dkfz-heidelberg.de
Thu Nov 22 10:49:00 EST 2012


Solved it. Input image hat wrong spacing.

On 11/22/2012 10:16 AM, Peter Neher wrote:
> Hi everyone.
>
> I am trying to upsample a simple 2D image using itkResampleImageFilter:
>
> itk::NearestNeighborInterpolateImageFunction<SliceType,SliceType::PixelType>::Pointer
> interpolator =
> itk::NearestNeighborInterpolateImageFunction<SliceType,SliceType::PixelType>::New();
> itk::ResampleImageFilter<SliceType, SliceType>::Pointer resampler =
> itk::ResampleImageFilter<SliceType, SliceType>::New();
> resampler->SetInterpolator(interpolator);
> resampler->SetSize(upsSize);
> resampler->SetInput(slice);
> resampler->SetOutputSpacing(upsSpacing);
> resampler->Update();
> SliceType::Pointer reslice = resampler->GetOutput();
>
> To test my code I resampled an image of a binary circle and set output
> size and spacing = input size and spacing. So actually nothing should
> happen. But what I get is a rescale and shifted circle (see attachment).
> If I perform a real upsampling (2x,4x,8x ...) of the original image the
> circle is not shifted or scaled any further. ALways looks the same even
> though size and spacing are changed as defined.
> Any ideas what I am doing wrong?
>
> Cheers
> Peter
>
>



More information about the Insight-users mailing list