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 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 =========================================================================*/ 00059 #ifndef __vtkConnectivityFilter_h 00060 #define __vtkConnectivityFilter_h 00061 00062 #include "vtkDataSetToUnstructuredGridFilter.h" 00063 00064 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1 00065 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2 00066 #define VTK_EXTRACT_SPECIFIED_REGIONS 3 00067 #define VTK_EXTRACT_LARGEST_REGION 4 00068 #define VTK_EXTRACT_ALL_REGIONS 5 00069 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6 00070 00071 class vtkDataArray; 00072 class vtkFloatArray; 00073 class vtkIdList; 00074 class vtkIntArray; 00075 00076 class VTK_GRAPHICS_EXPORT vtkConnectivityFilter : public vtkDataSetToUnstructuredGridFilter 00077 { 00078 public: 00079 vtkTypeRevisionMacro(vtkConnectivityFilter,vtkDataSetToUnstructuredGridFilter); 00080 void PrintSelf(ostream& os, vtkIndent indent); 00081 00083 static vtkConnectivityFilter *New(); 00084 00086 00089 vtkSetMacro(ScalarConnectivity,int); 00090 vtkGetMacro(ScalarConnectivity,int); 00091 vtkBooleanMacro(ScalarConnectivity,int); 00093 00095 00097 vtkSetVector2Macro(ScalarRange,float); 00098 vtkGetVector2Macro(ScalarRange,float); 00100 00102 00103 vtkSetClampMacro(ExtractionMode,int, 00104 VTK_EXTRACT_POINT_SEEDED_REGIONS,VTK_EXTRACT_CLOSEST_POINT_REGION); 00105 vtkGetMacro(ExtractionMode,int); 00106 void SetExtractionModeToPointSeededRegions() 00107 {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);}; 00108 void SetExtractionModeToCellSeededRegions() 00109 {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);}; 00110 void SetExtractionModeToLargestRegion() 00111 {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);}; 00112 void SetExtractionModeToSpecifiedRegions() 00113 {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);}; 00114 void SetExtractionModeToClosestPointRegion() 00115 {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);}; 00116 void SetExtractionModeToAllRegions() 00117 {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);}; 00118 const char *GetExtractionModeAsString(); 00120 00122 void InitializeSeedList(); 00123 00125 void AddSeed(vtkIdType id); 00126 00128 void DeleteSeed(vtkIdType id); 00129 00131 void InitializeSpecifiedRegionList(); 00132 00134 void AddSpecifiedRegion(int id); 00135 00137 void DeleteSpecifiedRegion(int id); 00138 00140 00142 vtkSetVector3Macro(ClosestPoint,float); 00143 vtkGetVectorMacro(ClosestPoint,float,3); 00145 00147 int GetNumberOfExtractedRegions(); 00148 00150 00151 vtkSetMacro(ColorRegions,int); 00152 vtkGetMacro(ColorRegions,int); 00153 vtkBooleanMacro(ColorRegions,int); 00155 00156 protected: 00157 vtkConnectivityFilter(); 00158 ~vtkConnectivityFilter(); 00159 00160 // Usual data generation method 00161 void Execute(); 00162 00163 int ColorRegions; //boolean turns on/off scalar gen for separate regions 00164 int ExtractionMode; //how to extract regions 00165 vtkIdList *Seeds; //id's of points or cells used to seed regions 00166 vtkIdList *SpecifiedRegionIds; //regions specified for extraction 00167 vtkIntArray *RegionSizes; //size (in cells) of each region extracted 00168 00169 float ClosestPoint[3]; 00170 00171 int ScalarConnectivity; 00172 float ScalarRange[2]; 00173 00174 void TraverseAndMark(); 00175 00176 private: 00177 // used to support algorithm execution 00178 vtkFloatArray *CellScalars; 00179 vtkIdList *NeighborCellPointIds; 00180 vtkIdType *Visited; 00181 vtkIdType *PointMap; 00182 vtkFloatArray *NewScalars; 00183 int RegionNumber; 00184 vtkIdType PointNumber; 00185 int NumCellsInRegion; 00186 vtkDataArray *InScalars; 00187 vtkIdList *Wave; 00188 vtkIdList *Wave2; 00189 vtkIdList *PointIds; 00190 vtkIdList *CellIds; 00191 private: 00192 vtkConnectivityFilter(const vtkConnectivityFilter&); // Not implemented. 00193 void operator=(const vtkConnectivityFilter&); // Not implemented. 00194 }; 00195 00197 inline const char *vtkConnectivityFilter::GetExtractionModeAsString(void) 00198 { 00199 if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS ) 00200 { 00201 return "ExtractPointSeededRegions"; 00202 } 00203 else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS ) 00204 { 00205 return "ExtractCellSeededRegions"; 00206 } 00207 else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS ) 00208 { 00209 return "ExtractSpecifiedRegions"; 00210 } 00211 else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS ) 00212 { 00213 return "ExtractAllRegions"; 00214 } 00215 else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION ) 00216 { 00217 return "ExtractClosestPointRegion"; 00218 } 00219 else 00220 { 00221 return "ExtractLargestRegion"; 00222 } 00223 } 00224 00225 #endif 00226 00227