<p>Hi,</p>
<div> I am working on a deformable registration program with the diffeomorphic<br> Demons registration filter. Due to the memory issue, I have to apply the<br> region of interest filer to the input image such that I can run the<br>
program and get the deform field. Then I tried to use resample image filter to<br> restore the size of the deform field back to the original size of the<br>input image. First, the resample image filter dose not allow me to set the<br>
default pixel to zero. If I by pass the setting of the background to<br>zero, it turn out the attached error message.<br> Dose the resample image filter support vector field? If not, any way I<br>can solve my problem? Bellowed please also find part of my code.<br>
Thanks and regards,</div>
<div>Howard</div>
<div> </div>
<div>typedef itk::Image< VectorPixelType, Dimension > DeformationFieldType;<br> typedef itk::ImageFileWriter< DeformationFieldType > FieldWriterType;<br> <br> typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();</div>
<div> fieldWriter->SetFileName( args.outputFieldFile0.c_str() );<br> <br> typedef itk::ResampleImageFilter<DeformationFieldType,DeformationFieldType> FilterType;<br> FilterType::Pointer resampleFilter = FilterType::New(); <br>
<br> typedef itk::AffineTransform< double, Dimension > TransformType;<br> <br> TransformType::Pointer transform = TransformType::New();<br> resampleFilter->SetTransform( transform );<br> <br> typedef itk::NearestNeighborInterpolateImageFunction< <br>
DeformationFieldType, double > InterpolatorType;<br> <br> InterpolatorType::Pointer interpolator = InterpolatorType::New();<br> resampleFilter->SetInterpolator( interpolator );<br> <br> //resampleFilter->SetDefaultPixelValue( 0 );<br>
<br> typename ImageType::Pointer outputImage = 0;<br> outputImage = outputImageReader -> GetOutput();<br> resampleFilter->SetSize( outputImage->GetLargestPossibleRegion().GetSize() );<br> resampleFilter->SetInput( defField );<br>
fieldWriter->SetInput( resampleFilter->GetOutput() );<br> fieldWriter->SetUseCompression( true );<br> <br> try<br> {<br> fieldWriter->Update();<br> }<br> catch( itk::ExceptionObject& err )<br>
{<br> std::cout << "Unexpected error." << std::endl;<br> std::cout << err << std::endl;<br> exit( EXIT_FAILURE );<br> }</div>