[Insight-users] About TransformPoint

Steven ITK itklearner at gmail.com
Tue Sep 4 20:54:36 EDT 2007


Hi Alexandre,

Yes, you are right. Thank you. If use TransformMeshFilter, the codes are:

 typedef itk::Mesh<double, Dimension,
itk::DefaultStaticMeshTraits<double,Dimension,Dimension,double, double>>
MeshType;
 MeshType::Pointer movingMesh  = MeshType::New();
 MeshType::Pointer registeredMesh = MeshType::New();
 typedef itk::TransformMeshFilter<MeshType, MeshType, TransformType>
MeshTransformFilterType;
 MeshTransformFilterType::Pointer meshtransformfilter=
MeshTransformFilterType::New();
 movingMesh->SetPoints(movingPointContainer);
 meshtransformfilter->SetInput(movingMesh);
 meshtransformfilter->SetTransform(transform);
 try
 {
  meshtransformfilter->Update();
 }
 catch( itk::ExceptionObject & e )
 {
  DisplayITKError(e);
  return -1;
 }
 registeredMesh = meshtransformfilter->GetOutput();
//then write registeredMesh->GetPoints() into file

Now the problem is solved. Basically, the problem is caused by
DefaultStaticMeshTraits, which should be tailored to your own data type by
explicit declaration. Many thanks to all of you.

Regards,
Steven

On 9/5/07, Alexandre GOUAILLARD <hanfei at caltech.edu> wrote:
>
> Hi steven,
>
> As for the TransformMeshFilter, you have a lot of errors related to your
using a pointset instead of a Mesh.
> Typically, you should not be able to write this:
> typedef itk::TransformMeshFilter<PointSetType, PointSetType,
TransformType> TransformFilterType;
>
> You should write this instead
> typedef itk::TransformMeshFilter<MeshType, MeshType, TransformType>
TransformFilterType;
>
> You can mdify your code by creating a mesh, and using its SetPoints()
method to attach your instance of a Poinset.
>
> You might want to instanciate the meshtraits manually to avoid the
pointype problem.
>
> Alex.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070905/a417ac23/attachment.html


More information about the Insight-users mailing list