[vtkusers] Connected Components

prabhat246 prabhat246 at yahoo.com
Mon Nov 24 09:13:55 EST 2008


Hi, 

I have a object containing large no. of multiple connected components(say
10,000). I want to be able to transform each component seperately.  I am
doing it in following way.

for(int i = 0; i< NoOfRegions; i++)
	{
	vtkPolyDataConnectivityFilter * con = vtkPolyDataConnectivityFilter::New();
	con->SetInput(mc->GetOutput());
	con->SetExtractionModeToSpecifiedRegions();
	con->AddSpecifiedRegion(i);
	connect->Update();

	vtkPolyDataMapper *polymap;
	vtkActor * polyact;
	
	//std::cout<<connect->GetOutput()->GetNumberOfCells()<<std::endl;
		
	polymap = vtkPolyDataMapper::New();
	polymap->SetInput(con->GetOutput());
	polyact = vtkActor::New();
	polyact->SetMapper(polymap);
	renderer->AddActor(polyact);
	
	vtkBoxWidget *boxWidget = vtkBoxWidget::New();
	boxWidget->SetInteractor(iren);
	boxWidget->SetPlaceFactor(1);
	boxWidget->SetProp3D(polyact);
	boxWidget->PlaceWidget();
	boxWidget->SetOutlineFaceWires(1);
	boxWidget->SetScalingEnabled(0);
	boxWidget->SetRotationEnabled(1);
	boxWidget->OutlineFaceWiresOff();
	boxWidget->OutlineCursorWiresOff();
	boxWidget->HandlesOff();
	boxWidget->On();

	vtkMyCallback *callback = vtkMyCallback::New();
	boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
	}


But It runs successfully if I have less no. of components say 10 but it
crashes on large no of componenets.. I feel that It is due to memory crash.
Of course all these objects inside loop are not being deleted. 

is there anything that can be avoided to save memory?? or Is there any other
lighter way to do this???
Please help me out.

Thanks a lot
Prabhat Kumar Gupta

-- 
View this message in context: http://www.nabble.com/Connected-Components-tp20661092p20661092.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list