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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00079 #ifndef __vtkConnectivityFilter_h
00080 #define __vtkConnectivityFilter_h
00081 
00082 #include "vtkDataSetToUnstructuredGridFilter.h"
00083 
00084 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00085 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00086 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00087 #define VTK_EXTRACT_LARGEST_REGION 4
00088 #define VTK_EXTRACT_ALL_REGIONS 5
00089 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00090 
00091 class VTK_EXPORT vtkConnectivityFilter : public vtkDataSetToUnstructuredGridFilter
00092 {
00093 public:
00094   vtkTypeMacro(vtkConnectivityFilter,vtkDataSetToUnstructuredGridFilter);
00095   void PrintSelf(ostream& os, vtkIndent indent);
00096 
00098   static vtkConnectivityFilter *New();
00099 
00103   vtkSetMacro(ScalarConnectivity,int);
00104   vtkGetMacro(ScalarConnectivity,int);
00105   vtkBooleanMacro(ScalarConnectivity,int);
00106 
00109   vtkSetVector2Macro(ScalarRange,float);
00110   vtkGetVector2Macro(ScalarRange,float);
00111 
00113   vtkSetClampMacro(ExtractionMode,int,
00114             VTK_EXTRACT_POINT_SEEDED_REGIONS,VTK_EXTRACT_CLOSEST_POINT_REGION);
00115   vtkGetMacro(ExtractionMode,int);
00116   void SetExtractionModeToPointSeededRegions()
00117     {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00118   void SetExtractionModeToCellSeededRegions()
00119     {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00120   void SetExtractionModeToLargestRegion()
00121     {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00122   void SetExtractionModeToSpecifiedRegions()
00123     {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00124   void SetExtractionModeToClosestPointRegion()
00125     {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00126   void SetExtractionModeToAllRegions()
00127     {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00128   const char *GetExtractionModeAsString();
00129 
00131   void InitializeSeedList();
00132 
00134   void AddSeed(int id);
00135 
00137   void DeleteSeed(int id);
00138 
00140   void InitializeSpecifiedRegionList();
00141 
00143   void AddSpecifiedRegion(int id);
00144 
00146   void DeleteSpecifiedRegion(int id);
00147 
00150   vtkSetVector3Macro(ClosestPoint,float);
00151   vtkGetVectorMacro(ClosestPoint,float,3);
00152 
00154   int GetNumberOfExtractedRegions();
00155 
00157   vtkSetMacro(ColorRegions,int);
00158   vtkGetMacro(ColorRegions,int);
00159   vtkBooleanMacro(ColorRegions,int);
00160 
00161 #ifndef VTK_REMOVE_LEGACY_CODE
00162 
00165   void SetMaxRecursionDepth(int) 
00166     {VTK_LEGACY_METHOD(SetMaxRecursionDepth,"3.2");}
00167   int GetMaxRecursionDepth()
00168     {VTK_LEGACY_METHOD(GetMaxRecursionDepth,"3.2"); return 0;}
00169 #endif
00170   
00171 protected:
00172   vtkConnectivityFilter();
00173   ~vtkConnectivityFilter();
00174   vtkConnectivityFilter(const vtkConnectivityFilter&) {};
00175   void operator=(const vtkConnectivityFilter&) {};
00176 
00177   // Usual data generation method
00178   void Execute();
00179 
00180   int ColorRegions; //boolean turns on/off scalar gen for separate regions
00181   int ExtractionMode; //how to extract regions
00182   vtkIdList *Seeds; //id's of points or cells used to seed regions
00183   vtkIdList *SpecifiedRegionIds; //regions specified for extraction
00184   vtkIntArray *RegionSizes; //size (in cells) of each region extracted
00185 
00186   float ClosestPoint[3];
00187 
00188   int ScalarConnectivity;
00189   float ScalarRange[2];
00190 
00191   void TraverseAndMark();
00192 
00193 private:
00194   // used to support algorithm execution
00195   vtkScalars *CellScalars;
00196   vtkIdList *NeighborCellPointIds;
00197   int *Visited;
00198   int *PointMap;
00199   vtkScalars *NewScalars;
00200   int RegionNumber;
00201   int PointNumber;    
00202   int NumCellsInRegion;
00203   vtkScalars *InScalars;
00204   vtkIdList *Wave;
00205   vtkIdList *Wave2;
00206   vtkIdList *PointIds;
00207   vtkIdList *CellIds;
00208 };
00209 
00211 inline const char *vtkConnectivityFilter::GetExtractionModeAsString(void)
00212 {
00213   if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS ) 
00214     {
00215     return "ExtractPointSeededRegions";
00216     }
00217   else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS ) 
00218     {
00219     return "ExtractCellSeededRegions";
00220     }
00221   else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS ) 
00222     {
00223     return "ExtractSpecifiedRegions";
00224     }
00225   else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS ) 
00226     {
00227     return "ExtractAllRegions";
00228     }
00229   else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION ) 
00230     {
00231     return "ExtractClosestPointRegion";
00232     }
00233   else 
00234     {
00235     return "ExtractLargestRegion";
00236     }
00237 }
00238 
00239 #endif
00240 
00241 

Generated on Wed Nov 21 12:26:57 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001