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 
72  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
73 
80  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
81 
83  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
84 
86 
89  vtkSetVector3Macro(Spacing, double);
90  vtkGetVector3Macro(Spacing, double);
92 
94 
97  vtkSetVector3Macro(Origin, double);
98  vtkGetVector3Macro(Origin, double);
100 
102 
105  void SetExtent(int extent[6]);
106  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
107  vtkGetVector6Macro(Extent, int);
109 
112  void AllocateExtents();
113 
115  void Fill();
116 
118 
120  virtual void CopyInformationToPipeline(vtkInformation* request,
121  vtkInformation* input,
122  vtkInformation* output,
123  int forceCopy);
124  virtual void CopyInformationFromPipeline(vtkInformation* request);
126 
127  //BTX
129 
131  static vtkImageStencilData* GetData(vtkInformationVector* v, int i=0);
132  //ETX
134 
136  virtual void Add ( vtkImageStencilData * );
137 
140  virtual void Subtract( vtkImageStencilData * );
141 
144  virtual void Replace( vtkImageStencilData * );
145 
148  virtual int Clip( int extent[6] );
149 
150 protected:
153 
155  void CopyOriginAndSpacingFromPipeline();
156 
159  virtual void InternalAdd( vtkImageStencilData * );
160 
161  void CollapseAdditionalIntersections(int r2, int idx, int *clist,
162  int &clistlen);
163 
165 
166  double Spacing[3];
167  double Origin[3];
169 
170  int Extent[6];
171 
173 
176  int **ExtentLists;
178 
179 private:
180  vtkImageStencilData(const vtkImageStencilData&); // Not implemented.
181  void operator=(const vtkImageStencilData&); // Not implemented.
182 
183  friend class vtkImageStencilIteratorFriendship;
184 };
185 
186 //BTX
188 
193 {
194 public:
195  // Description:
196  // Create a raster with the specified whole y extent.
197  vtkImageStencilRaster(const int wholeExtent[2]);
199 
202 
206  void PrepareForNewData(const int allocateExtent[2] = 0);
207 
209 
212  void InsertLine(const double p1[2], const double p2[2],
213  bool inflect1, bool inflect2);
215 
217 
219  void FillStencilData(vtkImageStencilData *data, const int extent[6],
220  int xj = 0, int yj = 1);
222 
224 
225  void SetTolerance(double tol) { this->Tolerance = tol; }
226  double GetTolerance() { return this->Tolerance; }
228 
229 protected:
232  void PrepareExtent(int ymin, int ymax);
233 
236  void InsertPoint(int y, double x);
237 
238  int Extent[2];
239  int UsedExtent[2];
240  double **Raster;
241  double Tolerance;
242 
243 private:
244  vtkImageStencilRaster(const vtkImageStencilRaster&); // Not implemented.
245  void operator=(const vtkImageStencilRaster&); // Not implemented.
246 };
247 //ETX
248 
249 #endif
250 
251 
252 
static vtkDataObject * GetData(vtkInformation *info)
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:67
virtual void Initialize()
void SetTolerance(double tol)
a simple class to control print indentation
Definition: vtkIndent.h:37
efficient description of an image stencil
#define VTK_IMAGING_EXPORT
void PrintSelf(ostream &os, vtkIndent indent)
virtual void CopyInformationToPipeline(vtkInformation *request, vtkInformation *input, vtkInformation *output, int forceCopy)
virtual void CopyInformationFromPipeline(vtkInformation *request)
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:70
virtual void DeepCopy(vtkDataObject *src)
virtual void ShallowCopy(vtkDataObject *src)
#define VTK_DATA_OBJECT
Definition: vtkType.h:73