[Insight-users] Question about BSplineDeformableTransform

wenjia wenjia at robots.ox.ac.uk
Tue Apr 29 10:57:35 EDT 2008


Hello, everyone,

I am using ITK to do some B-spline deformable registration work. I followed the 
examples given by ITK User's Guide and modified the code a bit. Now I have got a 
question about setting the B-spline coefficients.

It is said in the documentation there are two ways setting the coefficients, 
either by a vector parameter or an array of images. I choosed the second option,

transform->SetCoefficientImages( images );

Then I need to set initial parameters for the registration method, according to 
the examples,

registration->SetInitialTransformParameters( transform->GetParameters() );

However, transform->GetParameters() seems to return a NULL pointer.

The reason is that when transform->SetCoefficientImages( images ) is performed, 
m_InputParametersPointer is set NULL. What transform->GetParameters() returns is 
just (*m_InputParametersPointer).

Another question is that in this way, the Jacobian matrix is not allocated 
memory to. So we can not GetJacobian() either.

The SetCoefficientImage() function is attached. Thanks for your reading.

Cheers,
Wenjia


// Set the B-Spline coefficients using input images
template<class TScalarType, unsigned int NDimensions, unsigned int VSplineOrder>
void
BSplineDeformableTransform<TScalarType, NDimensions,VSplineOrder>
::SetCoefficientImage( ImagePointer images[] )
{
   if ( images[0] )
     {
     this->SetGridRegion( images[0]->GetBufferedRegion() );
     this->SetGridSpacing( images[0]->GetSpacing() );
     this->SetGridOrigin( images[0]->GetOrigin() );

     for( unsigned int j = 0; j < SpaceDimension; j++ )
       {
       m_CoefficientImage[j] = images[j];
       }

     // Clean up buffered parameters
     m_InternalParametersBuffer = ParametersType( 0 );
     m_InputParametersPointer  = NULL;

     }

}


More information about the Insight-users mailing list