VTK  9.2.6
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=========================================================================*/
34#ifndef vtkImagePointDataIterator_h
35#define vtkImagePointDataIterator_h
36
37#include "vtkImagingCoreModule.h" // for export macro
38#include "vtkSystemIncludes.h"
39
40class vtkDataArray;
41class vtkImageData;
43class vtkAlgorithm;
44
45class VTKIMAGINGCORE_EXPORT vtkImagePointDataIterator
46{
47public:
52
62 vtkImagePointDataIterator(vtkImageData* image, const int extent[6] = nullptr,
63 vtkImageStencilData* stencil = nullptr, vtkAlgorithm* algorithm = nullptr, int threadId = 0)
64 {
65 this->Initialize(image, extent, stencil, algorithm, threadId);
66 }
67
71 void Initialize(vtkImageData* image, const int extent[6] = nullptr,
72 vtkImageStencilData* stencil = nullptr, vtkAlgorithm* algorithm = nullptr, int threadId = 0);
73
79 void NextSpan();
80
84 bool IsAtEnd() { return (this->Id == this->End); }
85
90 bool IsInStencil() { return this->InStencil; }
91
93
96 void GetIndex(int result[3])
97 {
98 result[0] = this->Index[0];
99 result[1] = this->Index[1];
100 result[2] = this->Index[2];
101 }
103
107 const int* GetIndex() VTK_SIZEHINT(3) { return this->Index; }
108
112 vtkIdType GetId() { return this->Id; }
113
117 vtkIdType SpanEndId() { return this->SpanEnd; }
118
123 static void* GetVoidPointer(vtkImageData* image, vtkIdType i = 0, int* pixelIncrement = nullptr);
124
130 static void* GetVoidPointer(vtkDataArray* array, vtkIdType i = 0, int* pixelIncrement = nullptr);
131
132protected:
136 void SetSpanState(int idX);
137
144
145 vtkIdType Id; // the current point Id
146 vtkIdType SpanEnd; // end of current span
147 vtkIdType RowEnd; // end of current row
148 vtkIdType SliceEnd; // end of current slice
149 vtkIdType End; // end of data
150
151 // Increments
152 vtkIdType RowIncrement; // to same position in next row
153 vtkIdType SliceIncrement; // to same position in next slice
154 vtkIdType RowEndIncrement; // from end of row to start of next row
155 vtkIdType SliceEndIncrement; // from end of slice to start of next slice
156
157 // The extent, adjusted for the stencil
158 int Extent[6];
159
160 // Index-related items
161 int Index[3];
163
164 // Stencil-related items
172
173 // Progress-related items
178};
179
180#endif
181// VTK-HeaderTest-Exclude: vtkImagePointDataIterator.h
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:63
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
topologically and geometrically regular array of data
Definition: vtkImageData.h:54
iterate over point data in an image.
void NextSpan()
Move the iterator to the beginning of the next span.
static void * GetVoidPointer(vtkDataArray *array, vtkIdType i=0, int *pixelIncrement=nullptr)
Get a void pointer and pixel increment for the given point Id.
void ReportProgress()
Report the progress and do an abort check, for compatibility with existing image filters.
void SetSpanState(int idX)
Set all the state variables for the stencil span that includes idX.
vtkIdType GetId()
Get the point Id at the beginning of the current span.
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
static void * GetVoidPointer(vtkImageData *image, vtkIdType i=0, int *pixelIncrement=nullptr)
Get a void pointer and pixel increment for the given point Id.
bool IsInStencil()
Check if the iterator is within the region specified by the stencil.
vtkIdType SpanEndId()
Get the end of the span.
void Initialize(vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
Initialize an iterator.
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.
vtkImagePointDataIterator()
Default constructor, its use must be followed by Initialize().
const int * GetIndex()
Get the index at the beginning of the current span.
void GetIndex(int result[3])
Get the index at the beginning of the current span.
efficient description of an image stencil
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)