[Insight-users] Writing BSpline transform with itkTransformFileWriter
Albert Gubern
bertkrek at gmail.com
Thu Mar 11 05:14:44 EST 2010
Hi,
I am having troubles writing a BSpline transform produced by
DeformableRegistration15.cxx example. I have implemented a
bsplineRegistration method, based on that example, that returns the final
transform. From my main program, I apply the transform to the image and
observing the transformed image I can see that the transform has been
applied successfully. At the same time, I write the transform using the
itkTransformFileWriter but the parameters field of the produced file is
empty. Here is an example:
****************************************
#Insight Transform File V1.0
# Transform 0
Transform: BSplineDeformableTransform_double_3_3
Parameters:
FixedParameters: 11 11 11 -73 -17 -36.4286 73 17 36.4286 1 0 0 0 1 0 0 0 1
***************************************
And the code to write the transform is as follows:
****************************************
itk::TransformFileWriter::Pointer writerTransform;
writerTransform = itk::TransformFileWriter::New();
writerTransform->AddTransform(transform);
writerTransform->SetFileName(filename.c_str());
try{
writerTransform->Update();
}
catch( itk::ExceptionObject & excp )
{
std::cerr << "Exception thrown INPUT_OUTPUT TransformWriter" <<
std::endl;
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
**********************************
I have noticed of this problem when I have tried to read the transform file
and I got the following error:
*******************************************************
Loading Transform: .../Transforms/2_3.txt
terminate called after throwing an instance of 'itk::ExceptionObject'
what():
/usr/local/include/InsightToolkit/Common/itkBSplineDeformableTransform.txx:510:
itk::ERROR: BSplineDeformableTransform(0x100bb9bf0): Mismatched between
parameters size 0 and region size 1331
******************************************************
And the program produces the error when is executing the Update() of the
next lines:
**************************************************
typedef itk::TransformFileReader TransformReaderType;
TransformReaderType::Pointer transformReader = TransformReaderType::New();
std::cout << "Loading Transform: " << filename << std::endl;
transformReader->SetFileName( filename.c_str());
transformReader->Update();
**************************************************
Finally comment that same code has been tested with Affine transform and I
have not had problems reading, writing and using the Affine transform.
Any idea about what I am doing wrong?
Thanks in advance.
--
Albert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100311/4dd7660f/attachment.htm>
More information about the Insight-users
mailing list