[vtkusers] about vtkPCAAnalysisFilter in vtk 6.1.0
Bill Lorensen
bill.lorensen at gmail.com
Tue Apr 15 10:03:54 EDT 2014
What errors do you get when you try this with vtk6?
On Tue, Apr 15, 2014 at 5:08 AM, Waldo Valenzuela
<waldo.valenzuela at hotmail.com> wrote:
> Hey Guys,
>
> I am migrating my code from vtk 5.1.0 to vtk 6.1.0 and I have my first problem. I am doing statistical shape modelling using vtkPCAAnalysisFilter, but I don’t know how configure in vtk 6 this filter. Here I have a example how I was using before.
>
> // ===============================================================
> shapeVariations variable is a vector with vtkpolydata, different meshes already aligned.
> // do PCA
> vtkSmartPointer<vtkPCAAnalysisFilter> pca;
> pca = vtkSmartPointer<vtkPCAAnalysisFilter>::New();
>
> pca->SetNumberOfInputs( numberOfShapeVariations );
>
> for (int i = 0; i < numberOfShapeVariations; i++){
> pca->SetInput(i, shapeVariations[i]);
> }
>
> std::cout<<"Start PCA"<<std::endl;
> pca->Update();
> std::cout<<"Finished PCA"<<std::endl;
>
>
> numberOfModes = shapeVariations.size();
>
> //setEigenValues
>
> eigenValues.clear();
>
> vtkSmartPointer<vtkFloatArray> evals = vtkSmartPointer<vtkFloatArray>::New();
> evals = pca->GetEvals();
>
> // reading eigen values
> for(int i = 0; i < evals->GetNumberOfTuples(); i++)
> {
> float value = evals->GetTuple1(i);
> }
>
>
> //reading EigenVectors
>
>
> for (int i = 0; i < numberOfModes; i++){
> vtkPointSet* evecs = pca->GetOutput(i);
> }
> // ===============================================================
> Someone know some example of this filter for vtk 6.1.0?
>
> I will really appreciate any help on this subject.
>
> Best regards,
>
> Waldo
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtkusers
mailing list