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

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 "vtkUnstructuredGridAlgorithm.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 vtkUnstructuredGridAlgorithm
00073 {
00074 public:
00075   vtkTypeRevisionMacro(vtkConnectivityFilter,vtkUnstructuredGridAlgorithm);
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   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00158   virtual int FillInputPortInformation(int port, vtkInformation *info);
00159 
00160   int ColorRegions; //boolean turns on/off scalar gen for separate regions
00161   int ExtractionMode; //how to extract regions
00162   vtkIdList *Seeds; //id's of points or cells used to seed regions
00163   vtkIdList *SpecifiedRegionIds; //regions specified for extraction
00164   vtkIntArray *RegionSizes; //size (in cells) of each region extracted
00165 
00166   double ClosestPoint[3];
00167 
00168   int ScalarConnectivity;
00169   double ScalarRange[2];
00170 
00171   void TraverseAndMark(vtkDataSet *input);
00172 
00173 private:
00174   // used to support algorithm execution
00175   vtkFloatArray *CellScalars;
00176   vtkIdList *NeighborCellPointIds;
00177   vtkIdType *Visited;
00178   vtkIdType *PointMap;
00179   vtkFloatArray *NewScalars;
00180   int RegionNumber;
00181   vtkIdType PointNumber;    
00182   int NumCellsInRegion;
00183   vtkDataArray *InScalars;
00184   vtkIdList *Wave;
00185   vtkIdList *Wave2;
00186   vtkIdList *PointIds;
00187   vtkIdList *CellIds;
00188 private:
00189   vtkConnectivityFilter(const vtkConnectivityFilter&);  // Not implemented.
00190   void operator=(const vtkConnectivityFilter&);  // Not implemented.
00191 };
00192 
00194 inline const char *vtkConnectivityFilter::GetExtractionModeAsString(void)
00195 {
00196   if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS ) 
00197     {
00198     return "ExtractPointSeededRegions";
00199     }
00200   else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS ) 
00201     {
00202     return "ExtractCellSeededRegions";
00203     }
00204   else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS ) 
00205     {
00206     return "ExtractSpecifiedRegions";
00207     }
00208   else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS ) 
00209     {
00210     return "ExtractAllRegions";
00211     }
00212   else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION ) 
00213     {
00214     return "ExtractClosestPointRegion";
00215     }
00216   else 
00217     {
00218     return "ExtractLargestRegion";
00219     }
00220 }
00221 
00222 #endif
00223 
00224 

Generated on Mon Jan 21 23:07:24 2008 for VTK by  doxygen 1.4.3-20050530