VTK  9.2.6
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 =========================================================================*/
30 #ifndef vtkImageStencilData_h
31 #define vtkImageStencilData_h
32 
33 #include "vtkDataObject.h"
34 #include "vtkImagingCoreModule.h" // For export macro
35 
36 class VTKIMAGINGCORE_EXPORT vtkImageStencilData : public vtkDataObject
37 {
38 public:
39  static vtkImageStencilData* New();
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
43  void Initialize() override;
44  void DeepCopy(vtkDataObject* o) override;
45  void ShallowCopy(vtkDataObject* f) override;
46  void InternalImageStencilDataCopy(vtkImageStencilData* s);
47 
51  int GetDataObjectType() override { return VTK_IMAGE_STENCIL_DATA; }
52 
56  int GetExtentType() override { return VTK_3D_EXTENT; }
57 
67  int GetNextExtent(int& r1, int& r2, int xMin, int xMax, int yIdx, int zIdx, int& iter);
68 
75  int IsInside(int xIdx, int yIdx, int zIdx);
76 
84  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
85 
94  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
95 
99  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
100 
102 
108  vtkSetVector3Macro(Spacing, double);
109  vtkGetVector3Macro(Spacing, double);
111 
113 
119  vtkSetVector3Macro(Origin, double);
120  vtkGetVector3Macro(Origin, double);
122 
124 
129  void SetExtent(const int extent[6]);
130  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
131  vtkGetVector6Macro(Extent, int);
133 
138  void AllocateExtents();
139 
143  void Fill();
144 
146 
153 
155 
159  static vtkImageStencilData* GetData(vtkInformationVector* v, int i = 0);
161 
165  virtual void Add(vtkImageStencilData*);
166 
171  virtual void Subtract(vtkImageStencilData*);
172 
177  virtual void Replace(vtkImageStencilData*);
178 
183  virtual int Clip(int extent[6]);
184 
185 protected:
187  ~vtkImageStencilData() override;
188 
190  {
192  Erase
193  };
194 
198  void LogicalOperationExtent(int r1, int r2, int yIdx, int zIdx, Operation operation);
199 
203  void LogicalOperationInPlace(vtkImageStencilData* stencil, Operation operation);
204 
210  void ChangeExtent(const int extent[6]);
211 
215  void CopyOriginAndSpacingFromPipeline(vtkInformation* info);
216 
218 
221  double Spacing[3];
222  double Origin[3];
224 
225  int Extent[6];
226 
228 
233  int** ExtentLists;
235 
236 private:
237  vtkImageStencilData(const vtkImageStencilData&) = delete;
238  void operator=(const vtkImageStencilData&) = delete;
239 
240  friend class vtkImageStencilIteratorFriendship;
241 };
242 
249 class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster
250 {
251 public:
255  vtkImageStencilRaster(const int wholeExtent[2]);
256 
261 
267  void PrepareForNewData(const int allocateExtent[2] = nullptr);
268 
270 
273  void InsertLine(const double pt1[2], const double pt2[2]);
275 
280  void FillStencilData(vtkImageStencilData* data, const int extent[6], int xj = 0, int yj = 1);
281 
285  void SetTolerance(double tol) { this->Tolerance = tol; }
286  double GetTolerance() { return this->Tolerance; }
287 
288 protected:
293  void PrepareExtent(int ymin, int ymax);
294 
300  void InsertPoint(int y, double x, int i);
301 
302  int Extent[2];
303  int UsedExtent[2];
304  double** Raster;
305  double Tolerance;
306 
307 private:
309  void operator=(const vtkImageStencilRaster&) = delete;
310 };
311 
312 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
int GetExtentType() override
The extent type is 3D, just like vtkImageData.
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
This is a helper class for stencil creation.
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:62
virtual void Initialize()
Restore data object to initial state,.
int NumberOfExtentEntries
The actual 'data' is stored here.
void SetTolerance(double tol)
The tolerance for float-to-int conversions.
a simple class to control print indentation
Definition: vtkIndent.h:39
efficient description of an image stencil
virtual void CopyInformationFromPipeline(vtkInformation *vtkNotUsed(info))
Copy from the pipeline information to the data object's own information.
#define VTK_IMAGE_STENCIL_DATA
Definition: vtkType.h:125
int GetDataObjectType() override
Returns VTK_IMAGE_STENCIL_DATA.
Store zero or more vtkInformation instances.
int ** ExtentLists
The actual 'data' is stored here.
general representation of visualization data
Definition: vtkDataObject.h:65
virtual void CopyInformationToPipeline(vtkInformation *vtkNotUsed(info))
Copy information from this data object to the pipeline information.
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
int * ExtentListLengths
The actual 'data' is stored here.