[Insight-users] About TransformPoint

Luis Ibanez luis.ibanez at kitware.com
Mon Sep 3 09:40:24 EDT 2007


Hi Steven,

1) You didn't posted the full error message to the list.

    Apparently you cut the part where the compiler tell us what
    [TScalarType] you used when instantiating the Transform.

2) Most likely you are using a transform instantiated for "double",
    and trying to use it for transforming points whose components
    are "float".


If that is the case you have two options:


A) Declare the PointSet using "double" at a cost in memory
    storage. this may be fine if you are not managing thousands
    or millions of points.

B) Declare the Transform to use "float" as its ScalarType.


Option (A) is better if you care about the precision of the
computations more than the memory allocation.


    Regards,


        Luis


---------------------
Steven ITK wrote:
> Hi, ITK Users,
>  
> I have a compiling error when using TransformPoint:
>  
> Error 1 error C2664: 
> 'itk::MatrixOffsetTransformBase<TScalarType,NInputDimensions,NOutputDimensions>::TransformPoint' 
> : *cannot convert* parameter 1 from *'PointType' to 'const 
> itk::Point<TCoordRep,NPointDimension> &' . *
>  
> What I am trying to do is testing the example of Iterative Closest Point 
> Registration method (PointSetToPointSetRegistrationMethod). The 
> registration is working, but I had the problem to transform the moving 
> pointset to registered pointset using the transformation matrix obtained 
> from the reigstration.
>  
> Here is my code:
> //type define
>  typedef itk::PointSet< float, Dimension >   PointSetType;
>  PointSetType::Pointer fixedPointSet  = PointSetType::New();
>  PointSetType::Pointer movingPointSet = PointSetType::New();
>  PointSetType::Pointer registeredPointSet = PointSetType::New();
>  typedef PointSetType::PointType     PointType;
>  PointType fixedPoint;
>  PointType movingPoint;
>  PointType registeredPoint;
>  typedef PointSetType::PointsContainer  PointsContainer;
>  PointsContainer::Pointer fixedPointContainer  = PointsContainer::New();
>  PointsContainer::Pointer movingPointContainer = PointsContainer::New();
>  PointsContainer::Pointer registeredPointContainer = PointsContainer::New();
> 
> //Read in moving pointset and fixed pointset
> 
> //do the registration
> 
> got the transformation stored in *'transform'*
> 
> // transform moving pointset 
> 
>  for(i = 0; i<movingPointSet->GetNumberOfPoints(); i++)
>  {
>   movingPointSet->GetPoint( i, &movingPoint );
>   *registeredPoint =   transform->TransformPoint( movingPoint 
> );//error here*
>   registeredPointContainer->InsertElement( i, registeredPoint );
>  }
>  registeredPointSet->SetPoints(registeredPointContainer);
> 
> ==============================================================
> I also tried this, got the similar error:
>  typedef itk::TransformMeshFilter<PointSetType, PointSetType, 
> TransformType> TransformFilterType;
>  TransformFilterType::Pointer transformfilter= TransformFilterType::New();
>  transformfilter->SetInput(movingPointSet);
>  transformfilter->SetTransform(transform);
>  try
>  {
>   transformfilter->Update();
>  }
>  catch( itk::ExceptionObject & e )
>  {
>   DisplayITKError(e);
>   return -1;
>  }
>  registeredPointSet = transformfilter->GetOutput();
>  
> ===============================================================
>  
> Can you help me out of this? Thank you.
>  
> Steven
> 
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list