[vtkusers] question about vtkPolyDataConnectivityFilter

Mike Jackson imikejackson at gmail.com
Sat Apr 5 08:21:13 EDT 2008


You also want to add:

polyDataFilter->SetExtractionModeToAllRegions();

After you run the filter the first time then you will run it in a  
loop, each time through the loop you set:
for (int i = 0; i < numRegions; ++i)
{
polyDataFilter->InitializeSpecifiedRegionList ()
polyDataFilter->AddSpecifiedRegion (i);
polyDataFilter->SetInput(contourFilter->GetOutput());
polyDataFilter->SetScalarRange(255.0, 255.0);
polyDataFilter->Update();
vtkPolyData* polyData = polYDataFilter->getOUtput();
}

That is only one way and it has been a while since I have had to do  
something like this. There may be newer/faster ways.

The way we solved it was to re-write the  
vtkPolYDataConnectivityFilter to actually extract all the regions and  
store them in a vtkPolyDataCollection. This proved the fastest for us.

Our code can be found here:
http://titanium.imts.us/viewvc/Task_4/Mesher/ 
DNAPolyDataConnectivityFilter.cpp?view=log
http://titanium.imts.us/viewvc/Task_4/Mesher/ 
DNAPolyDataConnectivityFilter.h?view=log

They may need to be updated for vtk 5.x but you are welcome to use  
the code.

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Apr 5, 2008, at 7:27 AM, Anja Ende wrote:
> Hi everyone,
>
> I am using vtkPolyDataConnectivityFilter as follows:
>
> vtkContourFilter * contourFilter = vtkContourFilter::New();
> contourFilter->SetInput(vtkDicomReader->GetOutput());
> contourFilter->SetValue(0, 255);
> 	
> vtkPolyDataConnectivityFilter * polyDataFilter =
> vtkPolyDataConnectivityFilter::New();
> polyDataFilter->SetInput(contourFilter->GetOutput());
> polyDataFilter->SetScalarRange(255.0, 255.0);
> polyDataFilter->Update();
> 	
> int regions = polyDataFilter->GetNumberOfExtractedRegions();
>
> Now what I want to do is iterate through all the regions and each of
> the points in the region. However, I cannot figure out how to do this.
> Anyone has any idea on how I can iterate through the regions and the
> points?
>
> Cheers,
>
> Anja
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list