VTK  9.4.20250131
vtkImagePointDataIterator.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
22#ifndef vtkImagePointDataIterator_h
23#define vtkImagePointDataIterator_h
24
25#include "vtkImagingCoreModule.h" // for export macro
26#include "vtkSystemIncludes.h"
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkDataArray;
30class vtkImageData;
32class vtkAlgorithm;
33
34class VTKIMAGINGCORE_EXPORT vtkImagePointDataIterator
35{
36public:
41
51 vtkImagePointDataIterator(vtkImageData* image, const int extent[6] = nullptr,
52 vtkImageStencilData* stencil = nullptr, vtkAlgorithm* algorithm = nullptr, int threadId = 0)
53 {
54 this->Initialize(image, extent, stencil, algorithm, threadId);
55 }
56
60 void Initialize(vtkImageData* image, const int extent[6] = nullptr,
61 vtkImageStencilData* stencil = nullptr, vtkAlgorithm* algorithm = nullptr, int threadId = 0);
62
68 void NextSpan();
69
73 bool IsAtEnd() { return (this->Id == this->End); }
74
79 bool IsInStencil() { return this->InStencil; }
80
82
85 void GetIndex(int result[3])
86 {
87 result[0] = this->Index[0];
88 result[1] = this->Index[1];
89 result[2] = this->Index[2];
90 }
92
96 const int* GetIndex() VTK_SIZEHINT(3) { return this->Index; }
97
101 vtkIdType GetId() { return this->Id; }
102
106 vtkIdType SpanEndId() { return this->SpanEnd; }
107
112 static void* GetVoidPointer(vtkImageData* image, vtkIdType i = 0, int* pixelIncrement = nullptr);
113
119 static void* GetVoidPointer(vtkDataArray* array, vtkIdType i = 0, int* pixelIncrement = nullptr);
120
121protected:
125 void SetSpanState(int idX);
126
133
134 vtkIdType Id; // the current point Id
135 vtkIdType SpanEnd; // end of current span
136 vtkIdType RowEnd; // end of current row
137 vtkIdType SliceEnd; // end of current slice
138 vtkIdType End; // end of data
139
140 // Increments
141 vtkIdType RowIncrement; // to same position in next row
142 vtkIdType SliceIncrement; // to same position in next slice
143 vtkIdType RowEndIncrement; // from end of row to start of next row
144 vtkIdType SliceEndIncrement; // from end of slice to start of next slice
145
146 // The extent, adjusted for the stencil
147 int Extent[6];
148
149 // Index-related items
150 int Index[3];
152
153 // Stencil-related items
161
162 // Progress-related items
167};
168
169VTK_ABI_NAMESPACE_END
170#endif
171// VTK-HeaderTest-Exclude: vtkImagePointDataIterator.h
Superclass for all sources, filters, and sinks in VTK.
abstract superclass for arrays of numeric data
topologically and geometrically regular array of data
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:315
#define VTK_SIZEHINT(...)