[vtkusers] Q: vtkPolyDataConnectivityFilter

Audrius Stundzia adv_biologic at hotmail.com
Fri Apr 20 13:00:35 EDT 2001


Hi vtker's,

Found no solution to this problem in the archives.

After extracting all the connected regions in a contoured plane using 
vtkPolyDataConnectivityFilter, I've been trying to look at them 
individually. The following line crashes after I try to retrieve the 2nd of 
several regions:

vtkPolyData *aContourTestPolyData;

aContourTestPolyData = aConnectivityFilter->GetOutput( iContourRegion);

where iContourRegion is just an integer counter.

Any insight on how I can do the above would be most appreciated.

Regards,

Audrius Stundzia

Here's the entire, simplified, code fragment:

---------------

//==============================================
//----- 1. vtkPolyDataConnectivityFilter Problem
//==============================================

      vtkPolyData *aContourTestPolyData;

      aConnectivityFilter = vtkPolyDataConnectivityFilter::New();
      aConnectivityFilter->SetInput( aContourMarchingSquares->GetOutput() );
      aConnectivityFilter->ScalarConnectivityOff();
      aConnectivityFilter->InitializeSpecifiedRegionList();
      aConnectivityFilter->SetExtractionModeToAllRegions();
      aConnectivityFilter->Update();

      int nContourRegions = 
aConnectivityFilter->GetNumberOfExtractedRegions();

      if (aDebug == ON)
      {
         cout << ": nContourRegions: " << nContourRegions << endl;
      }

      int iContourRegion = 0;

      do {

         if (aDebug == ON)
         {
            cout << "iContourRegion: " << iContourRegion << endl;
         }

         //----- CRASH in following line

         aContourTestPolyData = aConnectivityFilter->GetOutput( 
iContourRegion);

         //-----

         aContourTestPolyData->ComputeBounds();
         aContourTestPolyData->GetBounds( contourBounds);


         if (...) //----- Some test criteria
         {
            aConnectivityFilter->SetOutput( thalamicContourPolyData);
         }

         iContourRegion += 1;

      } while (iContourRegion < nContourRegions);





_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the vtkusers mailing list