[vtkusers] vtkIterativeClosestPointTransform - Can't execute with NULL or empty input
P B
chose29 at hotmail.com
Wed Jul 23 09:40:18 EDT 2008
Hi,
I have a problem using vtkIterativeClosestPointTransform, if anyone could help that would be great! I have searched on the old vtk questions and found someone with a similar problem, but nothing is working to solve it for me. Here is the error I get when executing:
ERROR: In ..\..\..\Installations\VTK\VTK5\Hybrid\vtkIterativeClosestPointTransform.cxx, line271
vtkIterativeClosestPointTransform[12ABE78]: Can't execute with NULL or empty input
and here is the code I use:
vtkPolyData * CTPolyData = NULL;
vtkPolyData * MRPolyData = NULL;
CTPolyData = vtkPolyData::New();
CTPolyData->SetPoints(CTPoints);
MRPolyData = vtkPolyData::New();
MRPolyData->SetPoints(MRPoints);
vtkIterativeClosestPointTransform * ICPTransfo = vtkIterativeClosestPointTransform::New();
vtkDataSet *source = NULL, *target = NULL;
ICPTransfo->GetLandmarkTransform()->SetModeToRigidBody();//SetModeToAffine();
ICPTransfo->StartByMatchingCentroidsOff();
ICPTransfo->SetMaximumMeanDistance(MaximumMeanDistance);
ICPTransfo->SetMaximumNumberOfIterations(MaxNumberOfIterations);
vtkMaskPoints *maskPoints1 = vtkMaskPoints::New(); maskPoints1->SetInput(CTPolyData);
vtkMaskPoints *maskPoints2 = vtkMaskPoints::New(); maskPoints2->SetInput(MRPolyData);
maskPoints1->SetMaximumNumberOfPoints(1000);
maskPoints1->GenerateVerticesOn();
maskPoints1->SetMaximumNumberOfPoints(1000);
maskPoints1->GenerateVerticesOn();
ICPTransfo->SetSource(maskPoints1);
ICPTransfo->SetTarget(maskPoints2);
/*ICPTransfo->SetSource((vtkPolyData*)maskPoints1);
ICPTransfo->SetTarget((vtkPolyData*)maskPoints2);*/
ICPTransfo->SetSource(maskPoints1->GetOutput());
ICPTransfo->SetTarget(maskPoints2->GetOutput());
ICPTransfo->SetMeanDistanceModeToAbsoluteValue();
// execution of ICP algorithm
ICPTransfo->Modified();
ICPTransfo->Update();
double MeanDistance = ICPTransfo->GetMeanDistance();
Thank you for your help!!
_________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080723/edf6a5ec/attachment.htm>
More information about the vtkusers
mailing list