[vtkusers] ICP and Transforms

bryan cole bryan.cole at teraview.com
Thu Aug 12 13:15:22 EDT 2004


Sorry, I should have looked at your code more closely. Looks like
there's something wierd about the pipeline execution between the vtkICPT
and the vtkPlaneSources: the vtkPlaneSources are not getting executed
properly. If you force the vtkPlaneSources to Update() before vtkICPT,
things seems to work OK.

Bryan

On Thu, 2004-08-12 at 15:58, Sean Richards wrote:
> My problem is not that the transformation is not being applied, the problem is that the transformation is not being created. Even though I have added the planes as the source and target, the ICPTransform says that the inputs are null (due to the fact that they have no points). Do I actually have to create points from the surface of the planes in order to use vtkICPTransform? If this is the case, how would I create a point set from vtkPolyData?
> 
> Thanks!
> 
> Sean
> 
> > vtkICPTransform only calculates the optimal 
> > transform for mapping the 
> > source onto the target. It doesn't actually 
> > apply it to anything. 
> > Once you've hooked vtkICPTransform into your 
> > pipeline, you need to use 
> > vtkTransformFilter to actually apply it to a 
> > dataset (your source data 
> > usually). Since vtkICPTransform is a subclass 
> > of vtkTransform, you can 
> > set it as the transform for 
> > vtkTrnasformFilter. You don't need to call 
> > 'MakeTransform'. 
> > Attached is a demo (hit 'u' to iterate the 
> > source points towards their 
> > target). 
> > HTH 
> > Bryan 
> > On Thu, 2004-08-12 at 14:49, Sean Richards 
> > wrote: 
> > > Hello all! :) 
> > > 
> > > I am trying to use 
> > vtkIterativeClosestPointTransform, but seem to 
> > be having a hard time getting used to it. I 
> > started by trying to use regular planes to 
> > test the algorithm, but can't seem to get it 
> > to work. Below is the code and output I get 
> > when I execute the code. Any help would be 
> > very much appreciated. 
> > > 
> > > Thanks in advance! 
> > > 
> > > Sean 
> > > 
> > > ******************************************** 
> > > **** THE CODE **** 
> > > ******************************************** 
> > > 
> > > 	vtkPlaneSource *plane0 = 
> > vtkPlaneSource::New(); 
> > > 		plane0->SetResolution(25, 25); 
> > > 		plane0->SetOrigin(-1,-1,0); 
> > > 		plane0->SetPoint1(1,-1,0); 
> > > 		plane0->SetPoint2(-1,1,0); 
> > > 
> > > 	vtkPlaneSource *plane1 = 
> > vtkPlaneSource::New(); 
> > > 		plane1->SetResolution(25, 25); 
> > > 		plane1->SetOrigin(-1,-1,1); 
> > > 		plane1->SetPoint1(1,-1,1); 
> > > 		plane1->SetPoint2(-1,1,1); 
> > > 
> > > 	vtkIterativeClosestPointTransform *icp = 
> > vtkIterativeClosestPointTransform::New(); 
> > > 
> > > 		icp->SetCheckMeanDistance(1); 
> > > 		icp->SetMaximumMeanDistance(0.001); 
> > > 		icp->SetMaximumNumberOfIterations(30); 
> > > 		icp->SetMaximumNumberOfLandmarks(50); 
> > > 
> > > 		icp->SetSource((vtkDataSet 
> > *)plane0->GetOutput()); 
> > > 		icp->SetTarget((vtkDataSet 
> > *)plane1->GetOutput()); 
> > > 
> > > 		// debug output 
> > > 		cout << "Number of Source Points: " << 
> > icp->GetSource()->GetNumberOfPoints() << "\n"; 
> > > 		cout << "Number of Target Points: " << 
> > icp->GetTarget()->GetNumberOfPoints() << "\n"; 
> > > 
> > > 		icp->Modified(); 
> > > 		icp->Update(); 
> > > 
> > > 		cout << "\n\nOutput from 
> > icp->PrintSelf(cout, 0);\n\n"; 
> > > 		icp->PrintSelf(cout, 0); 
> > > 
> > > 		vtkAbstractTransform *transform = 
> > icp->MakeTransform(); 
> > > 		cout << "\n\nOutput from 
> > transform->Print(cout);\n\n"; 
> > > 		transform->Print(cout); 
> > > 
> > > ******************************************** 
> > > **** THE OUTPUT **** 
> > > ******************************************** 
> > > 
> > > ******** 
> > > This output is in the vtkOutputWindow 
> > > ******** 
> > > 
> > > ERROR: In 
> > 
> > 
> > \thesisroot\Vtk\Hybrid\vtkIterativeClosestPointTransform.cxx, line 271 
> > > vtkIterativeClosestPointTransform 
> > (00336E00): Can't execute with NULL or empty 
> > input 
> > > 
> > > ******** 
> > > This output is in the console window 
> > > ******** 
> > > 
> > > Number of Source Points: 0 
> > > Number of Target Points: 0 
> > > 
> > > 
> > > Output from icp->PrintSelf(cout, 0); 
> > > 
> > > Debug: Off 
> > > Modified Time: 50 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Inverse: (00000000) 
> > > Matrix: (00336F98) 
> > > Debug: Off 
> > > Modified Time: 41 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Elements: 
> > > 1 0 0 0 
> > > 0 1 0 0 
> > > 0 0 1 0 
> > > 0 0 0 1 
> > > Source: 00336238 
> > > Target: 00336998 
> > > Locator: (none) 
> > > MaximumNumberOfIterations: 30 
> > > CheckMeanDistance: 1 
> > > MeanDistanceMode: RMS 
> > > MaximumMeanDistance: 0.001 
> > > MaximumNumberOfLandmarks: 50 
> > > StartByMatchingCentroids: 0 
> > > NumberOfIterations: 0 
> > > MeanDistance: 0 
> > > LandmarkTransform: 
> > > Debug: Off 
> > > Modified Time: 42 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Inverse: (00000000) 
> > > Matrix: (00337208) 
> > > Debug: Off 
> > > Modified Time: 43 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Elements: 
> > > 1 0 0 0 
> > > 0 1 0 0 
> > > 0 0 1 0 
> > > 0 0 0 1 
> > > Mode: Similarity 
> > > SourceLandmarks: 00000000 
> > > TargetLandmarks: 00000000 
> > > 
> > > 
> > > Output from transform->Print(cout); 
> > > 
> > > vtkIterativeClosestPointTransform (00337568) 
> > > Debug: Off 
> > > Modified Time: 55 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Inverse: (00000000) 
> > > Matrix: (00337770) 
> > > Debug: Off 
> > > Modified Time: 54 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Elements: 
> > > 1 0 0 0 
> > > 0 1 0 0 
> > > 0 0 1 0 
> > > 0 0 0 1 
> > > Source: (none) 
> > > Target: (none) 
> > > Locator: (none) 
> > > MaximumNumberOfIterations: 50 
> > > CheckMeanDistance: 0 
> > > MeanDistanceMode: RMS 
> > > MaximumMeanDistance: 0.01 
> > > MaximumNumberOfLandmarks: 200 
> > > StartByMatchingCentroids: 0 
> > > NumberOfIterations: 0 
> > > MeanDistance: 0 
> > > LandmarkTransform: 
> > > Debug: Off 
> > > Modified Time: 55 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Inverse: (00000000) 
> > > Matrix: (003379E0) 
> > > Debug: Off 
> > > Modified Time: 56 
> > > Reference Count: 1 
> > > Registered Events: (none) 
> > > Elements: 
> > > 1 0 0 0 
> > > 0 1 0 0 
> > > 0 0 1 0 
> > > 0 0 0 1 
> > > Mode: Similarity 
> > > SourceLandmarks: 00000000 
> > > TargetLandmarks: 00000000 
> 
> ______________________________________________________________________
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-- 
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382




More information about the vtkusers mailing list