[Insight-users] Affine registration and Viola-Wells MI

Xabier Artaechevarria Artieda xabiarta at unav.es
Wed Jun 6 09:59:48 EDT 2007


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



More information about the Insight-users mailing list