VTK
vtkImageStencilData.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageStencilData.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
29 #ifndef vtkImageStencilData_h
30 #define vtkImageStencilData_h
31 
32 
33 #include "vtkImagingCoreModule.h" // For export macro
34 #include "vtkDataObject.h"
35 
37 {
38 public:
39  static vtkImageStencilData *New();
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
43  void Initialize();
44  void DeepCopy(vtkDataObject *o);
45  void ShallowCopy(vtkDataObject *f);
46  void InternalImageStencilDataCopy(vtkImageStencilData *s);
47 
51 
53  int GetExtentType() { return VTK_3D_EXTENT; };
54 
56 
64  int GetNextExtent(int &r1, int &r2, int xMin, int xMax,
65  int yIdx, int zIdx, int &iter);
67 
72  int IsInside(int xIdx, int yIdx, int zIdx);
73 
79  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
80 
87  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
88 
90  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
91 
93 
96  vtkSetVector3Macro(Spacing, double);
97  vtkGetVector3Macro(Spacing, double);
99 
101 
104  vtkSetVector3Macro(Origin, double);
105  vtkGetVector3Macro(Origin, double);
107 
109 
112  void SetExtent(int extent[6]);
113  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
114  vtkGetVector6Macro(Extent, int);
116 
119  void AllocateExtents();
120 
122  void Fill();
123 
125 
130 
131  //BTX
133 
135  static vtkImageStencilData* GetData(vtkInformationVector* v, int i=0);
136  //ETX
138 
140  virtual void Add(vtkImageStencilData *);
141 
144  virtual void Subtract(vtkImageStencilData *);
145 
148  virtual void Replace(vtkImageStencilData *);
149 
152  virtual int Clip(int extent[6]);
153 
154 protected:
157 
158  enum Operation { Merge, Erase };
159 
161 
162  void LogicalOperationExtent(
163  int r1, int r2, int yIdx, int zIdx, Operation operation);
165 
167 
168  void LogicalOperationInPlace(
169  vtkImageStencilData *stencil, Operation operation);
171 
175  void ChangeExtent(const int extent[6]);
176 
178  void CopyOriginAndSpacingFromPipeline(vtkInformation *info);
179 
181 
182  double Spacing[3];
183  double Origin[3];
185 
186  int Extent[6];
187 
189 
192  int **ExtentLists;
194 
195 private:
196  vtkImageStencilData(const vtkImageStencilData&); // Not implemented.
197  void operator=(const vtkImageStencilData&); // Not implemented.
198 
199  friend class vtkImageStencilIteratorFriendship;
200 };
201 
202 //BTX
204 
209 {
210 public:
212 
213  vtkImageStencilRaster(const int wholeExtent[2]);
214 
217 
221  void PrepareForNewData(const int allocateExtent[2] = 0);
222 
224 
225  void InsertLine(const double p1[2], const double p2[2]);
226  VTK_LEGACY(void InsertLine(const double[2], const double[2], bool, bool));
228 
230 
232  void FillStencilData(vtkImageStencilData *data, const int extent[6],
233  int xj = 0, int yj = 1);
235 
237 
238  void SetTolerance(double tol) { this->Tolerance = tol; }
239  double GetTolerance() { return this->Tolerance; }
241 
242 protected:
245  void PrepareExtent(int ymin, int ymax);
246 
250  void InsertPoint(int y, double x, int i);
251 
252  int Extent[2];
253  int UsedExtent[2];
254  double **Raster;
255  double Tolerance;
256 
257 private:
258  vtkImageStencilRaster(const vtkImageStencilRaster&); // Not implemented.
259  void operator=(const vtkImageStencilRaster&); // Not implemented.
260 };
261 //ETX
262 
263 #endif
264 
265 
266 
static vtkDataObject * GetData(vtkInformation *info)
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
virtual void Initialize()
void SetTolerance(double tol)
a simple class to control print indentation
Definition: vtkIndent.h:38
efficient description of an image stencil
#define VTKIMAGINGCORE_EXPORT
virtual void CopyInformationFromPipeline(vtkInformation *vtkNotUsed(info))
void PrintSelf(ostream &os, vtkIndent indent)
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void CopyInformationToPipeline(vtkInformation *vtkNotUsed(info))
virtual void DeepCopy(vtkDataObject *src)
virtual void ShallowCopy(vtkDataObject *src)
#define VTK_DATA_OBJECT
Definition: vtkType.h:71