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

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