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

dox/Graphics/vtkConnectivityFilter.h

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