VTK  9.0.1
vtkImagePointDataIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImagePointDataIterator.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 =========================================================================*/
31 #ifndef vtkImagePointDataIterator_h
32 #define vtkImagePointDataIterator_h
33 
34 #include "vtkImagingCoreModule.h" // for export macro
35 #include "vtkSystemIncludes.h"
36 
37 class vtkDataArray;
38 class vtkImageData;
40 class vtkAlgorithm;
41 
42 class VTKIMAGINGCORE_EXPORT vtkImagePointDataIterator
43 {
44 public:
49 
60  vtkImageStencilData* stencil = nullptr, vtkAlgorithm* algorithm = nullptr, int threadId = 0)
61  {
62  this->Initialize(image, extent, stencil, algorithm, threadId);
63  }
64 
68  void Initialize(vtkImageData* image, const int extent[6] = nullptr,
69  vtkImageStencilData* stencil = nullptr, vtkAlgorithm* algorithm = nullptr, int threadId = 0);
70 
76  void NextSpan();
77 
81  bool IsAtEnd() { return (this->Id == this->End); }
82 
87  bool IsInStencil() { return this->InStencil; }
88 
90 
93  void GetIndex(int result[3])
94  {
95  result[0] = this->Index[0];
96  result[1] = this->Index[1];
97  result[2] = this->Index[2];
98  }
100 
104  const int* GetIndex() VTK_SIZEHINT(3) { return this->Index; }
105 
109  vtkIdType GetId() { return this->Id; }
110 
114  vtkIdType SpanEndId() { return this->SpanEnd; }
115 
120  static void* GetVoidPointer(vtkImageData* image, vtkIdType i = 0, int* pixelIncrement = nullptr);
121 
127  static void* GetVoidPointer(vtkDataArray* array, vtkIdType i = 0, int* pixelIncrement = nullptr);
128 
129 protected:
133  void SetSpanState(int idX);
134 
140  void ReportProgress();
141 
142  vtkIdType Id; // the current point Id
143  vtkIdType SpanEnd; // end of current span
144  vtkIdType RowEnd; // end of current row
145  vtkIdType SliceEnd; // end of current slice
146  vtkIdType End; // end of data
147 
148  // Increments
149  vtkIdType RowIncrement; // to same position in next row
150  vtkIdType SliceIncrement; // to same position in next slice
151  vtkIdType RowEndIncrement; // from end of row to start of next row
152  vtkIdType SliceEndIncrement; // from end of slice to start of next slice
153 
154  // The extent, adjusted for the stencil
155  int Extent[6];
156 
157  // Index-related items
158  int Index[3];
159  int StartY;
160 
161  // Stencil-related items
163  bool InStencil;
169 
170  // Progress-related items
174  int ThreadId;
175 };
176 
177 #endif
178 // VTK-HeaderTest-Exclude: vtkImagePointDataIterator.h
vtkImagePointDataIterator::GetId
vtkIdType GetId()
Get the point Id at the beginning of the current span.
Definition: vtkImagePointDataIterator.h:109
vtkImagePointDataIterator::Count
vtkIdType Count
Definition: vtkImagePointDataIterator.h:172
vtkImagePointDataIterator::SpanListPointer
int ** SpanListPointer
Definition: vtkImagePointDataIterator.h:168
vtkImagePointDataIterator
iterate over point data in an image.
Definition: vtkImagePointDataIterator.h:42
vtkImagePointDataIterator::RowEnd
vtkIdType RowEnd
Definition: vtkImagePointDataIterator.h:144
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:62
vtkImagePointDataIterator::SliceIncrement
vtkIdType SliceIncrement
Definition: vtkImagePointDataIterator.h:150
vtkX3D::image
@ image
Definition: vtkX3D.h:380
vtkImagePointDataIterator::vtkImagePointDataIterator
vtkImagePointDataIterator(vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
Create an iterator for the given image, with several options.
Definition: vtkImagePointDataIterator.h:59
vtkImagePointDataIterator::RowEndIncrement
vtkIdType RowEndIncrement
Definition: vtkImagePointDataIterator.h:151
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkImagePointDataIterator::IsAtEnd
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
Definition: vtkImagePointDataIterator.h:81
vtkImagePointDataIterator::Target
vtkIdType Target
Definition: vtkImagePointDataIterator.h:173
vtkImagePointDataIterator::RowIncrement
vtkIdType RowIncrement
Definition: vtkImagePointDataIterator.h:149
vtkImagePointDataIterator::SliceEnd
vtkIdType SliceEnd
Definition: vtkImagePointDataIterator.h:145
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkImagePointDataIterator::Algorithm
vtkAlgorithm * Algorithm
Definition: vtkImagePointDataIterator.h:171
vtkImagePointDataIterator::SpanSliceIncrement
int SpanSliceIncrement
Definition: vtkImagePointDataIterator.h:165
vtkImagePointDataIterator::SpanEndId
vtkIdType SpanEndId()
Get the end of the span.
Definition: vtkImagePointDataIterator.h:114
vtkImagePointDataIterator::IsInStencil
bool IsInStencil()
Check if the iterator is within the region specified by the stencil.
Definition: vtkImagePointDataIterator.h:87
vtkImagePointDataIterator::GetIndex
const int * GetIndex()
Get the index at the beginning of the current span.
Definition: vtkImagePointDataIterator.h:104
vtkImagePointDataIterator::SliceEndIncrement
vtkIdType SliceEndIncrement
Definition: vtkImagePointDataIterator.h:152
vtkImagePointDataIterator::HasStencil
bool HasStencil
Definition: vtkImagePointDataIterator.h:162
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkImagePointDataIterator::SpanCountPointer
int * SpanCountPointer
Definition: vtkImagePointDataIterator.h:167
vtkImagePointDataIterator::InStencil
bool InStencil
Definition: vtkImagePointDataIterator.h:163
vtkImagePointDataIterator::SpanSliceEndIncrement
int SpanSliceEndIncrement
Definition: vtkImagePointDataIterator.h:164
vtkImagePointDataIterator::End
vtkIdType End
Definition: vtkImagePointDataIterator.h:146
vtkImagePointDataIterator::SpanEnd
vtkIdType SpanEnd
Definition: vtkImagePointDataIterator.h:143
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:33
vtkX3D::extent
@ extent
Definition: vtkX3D.h:351
vtkImagePointDataIterator::Id
vtkIdType Id
Definition: vtkImagePointDataIterator.h:142
vtkImagePointDataIterator::SpanIndex
int SpanIndex
Definition: vtkImagePointDataIterator.h:166
vtkImagePointDataIterator::ThreadId
int ThreadId
Definition: vtkImagePointDataIterator.h:174
vtkImagePointDataIterator::StartY
int StartY
Definition: vtkImagePointDataIterator.h:159
vtkSystemIncludes.h
vtkImagePointDataIterator::GetIndex
void GetIndex(int result[3])
Get the index at the beginning of the current span.
Definition: vtkImagePointDataIterator.h:93