[Insight-users] Inverse BSplineDeformableTransform

Lars Nygard lnygard at yahoo.com
Tue Dec 18 10:44:14 EST 2007


Hi vincent,
Thanks for your mail. Im trying your first suggestion by using
the InverseDeformationFieldImageFilter and by studying example
DeformableRegistration6.cxx. However Im getting an error:

------------------------------------------------------------------------------------------------------
C:\Insight\myPrograms\MultiResolutionReg\liImageRegistrationConsoleBase.cxx:407:   instantiated from
 here
C:/Insight/myPrograms/MultiResolutionReg/itkInverseDeformationFieldImageFilter.h:105: error: `double
' is not a class, struct, or union type
-----------------------------------------------------------------------------------------------------

I think this has something to do with the fact that Im feeding the InverseFilter with a 
scalar image but Im not sure. 
My code is below. Do you know how to get the vector deformation
image from the BSplineTransform?? Thanks for any advice.
 
---------------------------------
  unsigned int counter = 0;

    for ( unsigned int k = 0; k < 3; k++ )
    {
    typedef BSplineTransformType::ImageType ParametersImageType;
    const typedef itk::ResampleImageFilter<ParametersImageType,ParametersImageType> ResamplerType;
    ResamplerType::Pointer inversesampler = ResamplerType::New();

    typedef itk::BSplineResampleImageFunction<ParametersImageType,double> FunctionType;
    FunctionType::Pointer function = FunctionType::New();

    typedef itk::IdentityTransform<double,3> IdentityTransformType;
    IdentityTransformType::Pointer identity = IdentityTransformType::New();


    typedef itk::InverseDeformationFieldImageFilter<ParametersImageType,ParametersImageType> InverseDeformationFieldFilterType;
    InverseDeformationFieldFilterType::Pointer inversedeformfilter = InverseDeformationFieldFilterType::New();

    
    inversesampler->SetInput( m_BSplineTransform->GetCoefficientImage()[k] );
    inversesampler->SetInterpolator( function );
    inversesampler->SetTransform( identity );
    inversesampler->SetSize( m_BSplineTransform->GetGridRegion().GetSize() );
    inversesampler->SetOutputSpacing( m_BSplineTransform->GetGridSpacing() );
    inversesampler->SetOutputOrigin( m_BSplineTransform->GetGridOrigin() );

    typedef itk::BSplineDecompositionImageFilter<ParametersImageType,ParametersImageType>
      DecompositionType;
    DecompositionType::Pointer decomposition = DecompositionType::New();

    decomposition->SetSplineOrder( 3 );
    decomposition->SetInput( inversesampler->GetOutput() );
    inversedeformfilter->SetInput(decomposition->GetOutput());
    inversedeformfilter->Update();

    ParametersImageType::Pointer newCoefficients = inversedeformfilter->GetOutput();

    // copy the coefficients into the parameter array
    typedef itk::ImageRegionIterator<ParametersImageType> Iterator;
    Iterator it( newCoefficients, m_InverseBSplineTransform->GetGridRegion() );
    while ( !it.IsAtEnd() )
      {
      parametersInverse[ counter++ ] = it.Get();
      ++it;
      }

    }
  
  m_InverseBSplineTransform->SetParameters( parametersInverse );

----- Original Message ----
From: Vincent A. Magnotta <vincent-magnotta at uiowa.edu>
To: Lars Nygard <lnygard at yahoo.com>
Cc: insight-users at itk.org
Sent: Tuesday, December 18, 2007 6:14:22 AM
Subject: Re: [Insight-users] Inverse BSplineDeformableTransform

Lars,

The GetInverse Method is not implemented for the BSpline transform.
There are two solutions for generating the inverse. The first is to get
the deformation field from the transform and then invert the
 deformation
field using the InverseDeformationFieldImageFilter. Another solution is
to generate a regular sampling of points in the fixed image space and
map these back to the moving image space using the BSpline transform.
These points can then be used to create a Thin plate spline transform
that is an approximation to the inverse of the BSpline transform.

Vince


On Sun, 2007-12-16 at 15:09 -0800, Lars Nygard wrote:
> hi everybody,
> 
> Im trying to get the inverse transformation of a BSpline
> transform to map points from the fixed atlas to an 
> image. Im trying the GetInverse metdod but this doesnt
> work. The point doesnt change. 
> Anybody can help me with this.
> thanks,
> lars
> 
> 
> 
>       _________________________________________________________
> Alt i ett. Få Yahoo! Mail med adressekartotek, kalender og
> notisblokk. http://no.mail.yahoo.com
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
-- 
Assistant Professor
Department of Radiology
0453-D JCP
200 Hawkins Drive
Iowa City, IA 52242
E-mail: vincent-magnotta at uiowa.edu
Phone: 319-356-8255
Fax: 319-353-6275
Website: http://www.radiology.uiowa.edu





      _________________________________________________________
Alt i ett. Få Yahoo! Mail med adressekartotek, kalender og
notisblokk. http://no.mail.yahoo.com


More information about the Insight-users mailing list