[Insight-users] Registration
Luis Ibanez
luis . ibanez at kitware . com
Wed, 01 Oct 2003 10:18:17 -0400
Hi SriValli,
You don't accept the registration based on the numerical
values of the matrix (unless you know what the missalignment
is beforehand).
What you may want to do is to take the transform at the
end of this first level and feed it into a ResampleImage
filter, use this filter for resampling the moving image,
and finally use visualization to evaluate the alignment
of the fixed image with the resampled moving image.
[You can use the free version of VolView for comparing
both images. Simply load the fixed image first and
then use the Merge filter in the Utility menu.]
The Centered affine transform uses a Center point "C",
a translation vector "V" and a rotation+scaling+shearing
matrix "M".
A point "P" is transformed into a point "P'" by
the expression
P' = M . (P-C) + (V+C)
that can be rewriten as a classical affine transform
by doing
P' = M . P + V"
where
V" = V + C - M . C
In other words, the Matrix of the centered affine
transform, is just the same matrix of the typical
affine transform. It contains rotational terms, scale
terms and shearing terms.
Again... looking at the numbers directly will not
have any use. You should rather use the transform
for resampling the moving image and then use a
visualization process for overlaping the fixed image
and the resampled moving image.
Many of the examples in the software guide use the
VTK Checkerboard filter.
Regards,
Luis
-------------
CSPL wrote:
> Dear Mr.Luis,
>
> Thank you for your reply. In your mail you asked us to tune parameters for
> first level and go for next level only when first level is acceptable. But,
> How to check the matrix values. In Matrix , which values correcsponds to
> Rotations ?
> My doubt is i don't know how much rotation and translation is involved in
> the moving image.
> How can we accept the registration based on the matrix?
>
> I am enclosing the matrix after first level.
> 1.147362 0.070887 0.089196
> -0.176499 0.904573 -0.147918
> 0.104517 0.045014 1.090493
>
> 118.919220 121.921404 75.138418
>
> 17.436113 18.209017 -16.436110 0.00000
>
> Can you please explain the matrix in CenterdAffineTransform??
>
>
>
> Thanking you,
> Regards,
> SriValli.
>
>
>
> ----- Original Message -----
> From: "Luis Ibanez" <luis . ibanez at kitware . com>
> To: "CSPL" <affable at hd2 . dot . net . in>
> Cc: "ITKUsers" <insight-users at itk . org>
> Sent: Saturday, September 27, 2003 1:55 AM
> Subject: Re: [Insight-users] Registration
>
>
>
>>Hi SriValli,
>>
>>You may have to tune this registration progresively.
>>
>>The first thing to verify is the quality of the initialization.
>>
>>Please do the following:
>>just initialize the transform as your are currently doing,
>>and use the transform in a Resample image filter in order
>>to resample the moving image.
>>
>>The idea is to check how good/bad the initial position of the
>>image is.
>>
>>The distribution of intensities in your SPECT image is quite
>>different from the distribution in the MRI one, so it is possible
>>that by computing the moments, the initial alignment of the images
>>will not be a good starting point.
>>
>>Note that by resampling at the inital stage, the affine transform
>>shouldn't require any scaling since the spacing in your images
>>seems to be consistent.
>>
>>If you find the initialization to be reasonable, then run first
>>a single level pyramid but with a subsampling of 8 and 4 (fixed and
>>moving image). Tune the parameters of the optimizer until the result
>>of this single-level registration is acceptable. Only then, move
>>ahead to add more levels to the pyramid.
>>
>>Add a Command/Observer to the optimizer and track the evolution
>>of the registration at each iteration. That is always helpful in
>>the process of tunning the registration parameters.
>>
>>
>>
>> Regards,
>>
>>
>> Luis
>>
>>
>>-----------------
>>CSPL wrote:
>>
>>>Dear Mr.Luis,
>>>
>>>Thank you for reply.I am using the same way as you mentioned. I used
>>>CenteredAffineTransform and CenteredTransformInitializer to initialize
>>>transform.
>>>I am enclosing the code snippet and image details.
>>>
>>>My FixedImage is 256 X 256 X 120; spacing is 0.8593X 0.8593 X 1.6.
>>>MovingImage is 128 X 128 X 95; spacing is 1.802125 X 1.802125 X 3.60425
>>>
>>>*********
>>>metric->SetNumberOfSpatialSamples( 1000);
>>>metric->SetNumberOfHistogramBins( 50 );
>>>
>>>unsigned int Factors1[ 3 ] = { 8, 8, 1 };
>>>unsigned int Factors2[ 3 ] = { 4, 4, 1 };
>>>
>>>FixedImagePyramidType::Pointer fixedImagePyramid =
>>>FixedImagePyramidType::New();
>>>fixedImagePyramid->SetStartingShrinkFactors( Factors1 );
>>>registration->SetFixedImagePyramid( fixedImagePyramid );
>>>
>>>MovingImagePyramidType::Pointer movingImagePyramid =
>>>MovingImagePyramidType::New();
>>>movingImagePyramid->SetStartingShrinkFactors( Factors2 );
>>>registration->SetMovingImagePyramid( movingImagePyramid );
>>>
>>>TransformType::Pointer transform = TransformType::New();
>>>typedef itk::CenteredTransformInitializer<TransformType, FixedImageType,
>>>MovingImageType > TransformInitializerType;
>>>TransformInitializerType::Pointer initializer =
>>>TransformInitializerType::New();
>>>initializer->SetTransform( transform ); //transform is
>>>CenteredAffineTransform
>>>initializer->SetFixedImage( FixedImage );
>>>initializer->SetMovingImage( MovingImage );
>>>initializer->MomentsOn();
>>>initializer->InitializeTransform();
>>>
>>>const double translationScale = 1.0 / m_translateScale;
>>>optimizerScales.Fill( 1.0 );
>>>
>>>for( int i = 0; i <= 11; i++ )
>>>{
>>> optimizerScales[ i ] = 1.0 /1;
>>>}
>>>optimizerScales[ 9 ] = translationScale;
>>>optimizerScales[ 10 ] = translationScale;
>>>optimizerScales[ 11 ] = translationScale;
>>>optimizerScales[ 12 ] = translationScale;
>>>optimizerScales[ 13 ] = translationScale;
>>>optimizerScales[ 14 ] = translationScale;
>>>
>>>optimizer->SetScales( optimizerScales );
>>>optimizer->SetMaximumStepLength(4 );
>>>optimizer->SetMinimumStepLength(0.005 );
>>>optimizer->SetMaximize( TRUE);
>>>registration->SetOptimizer( optimizer ); //optimizer is object of
>>>RegularStepGradientDescentOptimizer object
>>>
>>>registration->SetNumberOfLevels( 5);
>>>optimizer->SetNumberOfIterations( 250);
>>>************
>>>Fixed volume is the extracted brain part of the original MR volume.
>>>Moving is the spect volume
>>>
>>>Our requirement is to register moving with the fixed, The registered
>>
> spect
>
>>>is transformed and fused with the original MR so that spect fuses with
>>
> the
>
>>>brain and not with the other tissues.
>>>
>>>
>>>Output images are given linked to
>>>http://www . comsols . com/Registration-images . htm
>>>Please tell me where i am giving wrong inputs.
>>>
>>>Thanking you,
>>>Regrads,
>>>SriValli.
>>>
>>>
>>>
>>>
>>
>>
>>
>
>