Hi all, <br clear="all"><br>Is there a way (in ITK 3.20) to upsample an image with constant boundary condition using linear interpolator? <br>It happens that when I upsample, my last frame and/or last slice are set to 0
(or any other value that I specify with "SetDefaultPixelValue(0)" <br>
in the resampler since it shoots out of the range of the input image). <br><br>As far as I could find, the WindowedSincInterpolateImageFunction is the only one that has support for boundary conditions.<br>Since I have a 4D volume to rescale, I would prefer something faster than windowed sinc, not necessarilly that accurate.<br>
<br>I would like to avoid having the values set to 0 and use either the nearest voxel value or value corresponding to the expansion of the source image with <br>constant boundary.<br><br>Here is my piece of code:<br><br>
const unsigned int InputDimension = 4;<br>
typedef unsigned short PixelType;<br> typedef itk::Image< PixelType, InputDimension > InputImageType;<br>
typedef itk::IdentityTransform< double, InputDimension > TransformType;<br> typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType; <br> typedef itk::ResampleImageFilter< InputImageType, InputImageType > ResampleFilterType;<br>
typedef itk::ImageSeriesWriter< InputImageType, OutputImageType > SeriesWriterType;<br><br> InterpolatorType::Pointer interpolator = InterpolatorType::New();<br><br> TransformType::Pointer transform = TransformType::New();<br>
transform->SetIdentity();<br><br> ResampleFilterType::Pointer resampler = ResampleFilterType::New();<br> resampler->SetInput( reader->GetOutput() );<br> resampler->SetTransform( transform );<br> resampler->SetInterpolator( interpolator );<br>
resampler->SetOutputOrigin( reader->GetOutput()->GetOrigin());<br> resampler->SetOutputSpacing( outputSpacing );<br> resampler->SetOutputDirection( reader->GetOutput()->GetDirection());<br>
resampler->SetSize( outputSize );<br>
resampler->Update();<br><br><br>The reader is just an instance of itk::ImageSeriesReader<InputImageType>. <br><br><br>Cheers, <br><br>Jan<br>