VTK  9.1.0
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
37class vtkDataArray;
38class vtkImageData;
40class vtkAlgorithm;
41
42class VTKIMAGINGCORE_EXPORT vtkImagePointDataIterator
43{
44public:
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
129protected:
133 void SetSpanState(int idX);
134
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];
160
161 // Stencil-related items
169
170 // Progress-related items
175};
176
177#endif
178// VTK-HeaderTest-Exclude: vtkImagePointDataIterator.h
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:114
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
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
@ extent
Definition: vtkX3D.h:351
@ image
Definition: vtkX3D.h:380
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)