<div dir="ltr"><div>Hello yall<br><br>I&#39;m suffering with ResampleImageFilter. In 
particular, upsampling an image produces all zero image (or whatever 
defaultpixelvalue happens to be) and I just can&#39;t figure out why?<br>
<br>Basically, I&#39;m writing a composite filter, which downsamples the 
image for some internal purpose as follows (purposely using linear 
interpolation, not Gaussian):<br><br>Some times I explicitly added IdentityTransform and LinearInterpolateImageFunction,
 but as far as I know, they are defaults so I left them out. If I 
comment out pyramid up (preprocessor if statement), then I get the 
actual downsampled image from my filter as output. So the only problem 
is upsampling.<br>
<br></div><div>I have examined the output from &#39;filter&#39; and it has 
spacing as expected (twice the size of original input), origin at zero, 
directions following cartesian axes and image size half the original. So
 nothing there... As you see, have tried have tried multiple 
combinations for pyrup parameters, none seems working.<br>
</div><div><br>Help appreciated.<br><br></div>Best<br>-Vaaksiainen<br><br>BTW, using ITK 4.4.1, Visual Studio 9, Windows 7 x64.<br><br>******<br><br>typedef itk::ResampleImageFilter&lt;<div>TImage, TImage, float &gt;        ResamplerType;<br>

typedef MyOwnImageToImageFilter&lt;TImage,TImage&gt;                    MyOwnImageToImageFilter;<br><br>typename TImage::SpacingType spacing = this-&gt;GetInput()-&gt;GetSpacing();<br>typename TImage::SizeType size = this-&gt;GetOutput()-&gt;GetRequestedRegion().GetSize();<br>

<br>// e.g. m_Decimation = .5<br>for ( unsigned int i = 0; i &lt; TImage::ImageDimension; ++i)<br>{<br>    spacing[i] /= m_Decimation;<br>    size[i] = (unsigned int)( (double)size[i] * m_Decimation );<br>}<br><br>ResamplerType::Pointer pyrdown = ResamplerType::New();<br>

pyrdown-&gt;SetOutputSpacing( spacing );<br>pyrdown-&gt;SetSize( size );<br>pyrdown-&gt;SetInput( this-&gt;GetInput() );<br><br>MyOwnImageToImageFilter::Pointer filter = MyOwnImageToImageFilter::New();<br>// set filter parameters<br>

filter-&gt;SetInput( pyrdown-&gt;GetOutput() );<br><br>#if 1<br>ResamplerType::Pointer pyrup = ResamplerType::New();<br>//pyrup-&gt;SetOutputSpacing( this-&gt;GetInput()-&gt;GetSpacing() );<br>pyrup-&gt;SetUseReferenceImage( 1 );<br>

pyrup-&gt;SetReferenceImage( this-&gt;GetInput() );<br>//pyrup-&gt;SetOutputStartIndex( roi.GetIndex() );<br>//pyrup-&gt;SetSize( this-&gt;GetOutput()-&gt;GetRequestedRegion().GetSize() );<br>pyrup-&gt;SetInput( filter-&gt;GetOutput() );<br>

pyrup-&gt;SetDefaultPixelValue( 14.0f );<br>#else<br>MyOwnImageToImageFilter::Pointer pyrup = filter;<br>#endif<br><br>pyrup-&gt;Update();<br><br>this-&gt;SetNthOutput( 0, pyrup-&gt;GetOutput() );</div></div>