<p>Hi,</p>
<div>&nbsp;I am working on a deformable registration program with the diffeomorphic<br>&nbsp; Demons registration filter. Due to the memory issue, I have to apply the<br>&nbsp; region of interest filer to the input image such that I can run the<br>
program&nbsp; and get the deform field. Then I tried to use resample image filter to<br>&nbsp; restore the size of the deform field back to the original size of the<br>input&nbsp;image. First, the resample image&nbsp; filter dose not allow me to set the<br>
&nbsp; default pixel to zero. If I by pass the setting of the background to<br>zero,&nbsp;it turn out the&nbsp;attached error message.<br>&nbsp; Dose the resample image filter support vector field? If not, any way I<br>can&nbsp;solve my problem?&nbsp;Bellowed please also find part of my code.<br>
&nbsp; Thanks and regards,</div>
<div>Howard</div>
<div>&nbsp;</div>
<div>typedef itk::Image&lt; VectorPixelType, Dimension &gt;&nbsp;&nbsp; DeformationFieldType;<br>&nbsp; typedef itk::ImageFileWriter&lt; DeformationFieldType &gt;&nbsp; FieldWriterType;<br>&nbsp; <br>&nbsp; typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();</div>

<div>&nbsp; fieldWriter-&gt;SetFileName( args.outputFieldFile0.c_str() );<br>&nbsp; <br>&nbsp; typedef itk::ResampleImageFilter&lt;DeformationFieldType,DeformationFieldType&gt; FilterType;<br>&nbsp; FilterType::Pointer resampleFilter = FilterType::New();&nbsp; <br>
&nbsp;<br>&nbsp; typedef itk::AffineTransform&lt; double, Dimension &gt;&nbsp; TransformType;<br>&nbsp; <br>&nbsp; TransformType::Pointer transform = TransformType::New();<br>&nbsp; resampleFilter-&gt;SetTransform( transform );<br>&nbsp; <br>&nbsp; typedef itk::NearestNeighborInterpolateImageFunction&lt; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DeformationFieldType, double &gt;&nbsp; InterpolatorType;<br>&nbsp; <br>&nbsp; InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>&nbsp; resampleFilter-&gt;SetInterpolator( interpolator );<br>&nbsp;<br>&nbsp; //resampleFilter-&gt;SetDefaultPixelValue( 0 );<br>
&nbsp; <br>&nbsp;&nbsp;typename ImageType::Pointer outputImage = 0;<br>&nbsp;&nbsp;outputImage = outputImageReader -&gt; GetOutput();<br>&nbsp; resampleFilter-&gt;SetSize(&nbsp; outputImage-&gt;GetLargestPossibleRegion().GetSize() );<br>&nbsp; resampleFilter-&gt;SetInput( defField );<br>
&nbsp; fieldWriter-&gt;SetInput( resampleFilter-&gt;GetOutput() );<br>&nbsp; fieldWriter-&gt;SetUseCompression( true );<br>&nbsp;&nbsp;&nbsp; <br>&nbsp; try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fieldWriter-&gt;Update();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject&amp; err )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Unexpected error.&quot; &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; err &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit( EXIT_FAILURE );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>