[vtkusers] Landmark transform works on polydata, but not vtkPoints
David Doria
daviddoria at gmail.com
Fri Mar 27 12:22:48 EDT 2009
I have these points:
vtkSmartPointer<vtkPoints> SourcePoints =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> TargetPoints =
vtkSmartPointer<vtkPoints>::New();
// ... fill points ...
If I use them to make a landmark transform:
LandmarkTransform->SetSourceLandmarks(SourcePoints);
LandmarkTransform->SetTargetLandmarks(TargetPoints);
LandmarkTransform->SetModeToRigidBody();
and then transform a polydata with the landmark transform:
vtkSmartPointer<vtkTransformPolyDataFilter> TransFilter =
vtkSmartPointer<vtkTransformPolyDataFilter>::New();
TransFilter->SetInput(Model.CreatePolydata());
TransFilter->SetTransform(LandmarkTransform);
TransFilter->Update();
vtkPolyData* polydata = TransFilter->GetOutput();
Everything works as expected. However, if I try to transform the points
directly:
vtkSmartPointer<vtkPoints> TransformedModelPoints =
vtkSmartPointer<vtkPoints>::New();
LandmarkTransform->TransformPoints(SourcePoints,
TransformedModelPoints);
everything turns into nan, ie
double origpoint[3];
SourcePoints->GetPoint(i, origpoint);
the result is [nan, nan, nan]
I'm sure I'm just using the TransformPoints() function wrong - does anyone
know how to do it properly?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090327/c2d8192f/attachment.htm>
More information about the vtkusers
mailing list