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 =========================================================================*/
00074 #ifndef __vtkPolyDataConnectivityFilter_h
00075 #define __vtkPolyDataConnectivityFilter_h
00076 
00077 #include "vtkPolyDataToPolyDataFilter.h"
00078 
00079 #define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
00080 #define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
00081 #define VTK_EXTRACT_SPECIFIED_REGIONS 3
00082 #define VTK_EXTRACT_LARGEST_REGION 4
00083 #define VTK_EXTRACT_ALL_REGIONS 5
00084 #define VTK_EXTRACT_CLOSEST_POINT_REGION 6
00085 
00086 class vtkDataArray;
00087 
00088 class VTK_GRAPHICS_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataToPolyDataFilter
00089 {
00090 public:
00091   vtkTypeMacro(vtkPolyDataConnectivityFilter,vtkPolyDataToPolyDataFilter);
00092   void PrintSelf(ostream& os, vtkIndent indent);
00093 
00095   static vtkPolyDataConnectivityFilter *New();
00096 
00098 
00101   vtkSetMacro(ScalarConnectivity,int);
00102   vtkGetMacro(ScalarConnectivity,int);
00103   vtkBooleanMacro(ScalarConnectivity,int);
00105 
00107 
00109   vtkSetVectorMacro(ScalarRange,float,2);
00110   vtkGetVectorMacro(ScalarRange,float,2);
00112 
00114 
00115   vtkSetClampMacro(ExtractionMode,int,
00116                    VTK_EXTRACT_POINT_SEEDED_REGIONS,
00117                    VTK_EXTRACT_CLOSEST_POINT_REGION);
00118   vtkGetMacro(ExtractionMode,int);
00119   void SetExtractionModeToPointSeededRegions()
00120     {this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);};
00121   void SetExtractionModeToCellSeededRegions()
00122     {this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);};
00123   void SetExtractionModeToLargestRegion()
00124     {this->SetExtractionMode(VTK_EXTRACT_LARGEST_REGION);};
00125   void SetExtractionModeToSpecifiedRegions()
00126     {this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);};
00127   void SetExtractionModeToClosestPointRegion()
00128     {this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);};
00129   void SetExtractionModeToAllRegions()
00130     {this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS);};
00131   const char *GetExtractionModeAsString();
00133 
00135   void InitializeSeedList();
00136 
00138   void AddSeed(int id);
00139 
00141   void DeleteSeed(int id);
00142 
00144   void InitializeSpecifiedRegionList();
00145 
00147   void AddSpecifiedRegion(int id);
00148 
00150   void DeleteSpecifiedRegion(int id);
00151 
00153 
00155   vtkSetVector3Macro(ClosestPoint,float);
00156   vtkGetVectorMacro(ClosestPoint,float,3);
00158 
00160   int GetNumberOfExtractedRegions();
00161 
00163 
00164   vtkSetMacro(ColorRegions,int);
00165   vtkGetMacro(ColorRegions,int);
00166   vtkBooleanMacro(ColorRegions,int);
00168 
00169 protected:
00170   vtkPolyDataConnectivityFilter();
00171   ~vtkPolyDataConnectivityFilter();
00172 
00173   // Usual data generation method
00174   void Execute();
00175 
00176   int ColorRegions; //boolean turns on/off scalar gen for separate regions
00177   int ExtractionMode; //how to extract regions
00178   vtkIdList *Seeds; //id's of points or cells used to seed regions
00179   vtkIdList *SpecifiedRegionIds; //regions specified for extraction
00180   vtkIdTypeArray *RegionSizes; //size (in cells) of each region extracted
00181 
00182   float ClosestPoint[3];
00183 
00184   int ScalarConnectivity;
00185   float ScalarRange[2];
00186 
00187   void TraverseAndMark();
00188 
00189 private:
00190   // used to support algorithm execution
00191   vtkDataArray *CellScalars;
00192   vtkIdList *NeighborCellPointIds;
00193   int *Visited;
00194   vtkIdType *PointMap;
00195   vtkDataArray *NewScalars;
00196   int RegionNumber;
00197   vtkIdType PointNumber;    
00198   vtkIdType NumCellsInRegion;
00199   vtkDataArray *InScalars;
00200   vtkPolyData *Mesh;
00201   vtkIdList *Wave;
00202   vtkIdList *Wave2;
00203   vtkIdList *PointIds;
00204   vtkIdList *CellIds;
00205 private:
00206   vtkPolyDataConnectivityFilter(const vtkPolyDataConnectivityFilter&);  // Not implemented.
00207   void operator=(const vtkPolyDataConnectivityFilter&);  // Not implemented.
00208 };
00209 
00211 inline const char *vtkPolyDataConnectivityFilter::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 
00240 #endif

Generated on Thu Mar 28 14:19:21 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001