[Insight-users] VTK to ITK Transform

Neilson Mackay 9nem at qlink.queensu.ca
Thu Jul 12 02:48:03 EDT 2007


Thank you kindly for the reply Luis.

1)
I actually got my images in VTK and ITK to overlap correctly when  
flipping on the following 'x' axes:

|--- -----  ---- ----  ---- ---- x
|
|
|
|
y

I assume that the image origin is the only difference between ITK and  
VTK.  If I flip my image, should be able to trust that X, Y and Z are  
all in the same direction?



Oh, one last follow up question.  I am performing a registration  
between my two images in a while loop using different "initial  
guess" ( parameters ) each loop:

  For ( num tests )
	Registration Set up
	
	Register images
different
	Record Results

The problem I am seeing is, if I run the loop may times with the  
exact same parameters ( zero rotation and translation ) I get  
different results on each loop.  But, every time I execute the  
program, the results are the same.  i.e

If the "for loop" ran 3 times using the exact same parameters for  
each loop I would get  A, B and C as results.  Where A, B and C are  
all different.  When I re-execute the program, I would get A, B and C  
again.

I am very puzzled as how this could occur.  I would expect if a  
random number was being used, that A, B and C would be produced and  
be different.  What I do not expect is for every execution of the  
program using the same images and parameters, I would always get A, B  
and C.

If you need to know, I am using Mattes Mutual Information as a metric  
and the Regular step Gradient Optimizer.  If you are interested in me  
explaining more, I can go into further depths as to what my code  
looks like.  I didn't want to bombard you on one email though :)

Cheers,
Neilson

On Jul 11, 2007, at 9:35 AM, Luis Ibanez wrote:

>
> Hi Neilson,
>
>
> 1) ITK and VTK image should be flipped along the "Y" axis,
>    not the "X" axis.
>
>    What file format are you using ?
>
>    In order to work consistenty between ITK and VTK you
>    should "think" on physical space. That includes to
>    be aware of the position and orientation of the
>    vtkCamera.  You want to put the vtkCamera in the location
>    and orientation of the physician that is looking at the
>    images. (a neurosurgeon will be above the patient head
>    looking down to the patients' feet, a radiologist will
>    be at the patient's feet, looking towards the patient's
>    head, .. in both cases the patient will be lying on his
>    back on a horizontal table.
>
>    If you are actually developing a medical application
>    you probably should use the DICOM default coordinate
>    system in order to organize the scene visualization.
>
>
>
> 2) Transforms in VTK are applied to actors, and they
>    *actually* move the image in space. Transforms in ITK
>    map from the original space to the space of the image,
>    so, most of the time, the ITK transform that you use
>    in a resample image filter should be the inverse of
>    the VTK transform that you want for visualization
>    purposes.
>
>
>
>   Regards,
>
>
>
>      Luis
>
>
>
> ----------------------
> Neilson Mackay wrote:
>> Hello,
>> I am having some difficulty using the same transform in VTK and  
>> ITK.   I have two problems:
>>     1.  Images read in VTK and ITK are flipped along the 'X' axis.
>>     2.  The transforms I use to translate a image in VTK doesn't  
>> seem to  position the image in the same position in ITK.
>> Has anyone else ran into similar difficulties?  I assume the 2nd   
>> problem of mine has something to do with how rotation is applied  
>> in  VTK vs ITK.
>> As a reference I am using "vtkTransform" in vtk and   
>> "Euler3DTransform" in ITK.  Also, the images I am comparing are  
>> of  different spacing.  To confirm where Image A is on image B in  
>> itk I  am using the "ResampleImageFilter".
>> I could go on with more code if it would help shed some light.
>> I am open to any suggestion,
>> Cheers,
>> Neilson
>> _______________________________________________
>> 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