[Insight-users] Error using Registration - Mutual Information + AffineTransform
Bill Lorensen
bill.lorensen at gmail.com
Wed Jun 24 12:39:40 EDT 2009
I think your learning rate is way too high for Viola-Wells MI. Try
something like .001.
On Wed, Jun 24, 2009 at 12:18 PM, sharath v<sharath20284 at yahoo.com> wrote:
> Hi Luis,
>
> Thanks for the reply.
>
> I have already done the task that you have mentioned. I studied the example
> ImageRegistration9.cxx, and it worked for me with RTS images (from
> BrianProtonDensity set).
>
> Below are the set of things I added to ImageRegistration9.cxx for Mutual
> Information + Affine
>
> - changed the metric from MeanSquare to Mutual Information, and set the
> required parameters
> - changed RegularStepGradientDescentOptimizer to GradientDescentOptimizer
> (as said in example 2)
> - enabled optimizer->MaximizeOn()
> - started with a low value of learning rate (5.0) as it gave an exception
> when 15.0 was used.
> - used NormalizeImageFilter and DiscreteGaussianImageFilter on both the
> images as in example 2
> - used CenteredTransformInitializer as explained in the manual
>
> - And as you have mentioned I have used the Parameter scaling i.e
> optimizer->SetScales( optimizerScales ) with translation scale value = 0.001
>
> ** I got an exception when I tried to give the output of fixedSmoother and
> movingSmoother (from Example 2) to the initializer code below.
>
> initializer->SetFixedImage( fixedImageReader->GetOutput() );
> initializer->SetMovingImage( movingImageReader->GetOutput() );
>
> Hence I retained it to the outputs from fixedImageReader and
> movingImageReader, as in the code snippet above. *****PLEASE LET ME KNOW IF
> THIS IS CORRECT ?
>
> If I removed the Normalizing and Smoothing filters, I got an exception that
> the standard deviation of the metric is very low. It works when sigma = 1.5,
> but the output is wrong . Hence I retained these filters, with sigma = 0.4.
>
> I followed your reply at a thread at nabble.com to download the
> imageregistration.exe and tried to overlay the output of the initializer
> (moving image warped with the initializer params) and this step is correct
> for BrainProtonDensitySliceShifted13x17y.png .
>
> My current code fails for both BrainProtonDensitySliceShifted13x17y.png
> image and BrainProtonDensitySliceR10X13Y17.png image. It gives correct
> values for translation, but fails for rotation angle, and in both cases,
> gives high value for scaling ( Sx = ~4 and Sy= ~2) which are completely
> wrong.
>
> I also tried working with MultiResImageRegistration2.cxx code which uses
> Matte + Affine. The output parameters obtained were WRONG when I tried with
> BrainProtonDensitySliceR10X13Y17.png image, instead of the example mentioned
> in the code.
>
> I also tried with other optimizers such as Amoeba and OnePlusOne optimizers,
> with Viola MI + Affine. For Amoeba, the code gives correct result for
> translation for BrainProtonDensitySliceShifted13x17y.png only if the
> Parameter scaling is DISABLED. In other cases, the affine angle obtained
> starts with -83 degrees (where the expected value is R = 10 ) i.e in few
> cases code runs to completion, but the answer is wrong OR exception occurs,
> that sampled point mapped to outside of the moving image.
>
> I am totally confused with the results . I have planned to use Mutual
> Information registration from ITK for non-medical images.
>
> Can you please give me pointers, where I might be going wrong?
>
> Thanks for the help,
>
> Sharath Venkatesha
>
>
>
>
> ________________________________
> From: Luis Ibanez <luis.ibanez at kitware.com>
> To: sharath v <sharath20284 at yahoo.com>
> Cc: insight-users at itk.org
> Sent: Tuesday, June 23, 2009 9:21:42 PM
> Subject: Re: [Insight-users] Error using Registration - Mutual Information +
> AffineTransform
>
>
> Hi Sharath,
>
> If you are interested in Affine registration you should probably
> start with ImageRegistration9.cxx instead of modifying
> ImageRegisration2.cxx.
>
> In particular, you are probably missing to set up the
> ParameterScaling array, which is critical for normalizing the
> dynamic range of the different Transform parameters.
>
> This was not critical for the case of the Translation Transform,
> but it becomes very important in Rigid and Affine transforms.
>
>
> Please study the ImageRegistration9.cxx example and
> let us know if you have any questions.
>
>
> Thanks
>
>
> Luis
>
>
> ----------------------------------------------------
> On Tue, Jun 23, 2009 at 7:44 PM, sharath v <sharath20284 at yahoo.com> wrote:
>>
>> Hi,
>>
>> I am trying to run example ImageRegistration2 with Affine Transform. This
>> example uses originally used Mutual Information based registration with
>> Translation.
>>
>> I extended by using AffineTransform, and used the
>> CenteredTransformInitializer for initialization ( according to example
>> ImageRegistration9, which uses Affine with MeanSquares optimizer)
>>
>> But, I do run into errors.
>>
>> For the CenteredTransformInitializer, I use the following piece of code
>>
>> typedef itk::CenteredTransformInitializer< TransformType, FixedImageType,
>> MovingImageType > TransformInitializerType;
>> TransformInitializerType::Pointer initializer =
>> TransformInitializerType::New();
>> initializer->SetTransform( transform );
>> initializer->SetFixedImage( fixedImageReader->GetOutput() ); //*******
>> initializer->SetMovingImage( movingImageReader->GetOutput() );
>> //*******
>> initializer->MomentsOn();
>>
>> initializer->InitializeTransform();
>> registration->SetInitialTransformParameters(transform->GetParameters()
>> );
>>
>> The program runs into completion, but gives WRONG values for scale and
>> rotation parameters. The translation parameters obtained are correct.
>>
>> If I change the starred lines (above in the code) to the take the output
>> of the fixedSmoother and movingSmoother respectively ( which I think is
>> correct, as they are output of the smoothing function in example2) , I get
>> an exception
>>
>> ***** Description: itk::ERROR:
>> MutualInformationImageToImageMetric(012D3058): All the sampled point mapped
>> to outside of the moving image
>>
>> I have tried the same with Mattes Mutual Information example, to get the
>> same exception.
>>
>> I have also used the appropriate scale setting code as in example 9.
>>
>>
>>
>> Thanks in advance for the help,
>>
>> Sharath Venkatesha
>>
>>
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list