[Insight-users] MultiResMIRegistration - QuaternionRigid 2 Affine
Luis Ibanez
luis.ibanez at kitware.com
Sun, 21 Mar 2004 08:39:08 -0500
Hi Christos,
The first thing you may want to do is to
replace the AffineTransform with the
CenteredAffineTransform and use the
CenteredTransformInitializer for taking
care of initializing the gross translations.
The transform initializer will consider
the origin, pixel spacing and size (in pixel)
of your two images and will compute the
translation that will overlap the two images.
You will find an examples on the use of the
CenteredAffineTransform and the CenteredTransform
Initializer in
Insight/Examples/Registration/
ImageRegistration9.cxx
This will at least put you past the first iteration :-)
After that, you may want to start running a single
level of the pyramid, and fine tune its parameters
until you make it converge without using all the
alloted iterations.
Start by setting the translation scale to 1/D
Where D is the 10 * the largest diagonal in your
image measured in millimeters.
Regards,
Luis
--------------------------
Christos Panagiotou wrote:
> Dear all
>
> I am trying to modify the MultiResMIRegistration application in a way to
> handle an affine transformation (and not a QuaternionRigid) as i want to
> incorporate scaling.
> I want to register two different modalities (an MRI volume and a volume
> reconstructed by optical tomography data). The unchanged application
> achieves an acceptable
> if not very good result of registration, however the ot volume is
> smaller in size and is not obviously scaled to better fit the mri volume.
>
> I changed the optimizer to GradientDescentOptimizer and the
> QuaternionRigidTransform to AffineTransform.
>
> In the MIMRegistration.txx file I ve proceeded to the following changes:
>
> MIMRegistration::Execute()
>
> // Setup the optimizer
> typename OptimizerType::ScalesType scales(
> m_Transform->GetNumberOfParameters() );
> scales.Fill( 1.0);
>
> for ( int j = 9; j < 12; j++ ) // before it was j=4; j<7 for
> rigid quaternion T
> {
> scales[j] = m_TranslationScale; <---- scale the last N parameters (3
> dimensions) which represent translations
> }
>
> MIMRegistration::GetAffineTransform()
> m_AffineTransform->SetMatrix( m_Transform->GetRotationMatrix() );
> changed to:
> m_AffineTransform->SetMatrix( m_Transform->GetMatrix() );
>
> When I run the code I get the "All the sampled point mapped to outside
> of the moving image" exception from the first iterations
> even if i use a large translation scale value with small learning rates.
>
> i paste some of the input i ve tried in the parameters file.
> 4 4 1 (or 8 8 1)
> 2 2 1 ( 4 4 1)
> 2000 (<-- or 4000) 2500 2500 3000
> 1e-7 1e-7 5e-7 1e-6
> 320 (or bigger)
>
> I am not sure if i have to change more things to get the affine
> transform working (do i miss something very important)?
> Is the GradientDescentOptimizer a good choice or should i use the
> GradientDescentOptimizer?
>
> I do all the necessary permutations and flipping before the registration
> (and it worked fine in the rigidquaternionT)
>
> I ve read in the itk guide that in an AffineT the first iterations
> should be devoted to eliminate substantial translations and
> then the system should devote to rotations and scaling. I thought that
> this is accomplished by the fact that both fixed and moving
> images are centered in 0,0,0 by the use of a centerer. I assume it
> relates to translations after the centerer has been applied. How is it
> possible
> to implement such a thing?
>
> My main problem is actualy that i get the exception and i dont know if
> it is because i ve forgot to alter something in the code or if my
> parameters
> need tunning
>
> I would appreciate any suggestions
> christos
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>