[Insight-users] Question about BSplineDeformableTransform

Luis Ibanez luis.ibanez at kitware.com
Thu May 1 08:43:36 EDT 2008


Hi Wenjia,

Thanks for letting us know that you found the solution to the problem.


   Regards,


      Luis


-------------
wenjia wrote:
> Hi Luis,
> 
> Thanks a lot for your email.
> 
> Yes, what you said is just what I have done :) I copy the image array to 
> a long parameter vector. Then I use the SetParameters() method. It works 
> fine now.
> 
> Best wishes,
> Wenjia
> 
> Luis Ibanez wrote:
> 
>>
>> Hi Wenjia,
>>
>> As you have already pointed out, unfortunately the use of the 
>> SetCoefficientImage() method is not a suitable mechanism for
>> initializing the BSplineDeformableTransform when you plan to
>> use it in the Image Registration framework.
>>
>> Probably your best option is to use image iterators in order
>> to visit each one of the coefficient images and copy their values
>> in the parameters array, then set that array by using the
>> SetParametes() method.
>>
>>
>>    Regards,
>>
>>
>>       Luis
>>
>>
>> ---------------
>> wenjia wrote:
>>
>>> 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;
>>>
>>>     }
>>>
>>> }
>>> _______________________________________________
>>> 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