Write Transform From File#
Synopsis#
Write a transform from a file.
Results#
Note
Help Wanted Implementation of Results for sphinx examples containing this message. Reconfiguration of CMakeList.txt may be necessary. Write An Example <https://itk.org/ITKExamples/Documentation/Contribute/WriteANewExample.html>
Code#
C++#
#include "itkVersion.h"
#include "itkRigid2DTransform.h"
#include "itkTransformFileWriter.h"
int
main(int argc, char * argv[])
{
std::string fileName;
if (argc == 1) // No arguments were provided
{
fileName = "test.tfm";
}
else
{
fileName = argv[1];
}
using TransformType = itk::Rigid2DTransform<float>;
auto transform = TransformType::New();
#if (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 5) || ITK_VERSION_MAJOR > 4
itk::TransformFileWriterTemplate<float>::Pointer writer = itk::TransformFileWriterTemplate<float>::New();
#else
itk::TransformFileWriter::Pointer writer = itk::TransformFileWriter::New();
#endif
writer->SetInput(transform);
writer->SetFileName(fileName);
writer->Update();
return EXIT_SUCCESS;
}
Classes demonstrated#
-
template<typename TParametersValueType>
class TransformFileReaderTemplate : public itk::LightProcessObject TODO.
- ITK Sphinx Examples: