[vtkusers] ICP and Transforms

Sean Richards sean at millwood.ca
Thu Aug 12 09:49:10 EDT 2004


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


More information about the vtkusers mailing list