[Insight-users] How Copy a Displacement Field Transform

Ali Ghayoor alii.ghayoor at gmail.com
Wed Nov 28 13:38:14 EST 2012


Hi All,

I am trying to copy a displacement field transform returned by a SyN
registration process at each iteration. I have used two ways for this
purpose. 

1)
* First I ask virtual image from metric:


typename VirtualImageType::ConstPointer virtualDomainImage =
inputMetric->GetVirtualImage();



* Then, I define my new transform having a zero displacement field.



typename DisplacementFieldTransformType::Pointer myTransform =
DisplacementFieldTransformType::New();


const typename DisplacementFieldType::PixelType zeroVector( 0.0 );

        

typename DisplacementFieldType::Pointer DisplacementField =
DisplacementFieldType::New();

DisplacementField->CopyInformation( virtualDomainImage );

DisplacementField->SetRegions( virtualDomainImage->GetBufferedRegion() );

DisplacementField->Allocate();

DisplacementField->FillBuffer( zeroVector );

      

typename DisplacementFieldType::Pointer InverseDisplacementField =
DisplacementFieldType::New();

InverseDisplacementField->CopyInformation( virtualDomainImage );

InverseDisplacementField->SetRegions(
virtualDomainImage->GetBufferedRegion() );

InverseDisplacementField->Allocate();

InverseDisplacementField->FillBuffer( zeroVector );

      

myTransform->SetDisplacementField( DisplacementField );

myTransform->SetInverseDisplacementField( InverseDisplacementField );



* After that I set the parameters of the new transform from the old one:



typename TransformBaseType::ParametersType paras(
inputTransform->GetParameters() );

typename TransformBaseType::ParametersType fixed_paras(
inputTransform->GetFixedParameters() );

myTransform->SetParameters( paras );

myTransform->SetFixedParameters( fixed_paras );



2)

* In the second way I use an ImageDuplicator to copy the DisplacementField:

typedef itk::ImageDuplicator<DisplacementFieldType>
DisplacementFieldDuplicatorType;

typename DisplacementFieldDuplicatorType::Pointer disDuplicator =
DisplacementFieldDuplicatorType::New();

disDuplicator->SetInputImage( inputTransform->GetDisplacementField() );

disDuplicator->Update();


typename DisplacementFieldDuplicatorType::Pointer disInverseDuplicator =
DisplacementFieldDuplicatorType::New();

disInverseDuplicator->SetInputImage(
inputTransform->GetInverseDisplacementField() );

disInverseDuplicator->Update();



myTransform->SetDisplacementField( disDuplicator->GetOutput() );

myTransform->SetInverseDisplacementField( disInverseDuplicator->GetOutput()
);



-----------



However, non of above two methods do not return meaningful results.

Does anybody know where I am wrong, and How can we copy a displacement field
transform properly?



Thanks,

Ali




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121128/9175f44d/attachment.htm>


More information about the Insight-users mailing list