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 "vtkDataObject.h"
34 
36 {
37 public:
38  static vtkImageStencilData *New();
40  void PrintSelf(ostream& os, vtkIndent indent);
41 
42  void Initialize();
43  void DeepCopy(vtkDataObject *o);
44  void ShallowCopy(vtkDataObject *f);
45  void InternalImageStencilDataCopy(vtkImageStencilData *s);
46 
50 
52  int GetExtentType() { return VTK_3D_EXTENT; };
53 
55 
63  int GetNextExtent(int &r1, int &r2, int xMin, int xMax,
64  int yIdx, int zIdx, int &iter);
66 
71  int IsInside( int xIdx, int yIdx, int zIdx );
72 
78  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
79 
86  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
87 
89  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
90 
92 
95  vtkSetVector3Macro(Spacing, double);
96  vtkGetVector3Macro(Spacing, double);
98 
100 
103  vtkSetVector3Macro(Origin, double);
104  vtkGetVector3Macro(Origin, double);
106 
108 
111  void SetExtent(int extent[6]);
112  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
113  vtkGetVector6Macro(Extent, int);
115 
118  void AllocateExtents();
119 
121  void Fill();
122 
124 
126  virtual void CopyInformationToPipeline(vtkInformation* request,
127  vtkInformation* input,
128  vtkInformation* output,
129  int forceCopy);
130  virtual void CopyInformationFromPipeline(vtkInformation* request);
132 
133  //BTX
135 
137  static vtkImageStencilData* GetData(vtkInformationVector* v, int i=0);
138  //ETX
140 
142  virtual void Add ( vtkImageStencilData * );
143 
146  virtual void Subtract( vtkImageStencilData * );
147 
150  virtual void Replace( vtkImageStencilData * );
151 
154  virtual int Clip( int extent[6] );
155 
156 protected:
159 
161  void CopyOriginAndSpacingFromPipeline();
162 
165  virtual void InternalAdd( vtkImageStencilData * );
166 
167  void CollapseAdditionalIntersections(int r2, int idx, int *clist,
168  int &clistlen);
169 
171 
172  double Spacing[3];
173  double Origin[3];
175 
176  int Extent[6];
177 
179 
182  int **ExtentLists;
184 
185 private:
186  vtkImageStencilData(const vtkImageStencilData&); // Not implemented.
187  void operator=(const vtkImageStencilData&); // Not implemented.
188 
189  friend class vtkImageStencilIteratorFriendship;
190 };
191 
192 //BTX
194 
199 {
200 public:
202 
203  vtkImageStencilRaster(const int wholeExtent[2]);
204 
207 
211  void PrepareForNewData(const int allocateExtent[2] = 0);
212 
214 
217  void InsertLine(const double p1[2], const double p2[2],
218  bool inflect1, bool inflect2);
220 
222 
224  void FillStencilData(vtkImageStencilData *data, const int extent[6],
225  int xj = 0, int yj = 1);
227 
229 
230  void SetTolerance(double tol) { this->Tolerance = tol; }
231  double GetTolerance() { return this->Tolerance; }
233 
234 protected:
237  void PrepareExtent(int ymin, int ymax);
238 
241  void InsertPoint(int y, double x);
242 
243  int Extent[2];
244  int UsedExtent[2];
245  double **Raster;
246  double Tolerance;
247 
248 private:
249  vtkImageStencilRaster(const vtkImageStencilRaster&); // Not implemented.
250  void operator=(const vtkImageStencilRaster&); // Not implemented.
251 };
252 //ETX
253 
254 #endif
255 
256 
257