ITK/Examples/IO/TransformFileWriter: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(ITK transform API changed in 4.5)
(Deprecated content that is moved to sphinx)
 
Line 1: Line 1:
==TransformFileWriter.cxx==
{{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/*  pages likely require ITK version 4.13 or earlier releases.   In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.
<source lang="cpp">
}}
#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];
  }
 
  typedef itk::Rigid2DTransform< float > TransformType;
  TransformType::Pointer 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;
}
</source>
 
{{ITKCMakeLists|{{SUBPAGENAME}}}}

Latest revision as of 17:09, 4 June 2019

Warning: The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.