[Insight-users] Dose resample filter support vector field?
Hsiang-Chi Kuo
kuoxgx at gmail.com
Sat Feb 14 16:11:22 EST 2009
Hi,
I am working on a deformable registration program with the diffeomorphic
Demons registration filter. Due to the memory issue, I have to apply the
region of interest filer to the input image such that I can run the
program and get the deform field. Then I tried to use resample image filter
to
restore the size of the deform field back to the original size of the
input image. First, the resample image filter dose not allow me to set the
default pixel to zero. If I by pass the setting of the background to
zero, it turn out the attached error message.
Dose the resample image filter support vector field? If not, any way I
can solve my problem? Bellowed please also find part of my code.
Thanks and regards,
Howard
typedef itk::Image< VectorPixelType, Dimension > DeformationFieldType;
typedef itk::ImageFileWriter< DeformationFieldType > FieldWriterType;
typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();
fieldWriter->SetFileName( args.outputFieldFile0.c_str() );
typedef
itk::ResampleImageFilter<DeformationFieldType,DeformationFieldType>
FilterType;
FilterType::Pointer resampleFilter = FilterType::New();
typedef itk::AffineTransform< double, Dimension > TransformType;
TransformType::Pointer transform = TransformType::New();
resampleFilter->SetTransform( transform );
typedef itk::NearestNeighborInterpolateImageFunction<
DeformationFieldType, double > InterpolatorType;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
resampleFilter->SetInterpolator( interpolator );
//resampleFilter->SetDefaultPixelValue( 0 );
typename ImageType::Pointer outputImage = 0;
outputImage = outputImageReader -> GetOutput();
resampleFilter->SetSize(
outputImage->GetLargestPossibleRegion().GetSize() );
resampleFilter->SetInput( defField );
fieldWriter->SetInput( resampleFilter->GetOutput() );
fieldWriter->SetUseCompression( true );
try
{
fieldWriter->Update();
}
catch( itk::ExceptionObject& err )
{
std::cout << "Unexpected error." << std::endl;
std::cout << err << std::endl;
exit( EXIT_FAILURE );
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090214/9ee5cc0e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error
Type: application/octet-stream
Size: 9540 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090214/9ee5cc0e/attachment-0001.obj>
More information about the Insight-users
mailing list