VTK
vtkImageStencilIterator.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImageStencilIterator.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=========================================================================*/
29#ifndef vtkImageStencilIterator_h
30#define vtkImageStencilIterator_h
31
33
34template<class DType>
35class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator :
37{
38public:
40
44 {
45 this->Increment = 0;
46 this->BasePointer = 0;
47 this->Pointer = 0;
48 this->SpanEndPointer = 0;
49 }
51
53
63 vtkImageStencilData *stencil=0,
64 const int extent[6] = 0,
65 vtkAlgorithm *algorithm=0,
66 int threadId=0)
67 : vtkImagePointDataIterator(image, extent, stencil, algorithm, threadId)
68 {
69 this->BasePointer = static_cast<DType *>(
71 this->UpdatePointer();
72 }
74
76
80 vtkImageStencilData *stencil=0,
81 const int extent[6] = 0,
82 vtkAlgorithm *algorithm=0,
83 int threadId=0)
84 {
86 image, extent, stencil, algorithm, threadId);
87 this->BasePointer = static_cast<DType *>(
89 this->UpdatePointer();
90 }
92
94
99 void NextSpan()
100 {
102 this->UpdatePointer();
103 }
105
109 bool IsAtEnd()
110 {
112 }
113
117 DType *BeginSpan()
118 {
119 return this->Pointer;
120 }
121
125 DType *EndSpan()
126 {
127 return this->SpanEndPointer;
128 }
129
130protected:
131
133
137 {
138 this->Pointer = this->BasePointer + this->Id*this->Increment;
139 this->SpanEndPointer = this->BasePointer + this->SpanEnd*this->Increment;
140 }
142
143 // The pointer must be incremented by this amount for each pixel.
145
146 // Pointers
147 DType *BasePointer; // pointer to the first voxel
148 DType *Pointer; // current iterator position within data
149 DType *SpanEndPointer; // end of current span
150};
151
152#ifndef vtkImageStencilIterator_cxx
153#ifdef _MSC_VER
154#pragma warning (push)
155// The following is needed when the vtkImageStencilIterator template
156// class is declared dllexport and is used within vtkImagingCore
157#pragma warning (disable: 4910) // extern and dllexport incompatible
158#endif
160 extern template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator
161)
162#ifdef _MSC_VER
163#pragma warning (pop)
164#endif
165#endif
166
167#endif
168// VTK-HeaderTest-Exclude: vtkImageStencilIterator.h
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:60
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
iterate over point data in an image.
void NextSpan()
Move the iterator to the beginning of the next span.
static void * GetVoidPointer(vtkImageData *image, vtkIdType i=0, int *pixelIncrement=0)
Get a void pointer and pixel increment for the given point Id.
void Initialize(vtkImageData *image, const int extent[6]=0, vtkImageStencilData *stencil=0, vtkAlgorithm *algorithm=0, int threadId=0)
Initialize an iterator.
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
efficient description of an image stencil
an image region iterator
DType * BeginSpan()
Return a pointer to the beginning of the current span.
void NextSpan()
Move the iterator to the beginning of the next span.
void Initialize(vtkImageData *image, vtkImageStencilData *stencil=0, const int extent[6]=0, vtkAlgorithm *algorithm=0, int threadId=0)
Initialize an iterator.
void UpdatePointer()
Update the pointer (called automatically when a new span begins).
vtkImageStencilIterator(vtkImageData *image, vtkImageStencilData *stencil=0, const int extent[6]=0, vtkAlgorithm *algorithm=0, int threadId=0)
Create an iterator for the given image, with several options.
DType * EndSpan()
Return a pointer to the end of the current span.
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
vtkImageStencilIterator()
Default constructor, its use must be followed by Initialize().
@ extent
Definition: vtkX3D.h:345
@ image
Definition: vtkX3D.h:374
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition: vtkType.h:345