[vtkusers] about vtkPCAAnalysisFilter in vtk 6.1.0
Waldo Valenzuela
waldo.valenzuela at hotmail.com
Tue Apr 15 05:08:04 EDT 2014
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
More information about the vtkusers
mailing list