[vtkusers] vtkPCAAnalysis Filter in Debug mode VC++

sha1 at doc.ic.ac.uk sha1 at doc.ic.ac.uk
Mon Feb 20 05:38:44 EST 2006


Dear friends,
   I am using VC++ .Net , Win 2k to compile the following bit of code using a
combination of vxl and vtk. The vxl is being used just to read file path from
the directory. Now , this code runs perfectly fine in release mode. However , it
gives me a run time error in debug mode. My vtk version is 4.4. 

Thanks in advance for help,

Hassan Amin


void Cal_PCA2(vcl_vector<vcl_string> fp)
{
	int no_inputs=fp.size();
	readers=new vtkPolyDataReader* [no_inputs];
	for (int i=0;i<no_inputs;i++)
	{
		readers[i]=vtkPolyDataReader::New();
		readers[i]->SetFileName((char *)fp[i].c_str());
		readers[i]->Update();
	}

	pca=vtkPCAAnalysisFilter::New();
	pca->SetNumberOfInputs(no_inputs);

	for (int i=0; i<no_inputs;i++)
	{
		
		pca->SetInput(i,readers[i]->GetOutput());
	}

	pca->Update(); 
    no_inputs=pca->GetEvals()->GetNumberOfTuples();

	for (int i=0; i<no_inputs; i++)
		cout<<pca->GetEvals()->GetValue(i)<<",";
	cout<<endl;
	cout << " Get no. of modes = " <<pca->GetModesRequiredFor(0.99)<<endl;
	for (int i=0;i<no_inputs;i++)
	{
		readers[i]->Delete();
	}
}



More information about the vtkusers mailing list