[Insight-users] arbitrary warp filter

Luis Ibanez luis.ibanez at kitware.com
Wed, 14 Apr 2004 13:28:52 -0400


Hi Rahul,

Writing a new ITK Transform is quite simple specially
if you only want to use it for resampling an image.

Things are a bit more difficult if you want to use the
transform inside the Image Registration framework,
because in that case you should provide Jacobians with
it and make sure that you encode the transform parameters
in an array of doubles.


In your case you could simply take a basic transform
such as the itkTranslationTransform

http://www.itk.org/Insight/Doxygen/html/classitk_1_1TranslationTransform.html

Rename it and implement your transformation process
in the method:

             TransformPoint();

Note that ITK is not restricted to use transforms that
can be represented with a matrix (as you would expect from
graphics software packages). You can directly implement
your Transform in ITK by making "{a,b,c,d,e,f}"  be
(private) member variables of the Transform. Please create
Set/Get methods for them using the itkGet/Set macros, and
then write your transformation equation directly into the
TransformPoint() method.

Once you have a prototype of your transform you can use it
for resampling images by pluging this transform into the 
itk::ResampleImageFilter.
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ResampleImageFilter.html

You are *strongly* encouraged to read the section about
resampling in the SoftwareGuide.

      http://www.itk.org/ItkSoftwareGuide.pdf

Section 6.7.1, pdf-page 199. Note that there are multiple
source code example associated with this text into the
Insight/Examples/Filtering directory.

Studying this section will help you a lot in the process of
understanding how resampling works and how to interpret its
results.It is common for first users to have trouble with
the interpretation of the forward or backward transform.



Regards,


    Luis



--

Just FYI, you fill find the entire list of ITK transforms
in the 'groups' section of Doxygen documentation:
http://www.itk.org/Insight/Doxygen/html/group__Transforms.html





--------------------
Rahul Chander wrote:

> Hello itk developers,
> I need to implement an arbitrary transform which is non-linear in 
> nature.  
> The transform acting on physical co-ordinates (x0,y0) produces 
> (x1,y1) and can look something like this for 2D:
> [x1;y1]'=[g(x0,y0);h(x0,y0)]',  where g, h are arbitrary functions.
> 
> e.g.
> [x1;y1] = [ax^2+by^3+c; d xy+ e y^2+f]  
> 
> for x=x0, y=y1
> and constants a,b,c,d,e,f.
> 
> I was thinking of starting off with a simple 2D transform's .txx and 
> .h files to implement my own transform according to the above 
> function.  At this point I do not know where in the itk code the 
> transform matrix gets multiplied with a point's co-ordinates to 
> result in the new set of co-ordinates.
> 
> ie.  [x1;y1]' = [some function of (x,y)] * [x0;y0]'   <--- where in 
> itk does this multiplication operation occur?
> 
> Secondly, which transform's code would be the easiest to modify for 
> my needs. And last of all, is there a way around all this without 
> going into low level implementation?
> 
> Thanks in advance.
> Rahul.
>