[vtkusers] Regarding the Principal Component Analysis (vtkPCAAnalysisFilter)

Anestis Koutsoudis akoutsou at ipet.gr
Fri Jul 11 08:39:44 EDT 2008


Hi all,

I am new to vtk and I was hoping on some help with some questions I have 
regarding
the PCAAnalysisFilter. What I am trying to build is an executable that 
will take as a
parameter an OBJ 3D file and it will result the PCA eigenvalues and vectors.

Unfortunately, I am not sure about how to pass the point data from the 
vtkOBJReader
to the PCAAnalysisFilter. Here is the code in C++ I am working on but 
for some
reason I get no results as the during the runtime I get an error on the 
vtkProcrustesAlignmentFilter
which I cannot see what it is as the vtkOutputwindow pops up and 
disappears instantly.

vtkOBJReader *importer = vtkOBJReader::New();
   importer->SetFileName("atest.obj");
   importer->Update();

// convert polygonal mesh into triangle mesh
   vtkTriangleFilter *tri = vtkTriangleFilter::New();
   tri->SetInput(importer->GetOutput());
   tri->Update();

   vtkProcrustesAlignmentFilter *gls = vtkProcrustesAlignmentFilter::New();
   gls->GetLandmarkTransform()->SetModeToRigidBody();
   gls->SetNumberOfInputs(1);
   gls->SetInput(1,tri->GetOutput());
   gls->Update();

   vtkPCAAnalysisFilter *pca = vtkPCAAnalysisFilter::New();
   pca->SetNumberOfInputs(1);
   pca->SetInput(1,gls->GetOutput());
   pca->Update();  
   pca -> PrintSelf(cout, 0);
  
   cout << endl << "eigenvalues:";
   int inputs = pca->GetEvals()->GetNumberOfTuples();
   for (int i = 0; i < inputs; i++)
    cout << " " << pca->GetEvals()->GetValue(i);
  
   cout << endl;

So, how is it possible to get the error message on a cout command
and how am I supposed to feed the vertices to the procrustersalignmentfilter
and on the pcaanalysisfilter.

Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080711/fe3a190c/attachment.htm>


More information about the vtkusers mailing list