VTK
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 "vtkSystemIncludes.h"
38 #include "vtkImagingCoreModule.h" // for export macro
39 
40 class vtkDataArray;
41 class vtkImageData;
43 class vtkAlgorithm;
44 
45 class VTKIMAGINGCORE_EXPORT vtkImagePointDataIterator
46 {
47 public:
52 
63  const int extent[6] = 0,
64  vtkImageStencilData *stencil=0,
65  vtkAlgorithm *algorithm=0,
66  int threadId=0)
67  {
68  this->Initialize(image, extent, stencil, algorithm, threadId);
69  }
70 
74  void Initialize(vtkImageData *image, const int extent[6] = 0,
75  vtkImageStencilData *stencil=0,
76  vtkAlgorithm *algorithm=0, int threadId=0);
77 
83  void NextSpan();
84 
88  bool IsAtEnd()
89  {
90  return (this->Id == this->End);
91  }
92 
97  bool IsInStencil()
98  {
99  return this->InStencil;
100  }
101 
103 
106  void GetIndex(int result[3])
107  {
108  result[0] = this->Index[0];
109  result[1] = this->Index[1];
110  result[2] = this->Index[2];
111  }
113 
117  const int *GetIndex()
118  {
119  return this->Index;
120  }
121 
126  {
127  return this->Id;
128  }
129 
134  {
135  return this->SpanEnd;
136  }
137 
143  vtkIdType i=0,
144  int *pixelIncrement=0);
145 
151  static void *GetVoidPointer(vtkDataArray *array,
152  vtkIdType i=0,
153  int *pixelIncrement=0);
154 
155 protected:
156 
160  void SetSpanState(int idX);
161 
168 
169  vtkIdType Id; // the current point Id
170  vtkIdType SpanEnd; // end of current span
171  vtkIdType RowEnd; // end of current row
172  vtkIdType SliceEnd; // end of current slice
173  vtkIdType End; // end of data
174 
175  // Increments
176  vtkIdType RowIncrement; // to same position in next row
177  vtkIdType SliceIncrement; // to same position in next slice
178  vtkIdType RowEndIncrement; // from end of row to start of next row
179  vtkIdType SliceEndIncrement; // from end of slice to start of next slice
180 
181  // The extent, adjusted for the stencil
182  int Extent[6];
183 
184  // Index-related items
185  int Index[3];
186  int StartY;
187 
188  // Stencil-related items
190  bool InStencil;
196 
197  // Progress-related items
201  int ThreadId;
202 };
203 
204 #endif
205 // VTK-HeaderTest-Exclude: vtkImagePointDataIterator.h
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:60
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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.
vtkImagePointDataIterator(vtkImageData *image, const int extent[6]=0, vtkImageStencilData *stencil=0, vtkAlgorithm *algorithm=0, int threadId=0)
Create an iterator for the given image, with several options.
void Initialize(vtkImageData *image, const int extent[6]=0, vtkImageStencilData *stencil=0, vtkAlgorithm *algorithm=0, int threadId=0)
Initialize an iterator.
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.
const int * GetIndex()
Get the index at the beginning of the current span.
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
bool IsInStencil()
Check if the iterator is within the region specified by the stencil.
vtkIdType SpanEndId()
Get the end of the span.
static void * GetVoidPointer(vtkDataArray *array, vtkIdType i=0, int *pixelIncrement=0)
Get a void pointer and pixel increment for the given point Id.
vtkImagePointDataIterator()
Default constructor, its use must be followed by Initialize().
void GetIndex(int result[3])
Get the index at the beginning of the current span.
static void * GetVoidPointer(vtkImageData *image, vtkIdType i=0, int *pixelIncrement=0)
Get a void pointer and pixel increment for the given point Id.
efficient description of an image stencil
@ extent
Definition: vtkX3D.h:345
@ image
Definition: vtkX3D.h:374
int vtkIdType
Definition: vtkType.h:287