<commit_before>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkTransformFileReaderWriterTest.cxx
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include "itkTransformFileReader.h"
#include "itkTransformFileWriter.h"
#include "itkTransformIOFactory.h"
#include "itkAffineTransform.h"
#include "itkTransformFactory.h"
#include "itkScaleVersor3DTransform.h"
#include "itkBSplineDeformableTransform.h"

int itkTransformFileReaderWriterTest( int argc, char *argv[] )
{
  itk::TransformFactory<itk::ScaleVersor3DTransform<float> >::RegisterTransform ();
  itk::TransformFactory<itk::AffineTransform<double> >::RegisterTransform ();
  itk::TransformFactory<itk::BSplineDeformableTransform<double> >::RegisterTransform ();
  if( argc < 3 )
    {
    std::cerr << "Missing Parameters " << std::endl;
    std::cerr << "Usage: " << argv[0];
    std::cerr << " inputTransformFile ";
    std::cerr << " outputTransformFile ";
    std::cerr << std::endl;
    return EXIT_FAILURE;
    }
  
  itk::TransformIOBase::Pointer transformIO =
    itk::TransformIOFactory::CreateTransformIO(argv[1],itk::TransformIOFactory::ReadMode);
  transformIO->Print(std::cout,0);
  transformIO = itk::TransformIOFactory::CreateTransformIO(argv[1],itk::TransformIOFactory::WriteMode);
  transformIO->Print(std::cout,0);

  typedef itk::TransformFileReader        TransformReaderType;<commit_msg>BUG: Fixed problem with default transformations not being registered by explicitly calling RegisterDefaultTransforms.  There appears to be a logical flaw in the system for registering transforms where the defaults are only registered if no other transform is registered.  While this seems to be a bug, changing it would break backwards compatibility, so it is left as is.<commit_after>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkTransformFileReaderWriterTest.cxx
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include "itkTransformFileReader.h"
#include "itkTransformFileWriter.h"
#include "itkTransformIOFactory.h"
#include "itkAffineTransform.h"
#include "itkTransformFactory.h"
#include "itkScaleVersor3DTransform.h"
#include "itkBSplineDeformableTransform.h"

int itkTransformFileReaderWriterTest( int argc, char *argv[] )
{
  itk::TransformFactory<itk::ScaleVersor3DTransform<float> >::RegisterDefaultTransforms();
  itk::TransformFactory<itk::ScaleVersor3DTransform<float> >::RegisterTransform ();
  if( argc < 3 )
    {
    std::cerr << "Missing Parameters " << std::endl;
    std::cerr << "Usage: " << argv[0];
    std::cerr << " inputTransformFile ";
    std::cerr << " outputTransformFile ";
    std::cerr << std::endl;
    return EXIT_FAILURE;
    }
  
  itk::TransformIOBase::Pointer transformIO =
    itk::TransformIOFactory::CreateTransformIO(argv[1],itk::TransformIOFactory::ReadMode);
  transformIO->Print(std::cout,0);
  transformIO = itk::TransformIOFactory::CreateTransformIO(argv[1],itk::TransformIOFactory::WriteMode);
  transformIO->Print(std::cout,0);

  typedef itk::TransformFileReader        TransformReaderType;
{'fraction_non_alphanumeric': 0.17209631728045327, 'fraction_numerical': 0.005901794145420208, 'mean_word_length': 5.746815286624204, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3629119', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1153, 'n_words': 287}