[Insight-users] MultiResMIRegistration - QuaternionRigid 2 Affine (3)

Luis Ibanez luis.ibanez at kitware.com
Sun, 21 Mar 2004 09:07:26 -0500


Hi Christos,

Registration in ITK is done in Physical coordinates.
You must think in terms of millimeters instead of
thinking in terms of number of pixels.  A pixel is
not a unit of measurement.

The actual size of your images is computed by multiplying
the number of pixels along each side of the image by the
pixel spacing in millimeters.

For example, your MRI image has number of pixels =

     256 X 256 x 136

and it should have pixel spacing of something like

     0.5mm  X  0.5mm   X  1.0mm

( or probably you are lucky enough to have better
   resolution that can match the pixel spacing of
   the optical tomography volume.)


The physical extent of the MRI image is then:

    128.0 mm   X   128.0 mm   X 136 mm


That's the dimension that you should have in mind when
reasoning about the relative size of the images.

What is the pixel spacing of your optical tomography
image ?

Please compute the physical extent of the OT image...

What is the origin of the MRI image ?

What is the origin of the OT image ?



Note that if the pixel spacing of the OT image is
calibrated correctly, there is no reason why you
should be expecting any scaling. The pixel spacing
in the image should provide a natural scaling between
the image grid and the physical space.


Regarding the use of the GradientDescentOptimizer
versus the RegularStepGradientOptimizer, their
selection depends on how noisy the image metric
is. You cannot simply generalize a statement such
as "one is faster than the other". There are many
circumstances that will determine the performance
of each one.


You may find useful to look at the two following
presentations:


http://www.cs.rpi.edu/courses/spring04/imagereg/lecture07.ppt
http://www.cs.rpi.edu/courses/spring04/imagereg/lecture08.ppt




Regards,



    Luis



------------------------------------------------
Christos Panagiotou wrote:

> guys
> 
> i am sorry for writing the third consecutive email without waiting the 
> answers for the other two...
> i need to ask something about scaling (not the translation scale factor) 
> in the affine transformation.
> 
> I register the two volumes from different modalities using the 
> MultiResMIRegistration which has been altered
> and does not use quaternionRigidT but AffineT. Also the optimizer now is 
> RegularStepGradientDescent.
> 
> The first volume (MRI) is 256x256x136 and the second volume is 
> 100x120x138 (Optical Tomography).
> After the registration completes the volumes seem aligned enough. 
> Substantial translation has taken place however I dont see any 
> substantial scaling of the smaller volume
> to reach at least a size similar to the fixed one. The output of the 
> application is the following:
> 
> Final parameters: [0.99324, 0.00293927, 0.00176662, 0.00253656, 
> 0.998594, -0.000835126, 0.00168811, -0.00157159, 0.992728, 1.62397, 
> 3.78007, 1.85686]
> Overall transform matrix:
> 0.00168811 -0.00157159 0.992728
> -0.99324 -0.00293927 -0.00176662
> 0.00253656 0.998594 -0.000835126
> 
> Overall transform offset:
> -15.6672  185.008  -55.3077
> 
> The code I use is the one found in the MIMRegistration.txx in the 
> MultiResMiRegistration application
> 
>  // Default parameters
>  m_NumberOfLevels = 1; //value from parameter file is 4
>  m_TranslationScale = 1.0; //value from parameter file is around 300
>  m_MovingImageStandardDeviation = 0.4;
>  m_FixedImageStandardDeviation = 0.4;
>  m_NumberOfSpatialSamples = 50;
> 
>  m_FixedImageShrinkFactors.Fill( 1 );  // shrink factor values come from 
> parameter file - these are skipped
>  m_MovingImageShrinkFactors.Fill( 1 );
> 
>  m_NumberOfIterations = UnsignedIntArray(1);
>  //Set elements of the array to the specified value
>  m_NumberOfIterations.Fill( 10 ); // from parameter file values are 2000 
> iterations per level
> 
>  m_LearningRates = DoubleArray(1);
>  m_LearningRates.Fill( 1e-4 ); //updated from parameter file
> 
>  m_InitialParameters = ParametersType(m_Transform->GetParameters());
> 
> }
> 
> 
> template <typename TFixedImage, typename TMovingImage>
> MIMRegistrator<TFixedImage,TMovingImage>
> ::~MIMRegistrator()
> {
>  m_Registration->RemoveObserver( m_Tag );
> 
> }
> 
> 
> template <typename TFixedImage, typename TMovingImage>
> void
> MIMRegistrator<TFixedImage,TMovingImage>
> ::Execute()
> {
> 
>  // Setup the optimizer
>  typename OptimizerType::ScalesType scales(
>    m_Transform->GetNumberOfParameters() );
>  scales.Fill(1.0)
>  for ( int j = 9; j < 12; j++ )
>    {
>    scales[j] = m_TranslationScale;
>    }
> 
>  m_Optimizer->SetScales( scales );
>  m_Optimizer->SetMaximumStepLength(1);
>  m_Optimizer->SetMinimumStepLength(0.005 );
>  m_Optimizer->MaximizeOn();
> 
>  // Setup the metric
>  m_Metric->SetMovingImageStandardDeviation( 
> m_MovingImageStandardDeviation );
>  m_Metric->SetFixedImageStandardDeviation( m_FixedImageStandardDeviation );
>  m_Metric->SetNumberOfSpatialSamples( m_NumberOfSpatialSamples );
> 
>  // Setup the image pyramids
>  m_FixedImagePyramid->SetNumberOfLevels( m_NumberOfLevels );
>  m_FixedImagePyramid->SetStartingShrinkFactors(
>    m_FixedImageShrinkFactors.GetDataPointer() );
> 
>  m_MovingImagePyramid->SetNumberOfLevels( m_NumberOfLevels );
>  m_MovingImagePyramid->SetStartingShrinkFactors(
>    m_MovingImageShrinkFactors.GetDataPointer() );
> 
>  // Setup the registrator
>  m_Registration->SetFixedImage( m_FixedImage );
>  m_Registration->SetMovingImage( m_MovingImage );
>  m_Registration->SetNumberOfLevels( m_NumberOfLevels );
> 
>  m_Registration->SetInitialTransformParameters( m_InitialParameters );
> 
>  m_Registration->SetFixedImageRegion( m_FixedImage->GetBufferedRegion() );
> 
>  try
>    {
>    m_Registration->StartRegistration();
>    }
>  catch( itk::ExceptionObject & err )
>    {
>    std::cout << "Caught an exception: " << std::endl;
>    std::cout << err << std::endl;
>    throw err;
>    }
> 
> the weird thing is that i tried the method with both gradientdescent and 
> regularstepgradientdescent with 2000plus number of iterations per level and
> the regularStepGradientDescentOptimizer was faster than the 
> gradientDescent. I ve read in the mailing list that this is not the 
> case. Probably I do something very wrong
> 
> I would appreciate any help on how to increase or implement (if i forget 
> something major here) the scaling of the moving image using the affine 
> transform.
> Is it the AffineTransform::Scale() method? and if it is how can it be used?
> 
> sorry for the number of emails and questions - i appreciate your tolerance!
> thanks
> chris
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>