Graphics/vtkPolyDataConnectivityFilter.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Graphics/vtkPolyDataConnectivityFilter.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkPolyDataConnectivityFilter.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00062 #ifndef __vtkPolyDataConnectivityFilter_h
    00063 #define __vtkPolyDataConnectivityFilter_h
    00064
    00065 #include "vtkPolyDataToPolyDataFilter.h"
    00066
    00067 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
    00068 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
    00069 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
    00070 #define VTK_EXTRACT_LARGEST_REGION 4
    00071 #define VTK_EXTRACT_ALL_REGIONS 5
    00072 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
    00073
    00074 class vtkDataArray;
    00075 class vtkIdList;
    00076 class vtkIdTypeArray;
    00077
    00078 class VTK_GRAPHICS_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataToPolyDataFilter
    00079 {
    00080 public:
    00081   vtkTypeRevisionMacro(vtkPolyDataConnectivityFilter,vtkPolyDataToPolyDataFilter);
    00082   void PrintSelf(ostream& os, vtkIndent indent);
    00083
    00085   static vtkPolyDataConnectivityFilter *New();
    00086
    00088
    00091   vtkSetMacro(ScalarConnectivity,int);
    00092   vtkGetMacro(ScalarConnectivity,int);
    00093   vtkBooleanMacro(ScalarConnectivity,int);
    00095
    00097
    00099   vtkSetVectorMacro(ScalarRange,float,2);
    00100   vtkGetVectorMacro(ScalarRange,float,2);
    00102
    00104
    00105   vtkSetClampMacro(ExtractionMode,int,
    00106                    VTK_EXTRACT_POINT_SEEDED_REGIONS,
    00107                    VTK_EXTRACT_CLOSEST_POINT_REGION);
    00108   vtkGetMacro(ExtractionMode,int);
    00109   void SetExtractionModeToPointSeededRegions()
    00110     {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
    00111   void SetExtractionModeToCellSeededRegions()
    00112     {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
    00113   void SetExtractionModeToLargestRegion()
    00114     {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
    00115   void SetExtractionModeToSpecifiedRegions()
    00116     {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
    00117   void SetExtractionModeToClosestPointRegion()
    00118     {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
    00119   void SetExtractionModeToAllRegions()
    00120     {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
    00121   const char *GetExtractionModeAsString();
    00123
    00125   void InitializeSeedList();
    00126
    00128   void AddSeed(int id);
    00129
    00131   void DeleteSeed(int id);
    00132
    00134   void InitializeSpecifiedRegionList();
    00135
    00137   void AddSpecifiedRegion(int id);
    00138
    00140   void DeleteSpecifiedRegion(int id);
    00141
    00143
    00145   vtkSetVector3Macro(ClosestPoint,float);
    00146   vtkGetVectorMacro(ClosestPoint,float,3);
    00148
    00150   int GetNumberOfExtractedRegions();
    00151
    00153
    00154   vtkSetMacro(ColorRegions,int);
    00155   vtkGetMacro(ColorRegions,int);
    00156   vtkBooleanMacro(ColorRegions,int);
    00158
    00159 protected:
    00160   vtkPolyDataConnectivityFilter();
    00161   ~vtkPolyDataConnectivityFilter();
    00162
    00163   // Usual data generation method
    00164   void Execute();
    00165
    00166   int ColorRegions; //boolean turns on/off scalar gen for separate regions
    00167   int ExtractionMode; //how to extract regions
    00168   vtkIdList *Seeds; //id's of points or cells used to seed regions
    00169   vtkIdList *SpecifiedRegionIds; //regions specified for extraction
    00170   vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
    00171
    00172   float ClosestPoint[3];
    00173
    00174   int ScalarConnectivity;
    00175   float ScalarRange[2];
    00176
    00177   void TraverseAndMark();
    00178
    00179 private:
    00180   // used to support algorithm execution
    00181   vtkDataArray *CellScalars;
    00182   vtkIdList *NeighborCellPointIds;
    00183   int *Visited;
    00184   vtkIdType *PointMap;
    00185   vtkDataArray *NewScalars;
    00186   int RegionNumber;
    00187   vtkIdType PointNumber;
    00188   vtkIdType NumCellsInRegion;
    00189   vtkDataArray *InScalars;
    00190   vtkPolyData *Mesh;
    00191   vtkIdList *Wave;
    00192   vtkIdList *Wave2;
    00193   vtkIdList *PointIds;
    00194   vtkIdList *CellIds;
    00195 private:
    00196   vtkPolyDataConnectivityFilter(const vtkPolyDataConnectivityFilter&);  // Not implemented.
    00197   void operator=(const vtkPolyDataConnectivityFilter&);  // Not implemented.
    00198 };
    00199
    00201 inline const char *vtkPolyDataConnectivityFilter::GetExtractionModeAsString(void)
    00202 {
    00203   if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS )
    00204     {
    00205     return "ExtractPointSeededRegions";
    00206     }
    00207   else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS )
    00208     {
    00209     return "ExtractCellSeededRegions";
    00210     }
    00211   else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS )
    00212     {
    00213     return "ExtractSpecifiedRegions";
    00214     }
    00215   else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS )
    00216     {
    00217     return "ExtractAllRegions";
    00218     }
    00219   else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION )
    00220     {
    00221     return "ExtractClosestPointRegion";
    00222     }
    00223   else
    00224     {
    00225     return "ExtractLargestRegion";
    00226     }
    00227 }
    00228
    00229
    00230 #endif