[Insight-users] how to write a transfrom into a file
Xabier Artaechevarria Artieda
xabiarta at unav.es
Wed Jan 17 03:38:26 EST 2007
Hi Yixun,
you can make use of the TransformFileWriter class in this way:
//Write the transform to a file
typedef itk::TransformFileWriter TransformWriterType;
TransformWriterType::Pointer transformWriter = TransformWriterType::New();
transformWriter->SetFileName( "Transform.txt" );
transformWriter->SetInput( finalTransform );
transformWriter->Update();
To read it:
typedef itk::TransformFileReader TransformReaderType;
TransformReaderType::Pointer transformReader = TransformReaderType::New();
transformReader->SetFileName( "Transform.txt" );
typedef itk::TransformFileReader::TransformListType * TransformListType;
TransformListType transforms = transformReader->GetTransformList();
try
{
transformReader->Update();
}
catch( itk::ExceptionObject & excp )
{
std::cerr << "Error reading transform: ";
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
std::cout << "Transform parameters: " <<
*transforms->begin())->GetParameters() << std::endl;
Good luck!
Xabi
--
Xabier Artaechevarria
Cancer Imaging Laboratory
Centre for Applied Medical Research
www.cima.es
Yixun Liu <yxliu at fudan.edu.cn> ha escrito:
> Hi,
>
> I want to write a transform e.g. ThinPlateSplineKernelTransform into
> a file and then read it into a transform. How to do it?
>
> Best,
>
> Yixun Liu
>
----------------------------------------------------------------
Este mensaje ha sido enviado desde https://webmail.unav.es
More information about the Insight-users
mailing list