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 =========================================================================*/
30 #ifndef vtkImageStencilData_h
31 #define vtkImageStencilData_h
32 
33 
34 #include "vtkImagingCoreModule.h" // For export macro
35 #include "vtkDataObject.h"
36 
37 class VTKIMAGINGCORE_EXPORT vtkImageStencilData : public vtkDataObject
38 {
39 public:
42  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
43 
44  void Initialize() VTK_OVERRIDE;
45  void DeepCopy(vtkDataObject *o) VTK_OVERRIDE;
46  void ShallowCopy(vtkDataObject *f) VTK_OVERRIDE;
47  void InternalImageStencilDataCopy(vtkImageStencilData *s);
48 
53  int GetDataObjectType() VTK_OVERRIDE { return VTK_DATA_OBJECT; }
54 
58  int GetExtentType() VTK_OVERRIDE { return VTK_3D_EXTENT; };
59 
69  int GetNextExtent(int &r1, int &r2, int xMin, int xMax,
70  int yIdx, int zIdx, int &iter);
71 
78  int IsInside(int xIdx, int yIdx, int zIdx);
79 
87  void InsertNextExtent(int r1, int r2, int yIdx, int zIdx);
88 
97  void InsertAndMergeExtent(int r1, int r2, int yIdx, int zIdx);
98 
102  void RemoveExtent(int r1, int r2, int yIdx, int zIdx);
103 
105 
111  vtkSetVector3Macro(Spacing, double);
112  vtkGetVector3Macro(Spacing, double);
114 
116 
122  vtkSetVector3Macro(Origin, double);
123  vtkGetVector3Macro(Origin, double);
125 
127 
132  void SetExtent(int extent[6]);
133  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
134  vtkGetVector6Macro(Extent, int);
136 
142 
146  void Fill();
147 
149 
153  virtual void CopyInformationFromPipeline(vtkInformation *info) VTK_OVERRIDE;
154  virtual void CopyInformationToPipeline(vtkInformation *info) VTK_OVERRIDE;
156 
158 
164 
168  virtual void Add(vtkImageStencilData *);
169 
174  virtual void Subtract(vtkImageStencilData *);
175 
180  virtual void Replace(vtkImageStencilData *);
181 
186  virtual int Clip(int extent[6]);
187 
188 protected:
191 
192  enum Operation { Merge, Erase };
193 
198  int r1, int r2, int yIdx, int zIdx, Operation operation);
199 
204  vtkImageStencilData *stencil, Operation operation);
205 
211  void ChangeExtent(const int extent[6]);
212 
217 
219 
222  double Spacing[3];
223  double Origin[3];
225 
226  int Extent[6];
227 
229 
234  int **ExtentLists;
236 
237 private:
238  vtkImageStencilData(const vtkImageStencilData&) VTK_DELETE_FUNCTION;
239  void operator=(const vtkImageStencilData&) VTK_DELETE_FUNCTION;
240 
241  friend class vtkImageStencilIteratorFriendship;
242 };
243 
250 class VTKIMAGINGCORE_EXPORT vtkImageStencilRaster
251 {
252 public:
256  vtkImageStencilRaster(const int wholeExtent[2]);
257 
262 
268  void PrepareForNewData(const int allocateExtent[2] = 0);
269 
271 
274  void InsertLine(const double p1[2], const double p2[2]);
275  VTK_LEGACY(void InsertLine(const double[2], const double[2], bool, bool));
277 
283  int xj = 0, int yj = 1);
284 
288  void SetTolerance(double tol) { this->Tolerance = tol; }
289  double GetTolerance() { return this->Tolerance; }
290 
291 protected:
296  void PrepareExtent(int ymin, int ymax);
297 
303  void InsertPoint(int y, double x, int i);
304 
305  int Extent[2];
306  int UsedExtent[2];
307  double **Raster;
308  double Tolerance;
309 
310 private:
311  vtkImageStencilRaster(const vtkImageStencilRaster&) VTK_DELETE_FUNCTION;
312  void operator=(const vtkImageStencilRaster&) VTK_DELETE_FUNCTION;
313 };
314 
315 #endif
316 
317 
318 
vtkpiston::DeepCopy
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkImageStencilData::ExtentListLengths
int * ExtentListLengths
Definition: vtkImageStencilData.h:233
vtkImageStencilData::GetData
static vtkImageStencilData * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkImageStencilData::SetExtent
void SetExtent(int extent[6])
Set the extent of the data.
VTK_DATA_OBJECT
#define VTK_DATA_OBJECT
Definition: vtkType.h:94
vtkImageStencilData::Subtract
virtual void Subtract(vtkImageStencilData *)
Subtract removes the portion of the stencil, supplied as argument, that lies within Self from Self.
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkImageStencilData::vtkImageStencilData
vtkImageStencilData()
vtkImageStencilData::NumberOfExtentEntries
int NumberOfExtentEntries
The actual 'data' is stored here.
Definition: vtkImageStencilData.h:232
vtkImageStencilData::CopyOriginAndSpacingFromPipeline
void CopyOriginAndSpacingFromPipeline(vtkInformation *info)
Get important info from pipeline.
vtkImageStencilData::IsInside
int IsInside(int xIdx, int yIdx, int zIdx)
Checks if an image index is inside the stencil.
vtkImageStencilRaster::SetTolerance
void SetTolerance(double tol)
The tolerance for float-to-int conversions.
Definition: vtkImageStencilData.h:288
vtkImageStencilData::GetNextExtent
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,...
vtkImageStencilData::InsertAndMergeExtent
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...
vtkImageStencilData::Replace
virtual void Replace(vtkImageStencilData *)
Replaces the portion of the stencil, supplied as argument, that lies within Self from Self.
vtkImageStencilData::CopyInformationToPipeline
virtual void CopyInformationToPipeline(vtkInformation *info) override
vtkImageStencilRaster::InsertLine
void InsertLine(const double[2], const double[2], bool, bool)
vtkImageStencilRaster::PrepareExtent
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...
vtkImageStencilData::New
static vtkImageStencilData * New()
vtkImageStencilData::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageStencilRaster
This is a helper class for stencil creation.
Definition: vtkImageStencilData.h:251
vtkImageStencilData::GetExtentType
int GetExtentType() override
The extent type is 3D, just like vtkImageData.
Definition: vtkImageStencilData.h:58
VTK_3D_EXTENT
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
vtkImageStencilRaster::Tolerance
double Tolerance
Definition: vtkImageStencilData.h:308
vtkImageStencilRaster::~vtkImageStencilRaster
~vtkImageStencilRaster()
Destructor.
vtkImageStencilData::GetData
static vtkImageStencilData * GetData(vtkInformationVector *v, int i=0)
vtkImageStencilData::LogicalOperationExtent
void LogicalOperationExtent(int r1, int r2, int yIdx, int zIdx, Operation operation)
Apply the given operation over the given (r1, r2) extent.
vtkImageStencilData::SetExtent
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2)
vtkImageStencilData::InsertNextExtent
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,...
vtkImageStencilRaster::InsertPoint
void InsertPoint(int y, double x, int i)
Insert an x point into the raster.
vtkImageStencilData::ExtentLists
int ** ExtentLists
Definition: vtkImageStencilData.h:234
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkImageStencilData::Operation
Operation
Definition: vtkImageStencilData.h:192
vtkImageStencilRaster::vtkImageStencilRaster
vtkImageStencilRaster(const int wholeExtent[2])
Create a raster with the specified whole y extent.
vtkImageStencilData::LogicalOperationInPlace
void LogicalOperationInPlace(vtkImageStencilData *stencil, Operation operation)
Combine with the given stencil, using the given operation.
vtkImageStencilData::Add
virtual void Add(vtkImageStencilData *)
Add merges the stencil supplied as argument into Self.
vtkImageStencilData::Initialize
void Initialize() override
Restore data object to initial state,.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkImageStencilRaster::Raster
double ** Raster
Definition: vtkImageStencilData.h:307
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkImageStencilRaster::InsertLine
void InsertLine(const double p1[2], const double p2[2])
Insert a line into the raster, given the two end points.
vtkImageStencilData::RemoveExtent
void RemoveExtent(int r1, int r2, int yIdx, int zIdx)
Remove the extent from (r1,r2) at yIdx, zIdx.
vtkImageStencilData::CopyInformationFromPipeline
virtual void CopyInformationFromPipeline(vtkInformation *info) override
Override these to handle origin, spacing, scalar type, and scalar number of components.
vtkDataObject.h
vtkImageStencilData::~vtkImageStencilData
~vtkImageStencilData()
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:38
vtkImageStencilRaster::GetTolerance
double GetTolerance()
Definition: vtkImageStencilData.h:289
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkImageStencilData::AllocateExtents
void AllocateExtents()
Allocate space for the sub-extents.
vtkImageStencilData::ChangeExtent
void ChangeExtent(const int extent[6])
Change the extent while preserving the data.
vtkImageStencilData::Fill
void Fill()
Fill the sub-extents.
vtkImageStencilRaster::FillStencilData
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::PrepareForNewData
void PrepareForNewData(const int allocateExtent[2]=0)
Reset the raster to its original state, but keep the same whole extent.
vtkImageStencilData::Clip
virtual int Clip(int extent[6])
Clip the stencil with the supplied extents.