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

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