[Insight-users] register two volumes of different types

Luis Ibanez luis.ibanez at kitware.com
Mon Dec 5 15:57:35 EST 2005


Hi Grace,

Once you figure out a value of Translation that is a good
initialization for your transform, you simply remove the
use of the CenterdTransformInitializer, and instead you fill
in the parameters array of the Transform.

Please read the ITK Software Guide for a description of
the parameters of the VersorRigid3DTransform. (See the Section
of Transforms in the Image Registration chapter).

You will have an array of 6 elements, and you will set the
first three to zero (because they represent rotations), then
you will set the last three to the values of initial Translation
along X, Y and Z respectively.

You should pass this array to the RegistrationMethod class by
calling the method:

    registration->SetInitialTransformParameters()

You MUST do this before invoking StartRegistration().



And alternative way of doing this is to set the tranform translation
using

            VectorType initialTranslation;
            initialTranslation[0] = Tx;
            initialTranslation[1] = Ty;
            initialTranslation[2] = Tz;
            transform->SetIdentity();
            transform->SetTranslation( initialTranslation );

    registration->SetInitialTransformParameters(
                             transform->GetParameters) )



See for example:

           Insight/Examples/Registration/
                       ImageRegistration5.cxx
                       ImageRegistration6.cxx
                       ImageRegistration7.cxx
                       ImageRegistration8.cxx
                       ImageRegistration12.cxx
                       ImageRegistration13.cxx



It will be very useful for you to also read the chapter on
resampling. That will help you understand the interactions
between the transform and the registration process.


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


This is Section 6.9, pdf-pages 252 to 279.



    Regards,



       Luis


