VTK  9.5.20250704
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
25VTK_ABI_NAMESPACE_BEGIN
26class VTKIMAGINGCORE_EXPORT VTK_MARSHALAUTO vtkImageStencilData : public vtkDataObject
27{
28public:
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;
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
129
133 void Fill();
134
136
143
145
151
155 virtual void Add(vtkImageStencilData*);
156
162
168
173 virtual int Clip(int extent[6]);
174
175protected:
178
180 {
182 Erase
183 };
184
188 void LogicalOperationExtent(int r1, int r2, int yIdx, int zIdx, Operation operation);
189
194
200 void ChangeExtent(const int extent[6]);
201
206
208
211 double Spacing[3];
212 double Origin[3];
214
215 int Extent[6];
216
218
225
226private:
228 void operator=(const vtkImageStencilData&) = delete;
229
230 friend class vtkImageStencilIteratorFriendship;
231};
232
239class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster
240{
241public:
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
278protected:
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
297private:
299 void operator=(const vtkImageStencilRaster&) = delete;
300};
301
302VTK_ABI_NAMESPACE_END
303#endif
RealT r2
Definition PyrC2Basis.h:20
general representation of visualization data
efficient description of an image stencil
void CopyInformationToPipeline(vtkInformation *info) override
Override these to handle origin, spacing, scalar type, and scalar number of components.
int NumberOfExtentEntries
The actual 'data' is stored here.
virtual int Clip(int extent[6])
Clip the stencil with the supplied extents.
void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx)
Similar to InsertNextExtent, except that the extent (r1,r2) at yIdx, zIdx is merged with other extent...
void Initialize() override
Restore data object to initial state,.
void DeepCopy(vtkDataObject *o) override
The goal of the method is to copy the complete data from src into this object.
void LogicalOperationInPlace(vtkImageStencilData *stencil, Operation operation)
Combine with the given stencil, using the given operation.
void InsertNextExtent(int r1, int r2, int yIdx, int zIdx)
This method is used by vtkImageStencilDataSource to add an x sub extent [r1,r2] for the x row (yIdx,...
~vtkImageStencilData() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkImageStencilData * New()
void Fill()
Fill the sub-extents.
void AllocateExtents()
Allocate space for the sub-extents.
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2)
Set the extent of the data.
void InternalImageStencilDataCopy(vtkImageStencilData *s)
int GetNextExtent(int &r1, int &r2, int xMin, int xMax, int yIdx, int zIdx, int &iter)
Given the total output x extent [xMin,xMax] and the current y, z indices, return each sub-extent [r1,...
static vtkImageStencilData * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
void CopyInformationFromPipeline(vtkInformation *info) override
Override these to handle origin, spacing, scalar type, and scalar number of components.
virtual void Add(vtkImageStencilData *)
Add merges the stencil supplied as argument into Self.
void RemoveExtent(int r1, int r2, int yIdx, int zIdx)
Remove the extent from (r1,r2) at yIdx, zIdx.
int IsInside(int xIdx, int yIdx, int zIdx)
Checks if an image index is inside the stencil.
int ** ExtentLists
The actual 'data' is stored here.
virtual void Subtract(vtkImageStencilData *)
Subtract removes the portion of the stencil, supplied as argument, that lies within Self from Self.
static vtkImageStencilData * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void LogicalOperationExtent(int r1, int r2, int yIdx, int zIdx, Operation operation)
Apply the given operation over the given (r1, r2) extent.
int * ExtentListLengths
The actual 'data' is stored here.
void CopyOriginAndSpacingFromPipeline(vtkInformation *info)
Get important info from pipeline.
void SetExtent(const int extent[6])
Set the extent of the data.
void ShallowCopy(vtkDataObject *f) override
The goal of the method is to copy the data up to the array pointers only.
int GetExtentType() VTK_FUTURE_CONST override
The extent type is 3D, just like vtkImageData.
void ChangeExtent(const int extent[6])
Change the extent while preserving the data.
int GetDataObjectType() VTK_FUTURE_CONST override
Returns VTK_IMAGE_STENCIL_DATA.
virtual void Replace(vtkImageStencilData *)
Replaces the portion of the stencil, supplied as argument, that lies within Self from Self.
This is a helper class for stencil creation.
void FillStencilData(vtkImageStencilData *data, const int extent[6], int xj=0, int yj=1)
Fill the specified extent of a vtkImageStencilData with the raster, after permuting the raster accord...
~vtkImageStencilRaster()
Destructor.
void SetTolerance(double tol)
The tolerance for float-to-int conversions.
void PrepareForNewData(const int allocateExtent[2]=nullptr)
Reset the raster to its original state, but keep the same whole extent.
void InsertLine(const double pt1[2], const double pt2[2])
Insert a line into the raster, given the two end points.
void PrepareExtent(int ymin, int ymax)
Ensure that the raster is initialized for the specified range of y values, which must be within the E...
vtkImageStencilRaster(const int wholeExtent[2])
Create a raster with the specified whole y extent.
void InsertPoint(int y, double x, int i)
Insert an x point into the raster.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
#define VTK_3D_EXTENT
@ VTK_IMAGE_STENCIL_DATA
Definition vtkType.h:129
#define VTK_MARSHALAUTO