ITK/Examples/IO/TransformFileReader: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Add an example transform file.)
(Deprecated content that is moved to sphinx)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
A sample ITK Transform file that can be used to test this example is:
{{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="text">
#Insight Transform File V1.0
#Transform 0
Transform: Rigid2DTransform_float_2_2
Parameters: 0 0 0
FixedParameters: 0 0
</source>
 
This file was produced by the [[ITK/Examples/IO/TransformFileWriter]] example.
 
==TransformFileReader.cxx==
<source lang="cpp">
#include "itkTransformFileReader.h"
#include "itkTransformFactoryBase.h"
 
int main(int argc, char *argv[])
{
  std::string fileName;
  if(argc == 1) // No arguments were provided
  {
    fileName = "test.tfm";
  }
  else
  {
    fileName = argv[1];
  }
 
  // Register default transforms
  itk::TransformFactoryBase::RegisterDefaultTransforms();
 
  itk::TransformFileReader::Pointer reader = itk::TransformFileReader::New();
  reader->SetFileName(fileName);
  reader->Update();
 
  // Display the transform
  std::cout << *(reader->GetTransformList()->begin()) << std::endl;
 
  return EXIT_SUCCESS;
}
 
</source>
 
{{ITKCMakeLists|{{SUBPAGENAME}}}}

Latest revision as of 17:17, 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.