[Insight-users] TransformWriter

Matt Gibb matt at mattgibb.com
Tue Apr 17 06:13:09 EDT 2012


Hello ITK!

I am upgrading to the new wonderful 4.1.0, from 3.20.x. I'm having a few
teething problems and wondered if you could push me in the right direction.

In 3.x, you can write transforms to a filename without an extension, but it
seems you can't in 4.x. Here's a program to reproduce the exception:

#include "itkRigid2DTransform.h"
#include "itkTransformFileWriter.h"

using namespace std;


int main(int, char *[])
{
  typedef itk::Rigid2DTransform< float > TransformType;
  TransformType::Pointer transform = TransformType::New();

  itk::TransformFileWriter::Pointer writer =
itk::TransformFileWriter::New();
  writer->SetInput(transform);
  writer->SetFileName("test.tfm");

  try
  {
    writer->Update();
  }
  catch (std::exception& e)
 {
   cerr << "caught command-line parsing error" << endl;
    std::cerr << e.what() << std::endl;
    exit(EXIT_FAILURE);
  }

  writer->SetFileName("test");

   try
   {
     writer->Update();
   }
   catch (std::exception& e)
  {
    cerr << "caught command-line parsing error" << endl;
     std::cerr << e.what() << std::endl;
     exit(EXIT_FAILURE);
   }


  return EXIT_SUCCESS;
}


The code fails in the second try block with the following message:

/path/to/your/ITK/Modules/IO/TransformBase/src/itkTransformFileWriter.cxx:111:
itk::ERROR: TransformFileWriter(0x10d6468e0): Can't Create IO object for
file test

I tried to debug the problem with lldb but to no avail.

Any pointers to dereference would be greatly appreciated.

Matt Gibb.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120417/2e5d3713/attachment.htm>


More information about the Insight-users mailing list