[Insight-users] Upsample Image

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


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 64x64_IN.jpg
Type: image/jpeg
Size: 32104 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121122/8094c345/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 64x64_OUT.jpg
Type: image/jpeg
Size: 23298 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121122/8094c345/attachment-0003.jpg>


More information about the Insight-users mailing list