[Insight-users] Using WarpImageFilter where deformation field and image have different dimensions

Luis Ibanez luis.ibanez at kitware.com
Fri Aug 11 15:55:19 EDT 2006


Hi Kris,

Actually it is pretty easy to create a transform out of a deformation
Field.

You can write your own class that deriving from the itk::Transform,
and accepting a deformation field.

The only method that you need to implement in your transform class
(in order to use it with the ResampleImageFilter) is the TransformPoint
method.

In that method you take an incoming point, use the deformation field
to convert it into an index using the TransformPhysicalPointToIndex,
use that index to probe the deformation field and take the vector
from it.

Then add that vector to the incoming point, and send the result as
the output point.


If you write such a class, it will be a nice contribution to the
Insight Journal:


      http://www.insight-journal.org



   Please let us know if you have any questions,


      Thanks


        Luis



-----------------------------------------
Thielemans, Kris (GE Healthcare) wrote:
>  
> Thanks Luis
> 
> I'm not eager to change WarpImageFilter at present. 
> 
> I hoped I would be able to use ResampleImageFilter, but that needs a
> Transform, and there doesn't seem an easy way to make a Transform from a
> DeformationFieldType
> 
> typedef itk::Vector< float, ImageDimension >  VectorPixelType;
> typedef itk::Image<  VectorPixelType, ImageDimension>
> DeformationFieldType;
> 
> (I guess because the requirements for SetParameters/GetParameters don't
> work easily).
> 
> I'll be looking at a post-processing solution then.
> 
> Thanks again
> 
> Kris
> 
> 
>>-----Original Message-----
>>From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
>>Sent: 10 August 2006 01:29
>>To: Kris Thielemans
>>Cc: insight-users at itk.org; Thielemans, Kris (GE Healthcare)
>>Subject: Re: [Insight-users] Using WarpImageFilter where 
>>deformation field and image have different dimensions
>>
>>
>>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