[vtkusers] some questions about cells, file formats, etc

nuno.jf nunofernandes7 at gmail.com
Fri Dec 30 16:46:30 EST 2011


David, thank you very much for your answer!

1) The file was converted from VRML to vtkpolydata in the following way:

                vtkVRMLImporter *imp=vtkVRMLImporter::New();
		imp->SetFileName(XXXX);
		imp->Update();
	
		vtkDataSet* pDataset;
		vtkActorCollection* actors = imp->GetRenderer()->GetActors();
		actors->InitTraversal();
		pDataset = actors->GetNextActor()->GetMapper()->GetInput();

		vtkPolyData *polyData = vtkPolyData::SafeDownCast ( pDataset );
		polyData->Update();

2) I applied one filter to remove noisy data from the point cloud
(http://vtk.1045678.n5.nabble.com/Find-closest-point-td4816065.html#a4823558).
Basically a set of points is selected to be removed, and the output point
cloud is "cleanned".

       //Select the points to remove
	vtkSelectionNode *selectionNode = vtkSelectionNode::New();
	selectionNode->SetFieldType(vtkSelectionNode::POINT);
	selectionNode->SetContentType(vtkSelectionNode::INDICES);
	selectionNode->SetSelectionList(ids);
	//selectionNode->GetProperties()->Set(vtkSelectionNode::CONTAINING_CELLS(),
1);

	vtkSelection *selection = vtkSelection::New();
	selection->AddNode(selectionNode);
 
	vtkExtractSelection *extractSelection = vtkExtractSelection::New();
 	extractSelection->SetInput(0, polydata);
	extractSelection->SetInput(1, selection);
	extractSelection->Update();
	
	// Select the points that weren't marked as noise 
	selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(), 1); 
	extractSelection->Update();
	// Isto dá um unstrucutred grid
	vtkUnstructuredGrid *notSelected = vtkUnstructuredGrid::New();
	notSelected->ShallowCopy(extractSelection->GetOutput());
	
	//Convert to vtkpolydata
	vtkDataSetSurfaceFilter *surfaceFilter = vtkDataSetSurfaceFilter::New();
	surfaceFilter->SetInput(notSelected);
	surfaceFilter->Update(); 
 
	vtkPolyData *polydata2 = surfaceFilter->GetOutput();
	polydata2 -> Update();

 In the end, the difference between the input and output files is visible. I
think I have some incoherence in the output file. 

*Input file*:
cells: 77268;
points:77268;
scalars: float, data range [0, 77267];
size: 2.4MB

*Output file*:
cells: 75142;
points:75142;
scalars: float, data range [2, 76996];  
size: 3.5MB 

Why do I have a bigger file in the end, and why does the data range vary
from 2 to 76996? 


--
View this message in context: http://vtk.1045678.n5.nabble.com/some-questions-about-cells-file-formats-etc-tp5089451p5111125.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list