[Insight-users] Using WarpImageFilter where deformation field
and image have different dimensions
Luis Ibanez
luis.ibanez at kitware.com
Wed Aug 9 20:28:59 EDT 2006
Hi Kris,
The image that is produced as output of the itkWarpImageFilter
will have
1) The origin that you specified with the SetOutputOrigin method.
2) The spacing that you specified with the SetOutputSpacing method.
2) The number of pixels of the deformation field.
You could change this behavior by editing the code in the
WarpImageFilter.
Most of the changes can be taken from the itkResampleImageFilter,
where a Reference image is provided as the image whose characteristics
you want to get in the output image of your filter.
You should adapt this in the methods:
GenerateOutputInformation()
GenerateInputInformation()
Then in the ThreadedGenerateDataMethod() you replace the loop
that goes through the pixels in the deformation field with an
interpolator that using the coordinates of the pixels that is
being processed, will compute the corresponding displacement
vector from the deformation field. For that purpose you can use
the VectorLinearInterpolateImageFunction.
Regards,
Luis
----------------------
Kris Thielemans wrote:
> Hi
>
> I'm trying to find a deformation from a set of images, and apply this
> deformation on another set of images, which are from a different modality
> and hence have difference pixel sizes, number of pixels etc.
>
> This seems to almost work. However, the image written by WarpImageFilter has
> the same number of pixels as the deformation field, and not of the input
> image. Is there anyway to change this? (I think that offsets etc are ok.)
>
> Code snippet:
>
> typedef itk::WarpImageFilter<
> MovingImageType,
> MovingImageType,
> DeformationFieldType > WarperType;
> WarperType::Pointer warper = WarperType::New();
> InterpolatorType::Pointer interpolator = InterpolatorType::New();
>
> warper->SetDeformationField( field);
> warper->SetInput( movingImage );
> warper->SetInterpolator( interpolator );
> warper->SetOutputSpacing( movingImage->GetSpacing() );
> warper->SetOutputOrigin( movingImage->GetOrigin() );
>
> Many thanks
>
> Kris Thielemans
> Hammersmith Imanet, part of GE Healthcare
> Cyclotron Building
> Hammersmith Hospital
> Du Cane Road
> London W12 ONN, United Kingdom
> web site address: http://www.hammersmithimanet.com/~kris
> -------------------------------------------
> NOTE: My inbox has a SPAM filter that automatically throws away suspect
> messages. If you expect a reply and don't get one, your message might have
> been wrongly classified.
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list