VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImageStencilData.h 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 =========================================================================*/ 00029 #ifndef __vtkImageStencilData_h 00030 #define __vtkImageStencilData_h 00031 00032 00033 #include "vtkImagingCoreModule.h" // For export macro 00034 #include "vtkDataObject.h" 00035 00036 class VTKIMAGINGCORE_EXPORT vtkImageStencilData : public vtkDataObject 00037 { 00038 public: 00039 static vtkImageStencilData *New(); 00040 vtkTypeMacro(vtkImageStencilData, vtkDataObject); 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00043 void Initialize(); 00044 void DeepCopy(vtkDataObject *o); 00045 void ShallowCopy(vtkDataObject *f); 00046 void InternalImageStencilDataCopy(vtkImageStencilData *s); 00047 00050 int GetDataObjectType() { return VTK_DATA_OBJECT; } 00051 00053 int GetExtentType() { return VTK_3D_EXTENT; }; 00054 00056 00064 int GetNextExtent(int &r1, int &r2, int xMin, int xMax, 00065 int yIdx, int zIdx, int &iter); 00067 00072 int IsInside( int xIdx, int yIdx, int zIdx ); 00073 00079 void InsertNextExtent(int r1, int r2, int yIdx, int zIdx); 00080 00087 void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx); 00088 00090 void RemoveExtent(int r1, int r2, int yIdx, int zIdx); 00091 00093 00096 vtkSetVector3Macro(Spacing, double); 00097 vtkGetVector3Macro(Spacing, double); 00099 00101 00104 vtkSetVector3Macro(Origin, double); 00105 vtkGetVector3Macro(Origin, double); 00107 00109 00112 void SetExtent(int extent[6]); 00113 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2); 00114 vtkGetVector6Macro(Extent, int); 00116 00119 void AllocateExtents(); 00120 00122 void Fill(); 00123 00126 virtual void CopyInformationFromPipeline(vtkInformation* meta_data); 00127 00128 //BTX 00130 00131 static vtkImageStencilData* GetData(vtkInformation* info); 00132 static vtkImageStencilData* GetData(vtkInformationVector* v, int i=0); 00133 //ETX 00135 00137 virtual void Add ( vtkImageStencilData * ); 00138 00141 virtual void Subtract( vtkImageStencilData * ); 00142 00145 virtual void Replace( vtkImageStencilData * ); 00146 00149 virtual int Clip( int extent[6] ); 00150 00151 protected: 00152 vtkImageStencilData(); 00153 ~vtkImageStencilData(); 00154 00156 void CopyOriginAndSpacingFromPipeline(vtkInformation* meta_data); 00157 00160 virtual void InternalAdd( vtkImageStencilData * ); 00161 00162 void CollapseAdditionalIntersections(int r2, int idx, int *clist, 00163 int &clistlen); 00164 00166 00167 double Spacing[3]; 00168 double Origin[3]; 00170 00171 int Extent[6]; 00172 00174 00175 int NumberOfExtentEntries; 00176 int *ExtentListLengths; 00177 int **ExtentLists; 00179 00180 private: 00181 vtkImageStencilData(const vtkImageStencilData&); // Not implemented. 00182 void operator=(const vtkImageStencilData&); // Not implemented. 00183 00184 friend class vtkImageStencilIteratorFriendship; 00185 }; 00186 00187 //BTX 00189 00193 class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster 00194 { 00195 public: 00197 00198 vtkImageStencilRaster(const int wholeExtent[2]); 00199 00201 ~vtkImageStencilRaster(); 00202 00206 void PrepareForNewData(const int allocateExtent[2] = 0); 00207 00209 00212 void InsertLine(const double p1[2], const double p2[2], 00213 bool inflect1, bool inflect2); 00215 00217 00219 void FillStencilData(vtkImageStencilData *data, const int extent[6], 00220 int xj = 0, int yj = 1); 00222 00224 00225 void SetTolerance(double tol) { this->Tolerance = tol; } 00226 double GetTolerance() { return this->Tolerance; } 00228 00229 protected: 00232 void PrepareExtent(int ymin, int ymax); 00233 00236 void InsertPoint(int y, double x); 00237 00238 int Extent[2]; 00239 int UsedExtent[2]; 00240 double **Raster; 00241 double Tolerance; 00242 00243 private: 00244 vtkImageStencilRaster(const vtkImageStencilRaster&); // Not implemented. 00245 void operator=(const vtkImageStencilRaster&); // Not implemented. 00246 }; 00247 //ETX 00248 00249 #endif 00250 00251 00252