[Insight-users] TransformFileReader

Vincent Garcia vincent.garcia at inria.fr
Mon May 23 09:45:26 EDT 2011


Hi Luis,

I already got the exact same answers from Norman K Williams last week.
The dynamic_cast works fine for me.
Thanks for your help, and have a nice day!

Vincent Garcia



----- Original Message -----
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "Vincent Garcia" <vincent.garcia at inria.fr>
> Cc: insight-users at itk.org
> Sent: Saturday, 21 May, 2011 9:59:52 PM
> Subject: Re: [Insight-users] TransformFileReader
> Hi Vincent,
> 
> 1) The Transform files are in plain text.
> 
> If you look at them with a text editor you will find
> the name and type of the transform.
> 
> For example, the file:
> 
> ITK/Testing/Data/Input/itkAffineTransform00.txt
> 
> contains:
> 
> #Insight Transform File V1.0
> # Transform 0
> Transform: AffineTransform_double_3_3
> Parameters: 1 0 0 0 1 0 0 0 1 0 0 0
> FixedParameters: 0 0 0
> 
> 
> 
> 2) If you question is about how to figure out
> at run time, what is the type that the reader
> created, then, you could answer that by using
> dynamic_cast<> as in:
> 
> BaseTransformType::Pointer transform = list->front();
> 
> typedef itk::Affine<float,3> FloatAffineType;
> typedef itk::Affine<double,3> DoubleAffineType;
> 
> FloatAffineType * floatAffine =
> dynamic_cast< FloatAffineType * >( transform );
> 
> if( floatAffine != NULL )
> {
> std::cout << "It is float type..." << std::endl;
> }
> 
> DoubleAffineType * doubleAffine =
> dynamic_cast< DoubleAffineType * >( transform );
> 
> if( doubleAffine != NULL )
> {
> std::cout << "It is double type..." << std::endl;
> }
> 
> 
> 
> 
> Luis
> 
> 
> --------------------------------------------------------
> On Thu, May 12, 2011 at 7:55 AM, Vincent Garcia
> <vincent.garcia at inria.fr> wrote:
> > Hi,
> >
> > I'm trying to read a transformation from a file and I have a little
> > probleme.
> > I use the object itk::TransformFileReader to read the file and I get
> > the
> > transformation as follow:
> >
> > typedef itk::TransformFileReader TransformReaderType;
> > typedef TransformReaderType::TransformListType TransformListType;
> > typedef TransformReaderType::TransformType BaseTransformType;
> >
> > TransformListType * list = reader->GetTransformList();
> > BaseTransformType::Pointer transform = list->front();
> >
> > Using transform->GetNameOfClass(), I know what is the transformation
> > class
> > corresponds to the transfom object.
> > In my case, it's a AffineTransform. However, how do I know if this
> > transform
> > is coded on float or on double?
> >
> > Thanks,
> >
> > Vincent Garcia
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >


More information about the Insight-users mailing list