VTK  9.7.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 #include "vtkWrappingHints.h"
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class VTKIMAGINGCORE_EXPORT VTK_MARSHALAUTO vtkImageStencilData : public vtkDataObject
27 {
28 public:
29  static vtkImageStencilData* New();
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
33  void Initialize() override;
34  void DeepCopy(vtkDataObject* o) override;
35  void ShallowCopy(vtkDataObject* f) override;
36  void InternalImageStencilDataCopy(vtkImageStencilData* s);
37 
41  int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_IMAGE_STENCIL_DATA; }
42 
46  int GetExtentType() VTK_FUTURE_CONST override { return VTK_3D_EXTENT; }
47 
57  int GetNextExtent(int& r1, int& r2, int xMin, int xMax, int yIdx, int zIdx, int& iter);
58 
65  int IsInside(int xIdx, int yIdx, int zIdx);
66 
74  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
75 
84  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
85 
89  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
90 
92 
98  vtkSetVector3Macro(Spacing, double);
99  vtkGetVector3Macro(Spacing, double);
101 
103 
109  vtkSetVector3Macro(Origin, double);
110  vtkGetVector3Macro(Origin, double);
112 
114 
119  void SetExtent(const int extent[6]);
120  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
121  vtkGetVector6Macro(Extent, int);
123 
128  void AllocateExtents();
129 
133  void Fill();
134 
136 
143 
145 
149  static vtkImageStencilData* GetData(vtkInformationVector* v, int i = 0);
151 
155  virtual void Add(vtkImageStencilData*);
156 
161  virtual void Subtract(vtkImageStencilData*);
162 
167  virtual void Replace(vtkImageStencilData*);
168 
173  virtual int Clip(int extent[6]);
174 
175 protected:
177  ~vtkImageStencilData() override;
178 
180  {
182  Erase
183  };
184 
188  void LogicalOperationExtent(int r1, int r2, int yIdx, int zIdx, Operation operation);
189 
193  void LogicalOperationInPlace(vtkImageStencilData* stencil, Operation operation);
194 
200  void ChangeExtent(const int extent[6]);
201 
205  void CopyOriginAndSpacingFromPipeline(vtkInformation* info);
206 
208 
211  double Spacing[3];
212  double Origin[3];
214 
215  int Extent[6];
216 
218 
223  int** ExtentLists;
225 
226 private:
227  vtkImageStencilData(const vtkImageStencilData&) = delete;
228  void operator=(const vtkImageStencilData&) = delete;
229 
230  friend class vtkImageStencilIteratorFriendship;
231 };
232 
239 class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster
240 {
241 public:
245  vtkImageStencilRaster(const int wholeExtent[2]);
246 
251 
257  void PrepareForNewData(const int allocateExtent[2] = nullptr);
258 
260 
263  void InsertLine(const double pt1[2], const double pt2[2]);
265 
270  void FillStencilData(vtkImageStencilData* data, const int extent[6], int xj = 0, int yj = 1);
271 
275  void SetTolerance(double tol) { this->Tolerance = tol; }
276  double GetTolerance() { return this->Tolerance; }
277 
278 protected:
283  void PrepareExtent(int ymin, int ymax);
284 
290  void InsertPoint(int y, double x, int i);
291 
292  int Extent[2];
293  int UsedExtent[2];
294  double** Raster;
295  double Tolerance;
296 
297 private:
299  void operator=(const vtkImageStencilRaster&) = delete;
300 };
301 
302 VTK_ABI_NAMESPACE_END
303 #endif
RealT r2
Definition: PyrC2Basis.h:20
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.
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
This is a helper class for stencil creation.
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:52
virtual void CopyInformationFromPipeline(vtkInformation *info)
Copy from the pipeline information to the data object's own information.
virtual void Initialize()
Restore data object to initial state,.
int NumberOfExtentEntries
The actual 'data' is stored here.
int GetExtentType() VTK_FUTURE_CONST override
The extent type is 3D, just like vtkImageData.
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
int GetDataObjectType() VTK_FUTURE_CONST override
Returns VTK_IMAGE_STENCIL_DATA.
virtual void CopyInformationToPipeline(vtkInformation *info)
Copy information from this data object to the pipeline information.
Store zero or more vtkInformation instances.
int ** ExtentLists
The actual 'data' is stored here.
#define VTK_MARSHALAUTO
general representation of visualization data
Definition: vtkDataObject.h:55
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.