VTK
vtkImagePointIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImagePointIterator.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 vtkImagePointIterator_h
35 #define vtkImagePointIterator_h
36 
38 
39 class VTKIMAGINGCORE_EXPORT vtkImagePointIterator :
41 {
42 public:
47 
58  const int extent[6] = nullptr,
59  vtkImageStencilData *stencil=nullptr,
60  vtkAlgorithm *algorithm=nullptr,
61  int threadId=0);
62 
67  const int extent[6] = nullptr,
68  vtkImageStencilData *stencil=nullptr,
69  vtkAlgorithm *algorithm=nullptr,
70  int threadId=0);
71 
73 
78  void NextSpan()
79  {
81  this->UpdatePosition();
82  }
84 
86 
91  void Next()
92  {
93  if (++(this->Id) == this->SpanEnd)
94  {
95  this->NextSpan();
96  }
97  else
98  {
99  this->Index[0]++;
100  this->Position[0] = this->Origin[0] + this->Index[0]*this->Spacing[0];
101  }
102  }
104 
108  bool IsAtEnd()
109  {
110  return this->vtkImagePointDataIterator::IsAtEnd();
111  }
112 
117  {
118  return this->Position;
119  }
120 
122 
125  void GetPosition(double x[3])
126  {
127  x[0] = this->Position[0];
128  x[1] = this->Position[1];
129  x[2] = this->Position[2];
130  }
132 
134 
137  void GetPosition(float x[3])
138  {
139  x[0] = this->Position[0];
140  x[1] = this->Position[1];
141  x[2] = this->Position[2];
142  }
144 
145 protected:
146 
148 
152  {
153  this->Position[0] = this->Origin[0] + this->Index[0]*this->Spacing[0];
154  this->Position[1] = this->Origin[1] + this->Index[1]*this->Spacing[1];
155  this->Position[2] = this->Origin[2] + this->Index[2]*this->Spacing[2];
156  }
158 
159  double Origin[3];
160  double Spacing[3];
161  double Position[3];
162 };
163 
164 #endif
165 // VTK-HeaderTest-Exclude: vtkImagePointIterator.h
vtkImagePointIterator::UpdatePosition
void UpdatePosition()
Helper method to update the position coordinate from the index.
Definition: vtkImagePointIterator.h:151
vtkImagePointDataIterator
iterate over point data in an image.
Definition: vtkImagePointDataIterator.h:45
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:59
vtkX3D::image
Definition: vtkX3D.h:374
vtkImagePointDataIterator::IsAtEnd
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
Definition: vtkImagePointDataIterator.h:88
vtkImagePointDataIterator::NextSpan
void NextSpan()
Move the iterator to the beginning of the next span.
vtkImagePointIterator::NextSpan
void NextSpan()
Move the iterator to the beginning of the next span.
Definition: vtkImagePointIterator.h:78
vtkImagePointIterator::GetPosition
void GetPosition(double x[3])
Get the current position and place it in the provided array.
Definition: vtkImagePointIterator.h:125
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkImagePointIterator::Next
void Next()
Move to the next position (rather than directly to the next span).
Definition: vtkImagePointIterator.h:91
vtkImagePointIterator::GetPosition
double * GetPosition()
Get the current position.
Definition: vtkImagePointIterator.h:116
vtkImagePointIterator::GetPosition
void GetPosition(float x[3])
Get the current position and place it in the provided array.
Definition: vtkImagePointIterator.h:137
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkImagePointDataIterator::Initialize
void Initialize(vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
Initialize an iterator.
vtkImagePointIterator
iterate over all data points in an image.
Definition: vtkImagePointIterator.h:39
vtkImagePointDataIterator.h
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:37
vtkX3D::extent
Definition: vtkX3D.h:345
vtkImagePointIterator::IsAtEnd
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
Definition: vtkImagePointIterator.h:108