[Insight-users] Affine registration and Viola-Wells MI
Luis Ibanez
luis.ibanez at kitware.com
Wed Jun 6 12:17:40 EDT 2007
Hi Markus,
This claim:
" With the affine algorithm with
Viola-Wells MI I get horrible results. "
It is *anecdotic useless information*, since it is not accompanied
with the images that you used, nor the full set of parameters
that you are feeding in to the method. In this form, the claim
is as useless as saying that you looked once through the window
and it was raining.
Algorithms require to be fine tuned for every specific application.
At this point is not clear if your registration is not working
because you have a problem reading your image metadata correctly
(e.g. origin and spacing), or because of poor initialization, or
due to a bad choice of the optimization parameters, or an inadecuate
choice of the image metric parameters (such as number of bins and
number of samples).
In order to participate in a productive technical discussion
you should provide a sufficient amount of details about your
for allowing anybody to *REPRODUCE* what you are seeing.
----
If the error happens in the first iteration, that indicates
that you are probably providing a poor initialization.
It may be that the use of Moments in the CenteredTransform
Initializer is not appropriate for the pair of images that
you have.
Please do the following:
1) Temporarily disable the registration, and simply take
the transform resulting from the initialization and
use it for resampling the moving image.
2) Look at that resampled image in a viewer and see how
it matches the fixed image.
As a viewer you can use the application:
http://public.kitware.com/pub/itk/InsightApplicationsBin/
ImageRegistrationTool.exe
where you can upload the Fixed and Resampled Moving images
and compared them in a blended visualization.
3) If the initialization is not good, you should try using
the Geometry mode of the initializer, and if that doesn't
work either, then you should consider using the Landmark
initializer.
4) Once you have a good initialization, you can reinstate
the registration, starting with a very small learning
rate. Once you find a learning rate that brings you
to convergence, you can try speeding up the proceess
by increasing the learning rate.
As you can see, the process of fine tunning the parameters
of the registration is as important as the process of
putting the code together.
Regards,
Luis
--------------------
Markus Voigt wrote:
> Hi Xabier,
>
> the error comes after the first iteration. I think I have focused the
> problem:
> the Optimizer has no stopping criteria. The optimzer tries to run for
> the assigned numbers of iterations
> optimizer->SetNumberOfIterations( maxNumberOfIterations );
> if I set the numbers of iterations to 1 I don't get an error message.
> If I set the lerning rate to 0.1 it runs 22 iterations.
> I have programmed the affine algorithm with the Mattes MI and it runs
> perfect with good results.
> With the affine algorithm with Viola-Wells MI I get horrible results.
> The problem is that I have to use the Viola-Wells MI algorithm
> Regards,
> Markus
>
> Xabier Artaechevarria Artieda schrieb:
>
>> Hi Markus,
>>
>> Does the error come out in the first iteration or later?
>>
>> Regards,
>> Xabi
>>
>>
>>
>> "Voigt, Markus" <Markus.Voigt at medizin.uni-leipzig.de> ha escrito:
>>
>>> Hello,
>>>
>>> I'm trying to create a program where I want to use the Viola-Wells
>>> (Mutual Information algorithm) and the affine registration.
>>>
>>> In the examples of ITK I found the MI algorithm and the affine algorithm
>>> but both are using different Optimizer. I tried to match all the things
>>> together in one cpp-file so that it should work but it doesn't
>>>
>>> I got this error message on the command line:
>>>
>>> "MutualInformationImageToImageMetric(018CBC40): All the sampled point
>>> mapped to outside of the moving image"
>>>
>>> Could someone help me? I think it is something simple, but I haven't got
>>> a clue.
>>>
>>> Cheers,
>>>
>>> markus
>>>
>>>
>>>
>>>
>>>
>>> This is the source code
>>>
>>>
>>>
>>> //start Viola-Wells mutual information
>>>
>>> metric->SetFixedImageStandardDeviation( 0.4 );
>>>
>>> metric->SetMovingImageStandardDeviation( 0.4 );
>>>
>>>
>>>
>>> //load pictures
>>>
>>> typedef itk::ImageFileReader< FixedImageType > FixedImageReaderType;
>>>
>>> typedef itk::ImageFileReader< MovingImageType > MovingImageReaderType;
>>>
>>> FixedImageReaderType::Pointer fixedImageReader =
>>> FixedImageReaderType::New();
>>>
>>> MovingImageReaderType::Pointer movingImageReader =
>>> MovingImageReaderType::New();
>>>
>>> fixedImageReader->SetFileName( arg1 );
>>>
>>> movingImageReader->SetFileName( arg2 );
>>>
>>>
>>>
>>>
>>>
>>> typedef itk::NormalizeImageFilter<
>>>
>>> FixedImageType,
>>>
>>> InternalImageType
>>>
>>> > FixedNormalizeFilterType;
>>>
>>> typedef itk::NormalizeImageFilter<
>>>
>>> FixedImageType,
>>>
>>> InternalImageType
>>>
>>> >
>>> MovingNormalizeFilterType;
>>>
>>> FixedNormalizeFilterType::Pointer fixedNormalizer =
>>> FixedNormalizeFilterType::New();
>>>
>>> MovingNormalizeFilterType::Pointer movingNormalizer =
>>> MovingNormalizeFilterType::New();
>>>
>>>
>>>
>>>
>>>
>>> typedef itk::DiscreteGaussianImageFilter<
>>>
>>> InternalImageType,
>>>
>>> InternalImageType
>>>
>>> > GaussianFilterType;
>>>
>>> GaussianFilterType::Pointer fixedSmoother =
>>> GaussianFilterType::New();
>>>
>>> GaussianFilterType::Pointer movingSmoother =
>>> GaussianFilterType::New();
>>>
>>>
>>>
>>> fixedSmoother->SetVariance( 2.0 );
>>>
>>> movingSmoother->SetVariance( 2.0 );
>>>
>>>
>>>
>>> fixedNormalizer->SetInput( fixedImageReader->GetOutput() );
>>>
>>> movingNormalizer->SetInput( movingImageReader->GetOutput() );
>>>
>>>
>>>
>>> fixedSmoother->SetInput( fixedNormalizer->GetOutput() );
>>>
>>> movingSmoother->SetInput( movingNormalizer->GetOutput() );
>>>
>>>
>>>
>>> registration->SetFixedImage( fixedSmoother->GetOutput() );
>>>
>>> registration->SetMovingImage( movingSmoother->GetOutput() );
>>>
>>>
>>>
>>> fixedNormalizer->Update();
>>>
>>> FixedImageType::RegionType fixedImageRegion =
>>> fixedNormalizer->GetOutput()->GetBufferedRegion();
>>>
>>> registration->SetFixedImageRegion( fixedImageRegion );
>>>
>>> //end of Viola Wells MI
>>>
>>>
>>>
>>> //start with affine part
>>>
>>> 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()
>>> );
>>>
>>> double translationScale = 1.0 / 1000.0;
>>>
>>> unsigned int maxNumberOfIterations = atoi( arg7 );
>>>
>>>
>>>
>>> typedef OptimizerType::ScalesType OptimizerScalesType;
>>>
>>> OptimizerScalesType optimizerScales(
>>> transform->GetNumberOfParameters() );
>>>
>>>
>>>
>>> //rotation matrix factor
>>>
>>> optimizerScales[0] = 1.0;
>>>
>>> optimizerScales[1] = 1.0;
>>>
>>> //rotation center
>>>
>>> optimizerScales[2] = 1.0;
>>>
>>> optimizerScales[3] = 1.0;
>>>
>>> //components of the translation
>>>
>>> optimizerScales[4] = translationScale;
>>>
>>> optimizerScales[5] = translationScale;
>>>
>>> optimizer->SetScales( optimizerScales );
>>>
>>>
>>>
>>>
>>>
>>> optimizer->SetLearningRate( 15.0 );
>>>
>>> optimizer->SetNumberOfIterations( maxNumberOfIterations );
>>>
>>> optimizer->MaximizeOn();
>>>
>>>
>>>
>>> CommandIterationUpdate::Pointer observer =
>>> CommandIterationUpdate::New();
>>>
>>> optimizer->AddObserver( itk::IterationEvent(), observer );
>>>
>>> //end with affine part
>>>
>>>
>>
>>
>>
>> ----------------------------------------------------------------
>> Este mensaje ha sido enviado desde https://webmail.unav.es
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list