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

graphics/vtkPolyDataConnectivityFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPolyDataConnectivityFilter.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 =========================================================================*/
00073 #ifndef __vtkPolyDataConnectivityFilter_h
00074 #define __vtkPolyDataConnectivityFilter_h
00075 
00076 #include "vtkPolyDataToPolyDataFilter.h"
00077 
00078 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00079 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00080 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00081 #define VTK_EXTRACT_LARGEST_REGION 4
00082 #define VTK_EXTRACT_ALL_REGIONS 5
00083 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00084 
00085 class VTK_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataToPolyDataFilter
00086 {
00087 public:
00088   vtkTypeMacro(vtkPolyDataConnectivityFilter,vtkPolyDataToPolyDataFilter);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090 
00092   static vtkPolyDataConnectivityFilter *New();
00093 
00097   vtkSetMacro(ScalarConnectivity,int);
00098   vtkGetMacro(ScalarConnectivity,int);
00099   vtkBooleanMacro(ScalarConnectivity,int);
00100 
00103   vtkSetVectorMacro(ScalarRange,float,2);
00104   vtkGetVectorMacro(ScalarRange,float,2);
00105 
00107   vtkSetClampMacro(ExtractionMode,int,
00108                    VTK_EXTRACT_POINT_SEEDED_REGIONS,
00109                    VTK_EXTRACT_CLOSEST_POINT_REGION);
00110   vtkGetMacro(ExtractionMode,int);
00111   void SetExtractionModeToPointSeededRegions()
00112     {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00113   void SetExtractionModeToCellSeededRegions()
00114     {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00115   void SetExtractionModeToLargestRegion()
00116     {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00117   void SetExtractionModeToSpecifiedRegions()
00118     {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00119   void SetExtractionModeToClosestPointRegion()
00120     {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00121   void SetExtractionModeToAllRegions()
00122     {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00123   const char *GetExtractionModeAsString();
00124 
00126   void InitializeSeedList();
00127 
00129   void AddSeed(int id);
00130 
00132   void DeleteSeed(int id);
00133 
00135   void InitializeSpecifiedRegionList();
00136 
00138   void AddSpecifiedRegion(int id);
00139 
00141   void DeleteSpecifiedRegion(int id);
00142 
00145   vtkSetVector3Macro(ClosestPoint,float);
00146   vtkGetVectorMacro(ClosestPoint,float,3);
00147 
00149   int GetNumberOfExtractedRegions();
00150 
00152   vtkSetMacro(ColorRegions,int);
00153   vtkGetMacro(ColorRegions,int);
00154   vtkBooleanMacro(ColorRegions,int);
00155 
00156 #ifndef VTK_REMOVE_LEGACY_CODE
00157 
00160   void SetMaxRecursionDepth(int) 
00161     {VTK_LEGACY_METHOD(SetMaxRecursionDepth,"3.2");}
00162   int GetMaxRecursionDepth()
00163     {VTK_LEGACY_METHOD(GetMaxRecursionDepth,"3.2"); return 0;}
00164 #endif
00165   
00166 protected:
00167   vtkPolyDataConnectivityFilter();
00168   ~vtkPolyDataConnectivityFilter();
00169   vtkPolyDataConnectivityFilter(const vtkPolyDataConnectivityFilter&) {};
00170   void operator=(const vtkPolyDataConnectivityFilter&) {};
00171 
00172   // Usual data generation method
00173   void Execute();
00174 
00175   int ColorRegions; //boolean turns on/off scalar gen for separate regions
00176   int ExtractionMode; //how to extract regions
00177   vtkIdList *Seeds; //id's of points or cells used to seed regions
00178   vtkIdList *SpecifiedRegionIds; //regions specified for extraction
00179   vtkIntArray *RegionSizes; //size (in cells) of each region extracted
00180 
00181   float ClosestPoint[3];
00182 
00183   int ScalarConnectivity;
00184   float ScalarRange[2];
00185 
00186   void TraverseAndMark();
00187 
00188 private:
00189   // used to support algorithm execution
00190   vtkScalars *CellScalars;
00191   vtkIdList *NeighborCellPointIds;
00192   int *Visited;
00193   int *PointMap;
00194   vtkScalars *NewScalars;
00195   int RegionNumber;
00196   int PointNumber;    
00197   int NumCellsInRegion;
00198   vtkScalars *InScalars;
00199   vtkPolyData *Mesh;
00200   vtkIdList *Wave;
00201   vtkIdList *Wave2;
00202   vtkIdList *PointIds;
00203   vtkIdList *CellIds;
00204 };
00205 
00207 inline const char *vtkPolyDataConnectivityFilter::GetExtractionModeAsString(void)
00208 {
00209   if ( this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS ) 
00210     {
00211     return "ExtractPointSeededRegions";
00212     }
00213   else if ( this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS ) 
00214     {
00215     return "ExtractCellSeededRegions";
00216     }
00217   else if ( this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS ) 
00218     {
00219     return "ExtractSpecifiedRegions";
00220     }
00221   else if ( this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS ) 
00222     {
00223     return "ExtractAllRegions";
00224     }
00225   else if ( this->ExtractionMode == VTK_EXTRACT_CLOSEST_POINT_REGION ) 
00226     {
00227     return "ExtractClosestPointRegion";
00228     }
00229   else 
00230     {
00231     return "ExtractLargestRegion";
00232     }
00233 }
00234 
00235 
00236 #endif
00237 
00238 

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