VTK  9.3.1
vtkImageStencilData.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkImageStencilData_h
19 #define vtkImageStencilData_h
20 
21 #include "vtkDataObject.h"
22 #include "vtkImagingCoreModule.h" // For export macro
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class VTKIMAGINGCORE_EXPORT vtkImageStencilData : public vtkDataObject
26 {
27 public:
28  static vtkImageStencilData* New();
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
32  void Initialize() override;
33  void DeepCopy(vtkDataObject* o) override;
34  void ShallowCopy(vtkDataObject* f) override;
35  void InternalImageStencilDataCopy(vtkImageStencilData* s);
36 
40  int GetDataObjectType() override { return VTK_IMAGE_STENCIL_DATA; }
41 
45  int GetExtentType() override { return VTK_3D_EXTENT; }
46 
56  int GetNextExtent(int& r1, int& r2, int xMin, int xMax, int yIdx, int zIdx, int& iter);
57 
64  int IsInside(int xIdx, int yIdx, int zIdx);
65 
73  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
74 
83  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
84 
88  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
89 
91 
97  vtkSetVector3Macro(Spacing, double);
98  vtkGetVector3Macro(Spacing, double);
100 
102 
108  vtkSetVector3Macro(Origin, double);
109  vtkGetVector3Macro(Origin, double);
111 
113 
118  void SetExtent(const int extent[6]);
119  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
120  vtkGetVector6Macro(Extent, int);
122 
127  void AllocateExtents();
128 
132  void Fill();
133 
135 
142 
144 
148  static vtkImageStencilData* GetData(vtkInformationVector* v, int i = 0);
150 
154  virtual void Add(vtkImageStencilData*);
155 
160  virtual void Subtract(vtkImageStencilData*);
161 
166  virtual void Replace(vtkImageStencilData*);
167 
172  virtual int Clip(int extent[6]);
173 
174 protected:
176  ~vtkImageStencilData() override;
177 
179  {
181  Erase
182  };
183 
187  void LogicalOperationExtent(int r1, int r2, int yIdx, int zIdx, Operation operation);
188 
192  void LogicalOperationInPlace(vtkImageStencilData* stencil, Operation operation);
193 
199  void ChangeExtent(const int extent[6]);
200 
204  void CopyOriginAndSpacingFromPipeline(vtkInformation* info);
205 
207 
210  double Spacing[3];
211  double Origin[3];
213 
214  int Extent[6];
215 
217 
222  int** ExtentLists;
224 
225 private:
226  vtkImageStencilData(const vtkImageStencilData&) = delete;
227  void operator=(const vtkImageStencilData&) = delete;
228 
229  friend class vtkImageStencilIteratorFriendship;
230 };
231 
238 class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster
239 {
240 public:
244  vtkImageStencilRaster(const int wholeExtent[2]);
245 
250 
256  void PrepareForNewData(const int allocateExtent[2] = nullptr);
257 
259 
262  void InsertLine(const double pt1[2], const double pt2[2]);
264 
269  void FillStencilData(vtkImageStencilData* data, const int extent[6], int xj = 0, int yj = 1);
270 
274  void SetTolerance(double tol) { this->Tolerance = tol; }
275  double GetTolerance() { return this->Tolerance; }
276 
277 protected:
282  void PrepareExtent(int ymin, int ymax);
283 
289  void InsertPoint(int y, double x, int i);
290 
291  int Extent[2];
292  int UsedExtent[2];
293  double** Raster;
294  double Tolerance;
295 
296 private:
298  void operator=(const vtkImageStencilRaster&) = delete;
299 };
300 
301 VTK_ABI_NAMESPACE_END
302 #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:51
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:28
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:113
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:54
virtual void CopyInformationToPipeline(vtkInformation *vtkNotUsed(info))
Copy information from this data object to the pipeline information.
virtual void DeepCopy(vtkDataObject *src)
The goal of the method is to copy the complete data from src into this object.
virtual void ShallowCopy(vtkDataObject *src)
The goal of the method is to copy the data up to the array pointers only.
int * ExtentListLengths
The actual 'data' is stored here.