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

Christos Panagiotou C.Panagiotou at cs.ucl.ac.uk
Sun, 21 Mar 2004 02:43:04 +0000


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