<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">Hi Luis,</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">I am trying to warp a RT dose image file with a deformation field obtained from Demon registration. The original deformation field has resolution of 1mmx1mmx2.5mm. The dose image file has resolution of 2.5mmx2.5mmx2.5mm. I applied VectorResampleImageFilter to resample the deformation filed with the same resolution, size and origin as those of the dose image. ( I checked the old and new deformed image in para view, they look alike.) After I warp the dose image with the new deformation file, the new deform dose image look good at the z direction, however, the displacement of the dose image at x and y direction did not look the same as the displacement in the x and y direction of the deformation field. Following is my code the resample the deformed field and wrap the deformed filed with the original dose image. It looks like my code only do a good job in the z direction where no resample of the resolution (and position) is needed. Anything wrong in my code? </font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">Thanks a lot for any of your input,</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"> </font></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3">Howard.</font></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" size="3"></font> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"> typedef float ComponentType;<br> typedef itk::Vector< ComponentType, 3 > vectorPixelType;<br> typedef itk::Image< vectorPixelType, 3 > deFormImageType; <br>
//typedef itk::Image< ComponentType, Dimension > ComponentImageType;<br> typedef itk::ImageFileReader< deFormImageType > deFormReaderType;<br> deFormReaderType::Pointer deFormReader = deFormReaderType::New();<br>
deFormReader->SetFileName( argv[2] );<br> try<br> {<br> deFormReader->Update();<br> }<br> catch( itk::ExceptionObject & excp )<br> {<br> std::cerr << "Problem reading image file : " << argv[1] << std::endl;<br>
std::cerr << excp << std::endl;<br> return -1;<br> }<br> <br> std::cout << "Read 2 ok" << std::endl;<br> <br> typedef itk::VectorResampleImageFilter<deFormImageType,deFormImageType> FilterType;<br>
FilterType::Pointer resampleFilter = FilterType::New(); <br> <br> typedef itk::IdentityTransform< double, Dimension > TransformType;<br> <br> TransformType::Pointer transform = TransformType::New();<br> resampleFilter->SetTransform( transform );<br>
<br> typedef itk::VectorLinearInterpolateNearestNeighborExtrapolateImageFunction< <br> deFormImageType, double > InterpolatorType;<br> <br> InterpolatorType::Pointer vectorInterpolator = InterpolatorType::New(); <br>
<br> resampleFilter->SetDefaultPixelValue( 0.0 );<br> <br> InputImageType::Pointer fixedImage = reader->GetOutput(); <br> <br> InputImageType::SpacingType spacing;<br> spacing[0] = 2.5; // pixel spacing in millimeters along X<br>
spacing[1] = 2.5; // pixel spacing in millimeters along Y<br> spacing[2] = 2.5; // pixel spacing in millimeters along Z<br> <br> // typedef InputImageType::SpacingType SpacingType;<br> typedef InputImageType::PointType OriginType;<br>
typedef InputImageType::RegionType RegionType;<br> typedef InputImageType::SizeType SizeType;<br> <br> // const SpacingType spacing= fixedImage->GetSpacing();<br> const OriginType origin= fixedImage->GetOrigin();<br>
const RegionType region= fixedImage->GetLargestPossibleRegion();<br> const SizeType size= region.GetSize();</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"> resampleFilter->SetInterpolator( vectorInterpolator ); <br> resampleFilter->SetOutputOrigin( origin ); <br> resampleFilter->SetOutputSpacing( spacing );<br>
resampleFilter->SetSize( size );<br> resampleFilter->SetInput( deFormReader->GetOutput() );<br> <br> typedef itk::WarpImageFilter< InputImageType, InputImageType, deFormImageType > WarperType;<br> typedef itk::LinearInterpolateImageFunction< InputImageType, double > LinearInterpolatorType; </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"> WarperType::Pointer warper = WarperType::New(); <br> LinearInterpolatorType::Pointer interpolator = LinearInterpolatorType::New(); <br> warper->SetInput( fixedImage ); <br>
warper->SetInterpolator( interpolator ); <br> warper->SetOutputSpacing( fixedImage->GetSpacing() ); <br> warper->SetOutputOrigin( fixedImage->GetOrigin() );<br> warper->SetDeformationField( resampleFilter->GetOutput() );</div>