[vtkusers] vtkpcaanalysisfilter giving points of nans
gregthom
gregthom99 at yahoo.com
Mon Dec 7 10:01:13 EST 2009
Greetings
I am working on pca analysis filter and have built everything to
specifications.
However when I write out a result from the pca analysisfilter I get all
polydata with all nans for the points
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 544 float
nan nan nan nan nan nan nan nan nan
nan nan nan nan nan nan nan nan nan
nan nan nan nan nan nan nan nan nan
nan nan nan nan nan nan nan nan nan
nan nan nan nan nan nan nan nan nan
My Code looks like:
meshSnew = pcaanalysisfilter(meshS1,meshS2,meshS3,meshS4,[-3 0.0 0.0 0]);
where
for (unsigned int j = 0;j<nrhs-1;j++)
{
MeshType::Pointer mymesh0 = meshSstructToItkMesh(prhs[j]);
vtkPolyData* polydatainput = ITKMeshToVtkPolyData(mymesh0);
PCA->SetInput(j,polydatainput);
}
// update pca analysis filter
PCA->Update();
// debug
vtkIndent indent ;
ofstream ofile("pcaanalysislog.txt");
PCA -> PrintSelf(ofile,indent);
vtkFloatArray *params = vtkFloatArray::New();
params -> SetNumberOfComponents(1); // 1 per tuple
params -> SetNumberOfTuples(numparams); // 1 instance
// float val[1]; val[0] = variance_fact; params -> SetTuple(0, val);
for (unsigned int i = 0; i < numparams; i++)
{
params -> SetTuple1(i, paramsptr[i]);
double * res = params->GetTuple(i);
mexPrintf(">> params = %f\n", res[0] );
}
vtkPolyData *meshtmp = vtkPolyData::New();
MeshType::Pointer mymesh0 = meshSstructToItkMesh(prhs[0]);
meshtmp = ITKMeshToVtkPolyData(mymesh0);
PCA -> GetParameterisedShape(params, meshtmp);
vtkPolyDataWriter* pwriter = vtkPolyDataWriter::New();
pwriter->SetInput(meshtmp);
pwriter->SetFileName( "shapemode.vtk" );
pwriter->Update();
meshtmp->Delete();
pwriter->Delete();
PCA->Delete();
--
View this message in context: http://old.nabble.com/vtkpcaanalysisfilter-giving-points-of-nans-tp26678397p26678397.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list