--------------------
Grace Chen wrote:
> Hi Luis,
> 
> Thanx so much for helping me out!  But after figuring out the translation
> (in mm) that will align the center of the two 3D images (different image
> type, but the bigger one is properly cropped) together, how do I set the
> translation?  Do I call a function in CenteredTransformInitializer?  Because
> I am using Versor3DRigidTransform, so I am not sure how to do this...
> 
> Thanx a lot!! :>
> 
> Grace
> 
> 
> ----- Original Message ----- 
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "Grace Chen" <Grace.Chen at swri.ca>
> Cc: <insight-users at itk.org>
> Sent: Friday, December 02, 2005 5:19 PM
> Subject: Re: [Insight-users] register two volumes of different types
> 
> 
> 
>>Hi Grace,
>>
>>You will find tutorial material in the Image
>>Registration Chapter of the ITK Software Guide
>>
>>       http://www.itk.org/ItkSoftwareGuide.pdf
>>
>>in particular you will find explanations on the use
>>of the optimizer parameters, the scaling factors,
>>the transform parameters and the use of Observers.
>>
>>
>>
>>BTW it is very disturbing that your algorithm exits
>>without even making one iteration of the optimizer.
>>Something is certainly wrong at a higher level. A
>>typical registration should use 50 to 500 iterations
>>of the optimizer.
>>
>>
>>Please read the Image Registration chapter and let us
>>know if you have further questions.
>>
>>
>>   Thanks
>>
>>
>>     Luis
>>
>>
>>
>>------------------
>>Grace Chen wrote:
>>
>>>Hi Luis,
>>>
>>>Thanx for your wonderful suggestion!  I haven't done file IO for a long
> 
> time
> 
>>>so it didn't immediately appear to me as a debugging technique.
>>>
>>>So, I did my homework! : )  I added an Observer, and inserted code to
> 
> write
> 
>>>metric information to a file.  However, when the fix image is the
> 
> diffusion
> 
>>>weighted image and the moving image is the T1 weighted image, the
> 
> program
> 
>>>didn't even write one line to the file before it exit.
>>>
>>>I have to admit that I don't understand those registration parameters
> 
> (the
> 
>>>rotation for the VersorRigid3DTransform and the optimizer scale) well.
> 
> Is
> 
>>>there some tutorial material that help explain how to set those
> 
> parameters?
> 
>>>Thanx a lot for your help!!
>>>
>>>Grace
>>>
>>>----- Original Message ----- 
>>>From: "Luis Ibanez" <luis.ibanez at kitware.com>
>>>To: "Grace Chen" <Grace.Chen at swri.ca>
>>>Cc: <insight-users at itk.org>
>>>Sent: Thursday, December 01, 2005 5:41 PM
>>>Subject: Re: [Insight-users] register two volumes of different types
>>>
>>>
>>>
>>>
>>>>Hi Grace,
>>>>
>>>>
>>>>  You can have the Observer write the results to a file.
>>>>
>>>>  There is no reason why you couldn't run it this way
>>>>  when you invoke the registration from IDL.
>>>>
>>>>
>>>>
>>>>  The fact that reversing the image gets your registration
>>>>  to work is quite *suspicious*. That shouldn't be the case.
>>>>  Registration is supposed to be roughly symmetrical. Meaning
>>>>  that although the path of the optimizer doesn't have to be
>>>>  the same, it is to be expected that the registration should
>>>>  work in both ways.
>>>>
>>>>
>>>>   >  Does anyone knows what this means?
>>>>
>>>>
>>>>  Well, it means that the configuration of parameters
>>>>  for your registration is still quite fragile and
>>>>  probably that the ImageMetric is very very noisy.
>>>>
>>>>
>>>>
>>>>  Now that, from the practical point of view...
>>>>  it means that you still have to do your Homework:
>>>>
>>>>
>>>>          Connect an Observer to the Optimizer
>>>>          and send the Metric and Transform
>>>>          parameters per iteration to a file.
>>>>
>>>>
>>>>
>>>>
>>>>  In the time that we have been exchanging emails, you could
>>>>  have done that homework, and by now you would have a real
>>>>  answer to your registration problem.
>>>>
>>>>
>>>>
>>>>    Regards,
>>>>
>>>>
>>>>       Luis
>>>>
>>>>
>>>>
>>>>------------------
>>>>Grace Chen wrote:
>>>>
>>>>
>>>>>Hi Luis,
>>>>>
>>>>>Thanx so much for your help!
>>>>>
>>>>>Because the structure of my program is set up in a way that the ITK
>>>>>registration bit is at the lowest level (my program is an IDL program
>>>>>calling C++ programs that uses ITK registration code).  So, to see
> 
> those
> 
>>>>>registration parameters, I will have to set up another platform to see
>>>
>>>the
>>>
>>>
>>>>>testing output.  It might takes quite some time, so I will try some
>>>
>>>other
>>>
>>>
>>>>>possibilities first.
>>>>>
>>>>>I just reversed the order of the image so that the moving image is the
>>>>>diffusion weighted data and the fixed image is T1 image data (the
>>>
>>>moviing
>>>
>>>
>>>>>image was the T1 data and the fixed image was the diffusion weighted
>>>
>>>image
>>>
>>>
>>>>>when the program gave me segmentation fault!!), and it works now!  Does
>>>>>anyone knows what this means?
>>>>>
>>>>>Grace
>>>>>
>>>>>----- Original Message ----- 
>>>>>From: "Luis Ibanez" <luis.ibanez at kitware.com>
>>>>>To: "Grace Chen" <Grace.Chen at swri.ca>
>>>>>Cc: <insight-users at itk.org>
>>>>>Sent: Thursday, December 01, 2005 11:26 AM
>>>>>Subject: Re: [Insight-users] register two volumes of different types
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hi Grace,
>>>>>>
>>>>>>
>>>>>>Thanks a lot for sharing the screenshots of your images.
>>>>>>
>>>>>>
>>>>>>            They don't look too bad.
>>>>>>
>>>>>>
>>>>>>The registration shouldn't have major problems with these
>>>>>>two images.
>>>>>>
>>>>>>
>>>>>>
>>>>>>Could you please do the following:
>>>>>>
>>>>>>
>>>>>> 1) Add an observer to your optimizer,
>>>>>>
>>>>>> 2) Make it print the values of the Metric
>>>>>>    and Transform paramters at every iteration.
>>>>>>
>>>>>> 3) Take the output of the observer and post it
>>>>>>    to this list.
>>>>>>
>>>>>> 4) Add also statements such as
>>>>>>
>>>>>>      fixedImage->Print( std::cout )
>>>>>>      movingImage->Print( std::cout )
>>>>>>
>>>>>>    just before triggering the registration process,
>>>>>>    and post the output to the list too.
>>>>>>
>>>>>>
>>>>>>
>>>>>>By looking at the values of the Metric, the Transform
>>>>>>parameters, and the metadata of your images we should
>>>>>>be able to identify the reason why your registration
>>>>>>process is not working.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>>
>>>>>>
>>>>>>   Luis
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>-----------------------
>>>>>>Grace Chen wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi Luis,
>>>>>>>
>>>>>>>Thanx so much for detailed reply.  With this mail, I've attached a
>>>
>>>slice
>>>
>>>
>>>>>>>from each of the volumes.
>>>>>>
>>>>>>
>>>>>>>Thanx.
>>>>>>>
>>>>>>>Grace
>>>>>>>
>>>>>>>----- Original Message ----- 
>>>>>>>From: "Luis Ibanez" <luis.ibanez at kitware.com>
>>>>>>>To: "Grace Chen" <Grace.Chen at swri.ca>
>>>>>>>Cc: <insight-users at itk.org>
>>>>>>>Sent: Thursday, December 01, 2005 10:45 AM
>>>>>>>Subject: Re: [Insight-users] register two volumes of different types
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Hi Grace,
>>>>>>>>
>>>>>>>>
>>>>>>>>               Yes,
>>>>>>>>
>>>>>>>>
>>>>>>>>  ITK can register pairs of images
>>>>>>>>  that have different number of slices.
>>>>>>>>
>>>>>>>>
>>>>>>>>     or for that matter,
>>>>>>>>     different number of pixels
>>>>>>>>     along any dimension.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>If your registration program is not working
>>>>>>>>as you expected, here are the first things
>>>>>>>>that you should try:
>>>>>>>>
>>>>>>>>
>>>>>>>>1) Verify the values of Origin and Pixel
>>>>>>>> Spacing for both images. Make sure that
>>>>>>>> they are realistic values.
>>>>>>>>
>>>>>>>>2) Use a CenteredTransform Initializer.
>>>>>>>>
>>>>>>>>3) Connect an Observer to the Optimizer
>>>>>>>>
>>>>>>>>4) Plot the values of the Metric, at every
>>>>>>>> iteration of the optimizer.
>>>>>>>>
>>>>>>>>5) Plot the list of Transform parameters
>>>>>>>> at every iteration of the optimizer
>>>>>>>>
>>>>>>>>
>>>>>>>>Details on how to do each one of those steps
>>>>>>>>are presented in the ITK Software Guide
>>>>>>>>
>>>>>>>>http://www.itk.org/ItkSoftwareGuide.pdf
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>If you still have difficulties with your
>>>>>>>>registration process, please post your problem
>>>>>>>>as an article to the Insight Journal, and make
>>>>>>>>sure that you upload your two images, the source
>>>>>>>>code that you are using, and the parameters that
>>>>>>>>you  are passing to all the components of the
>>>>>>>>registration framework.
>>>>>>>>
>>>>>>>>
>>>>>>>>Please let us know if you have any question on
>>>>>>>>how to submit a report of negative results.
>>>>>>>>This is a forgotten art in the practice of scientific
>>>>>>>>research, mostly due to the detrimental influence of
>>>>>>>>the decadent publishing system that have provided
>>>>>>>>Pavlovian training to our community in order to only
>>>>>>>>report successful experiencies.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>>
>>>>>>>>
>>>>>>>>  Luis
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>------------------
>>>>>>>>Grace Chen wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Hi there,  Good day!
>>>>>>>>>
>>>>>>>>>I have two 3D image data I want to register.  The movement in the
>>>
>>>data
>>>
>>>
>>>>>>>>>is 3D rigid.  So, I use VersorRigid3DTransform.  The two volumes
> 
> are
> 
>>>>>>>>>different types of image data (one is T1 image, and the other
>>>>>>>>>is diffusion weighted image), so I use
>>>>>>>>>MattesMutualInformationImageToImageMetric. I know ITK can register
>>>
>>>two
>>>
>>>
>>>>>>>>>volumes of different physical dimension.  But doesn't it also
>>>
>>>register
>>>
>>>
>>>>>>>>>two volumes that have different number of slices?  My program
> 
> doesn't
> 
>>>>>>>>>work for two volumes of different types, am I missing something?
>>>>>>>>>
>>>>>>>>>Grace
>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>>>-----------------------------------------------------------------------
> 
> -
> 
>>>>>>>>>_______________________________________________
>>>>>>>>>Insight-users mailing list
>>>>>>>>>Insight-users at itk.org
>>>>>>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>>
>>>>>>>>_______________________________________________
>>>>>>>>Insight-users mailing list
>>>>>>>>Insight-users at itk.org
>>>>>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>------------------------------------------------------------------------
>>>>>
>>>>>------------------------------------------------------------------------
>>>>>
>>>>>>_______________________________________________
>>>>>>Insight-users mailing list
>>>>>>Insight-users at itk.org
>>>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>>>
>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>Insight-users mailing list
>>>>>Insight-users at itk.org
>>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>
>>>>_______________________________________________
>>>>Insight-users mailing list
>>>>Insight-users at itk.org
>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>>_______________________________________________
>>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