[vtkusers] Re: PCA in VTK

matthias specht specht at ifi.unizh.ch
Mon Aug 23 03:27:10 EDT 2004


hi joshi,
below a piece of java code I wrote a while ago. it computes PCA on a set 
of registered landmarks.
hope it helps. doesn't look like the most elegant piece of code - but it 
might be a starting point...

hint: go to the kitwar site, vtk mnual, alphabetical class index, search 
for "PCA" :)

matthias

       ...
       vtkUnstructuredGrid[] lmSet = new vtkUnstructuredGrid[nSamples];
       vtkProcrustesAlignmentFilter gls = new 
vtkProcrustesAlignmentFilter();
       // we want rigid body - don't we?
       gls.GetLandmarkTransform().SetModeToRigidBody();
       gls.SetNumberOfInputs(nSamples);
       vtkPCAAnalysisFilter pca = new vtkPCAAnalysisFilter();
       pca.SetNumberOfInputs(nSamples);

       for(int i=0; i<nSamples; i++) {    
           pr.openFile(probeFiles[i]);
           vtkPoints lm = pr.getLandmarks();
           lmSet[i] = new vtkUnstructuredGrid();
           lmSet[i].SetPoints(lm);
           gls.SetInput(i, lmSet[i]);
           pca.SetInput(i, gls.GetOutput(i));
       }
       ...

>Message: 1
>Date: Fri, 20 Aug 2004 12:24:25 -0500
>From: "Pallavi Joshi" <pallavi.joshi at vanderbilt.edu>
>Subject: [vtkusers] PCA in VTK
>To: <vtkusers at vtk.org>
>Message-ID: <000c01c486da$8ae2ac00$da593b81 at Pallavi>
>Content-Type: text/plain; charset="gb2312"
>
>Hi All,
>Does VTK have any functions that carry PCA ? I want to apply PCA to the mesh points.
>Any help wud be greatly appreciated.........
>
>Thanks,
>Palllavi
>
>  
>




More information about the vtkusers mailing list