VTK  9.3.20240418
vtkImageIterator.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
66 #ifndef vtkImageIterator_h
67 #define vtkImageIterator_h
68 
69 #include "vtkCommonDataModelModule.h" // For export macro
70 #include "vtkSystemIncludes.h"
71 VTK_ABI_NAMESPACE_BEGIN
72 class vtkImageData;
73 
74 template <class DType>
75 class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator
76 {
77 public:
78  typedef DType* SpanIterator;
79 
85 
90 
94  void Initialize(vtkImageData* id, int* ext);
95 
99  void NextSpan();
100 
104  SpanIterator BeginSpan() { return this->Pointer; }
105 
109  SpanIterator EndSpan() { return this->SpanEndPointer; }
110 
114  vtkTypeBool IsAtEnd() { return (this->Pointer >= this->EndPointer); }
115 
116 protected:
117  DType* Pointer;
120  DType* EndPointer;
121  vtkIdType Increments[3];
122  vtkIdType ContinuousIncrements[3];
123 };
124 
125 #ifndef vtkImageIterator_cxx
126 #ifdef _MSC_VER
127 #pragma warning(push)
128 // The following is needed when the vtkImageIterator is declared
129 // dllexport and is used from another class in vtkCommonCore
130 #pragma warning(disable : 4910) // extern and dllexport incompatible
131 #endif
132 vtkExternTemplateMacro(extern template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator);
133 #ifdef _MSC_VER
134 #pragma warning(pop)
135 #endif
136 #endif
137 
138 VTK_ABI_NAMESPACE_END
139 #endif
140 // VTK-HeaderTest-Exclude: vtkImageIterator.h
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
a simple image iterator
void Initialize(vtkImageData *id, int *ext)
Initialize the image iterator for a given image data, and given extent.
vtkImageIterator(vtkImageData *id, int *ext)
Create an image iterator for a given image data and a given extent.
vtkImageIterator()
Default empty constructor, useful only when creating an array of iterators You need to call Initializ...
SpanIterator BeginSpan()
Return an iterator (pointer) for the span.
void NextSpan()
Move the iterator to the next span.
SpanIterator EndSpan()
Return an iterator (pointer) for the end of the span.
vtkTypeBool IsAtEnd()
Test if the end of the extent has been reached.
int vtkTypeBool
Definition: vtkABI.h:64
vtkExternTemplateMacro(extern template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator)
int vtkIdType
Definition: vtkType.h:315