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 =========================================================================*/
31 #ifndef vtkImagePointIterator_h
32 #define vtkImagePointIterator_h
33 
35 
36 class VTKIMAGINGCORE_EXPORT vtkImagePointIterator :
38 {
39 public:
44 
55  const int extent[6] = nullptr,
56  vtkImageStencilData *stencil=nullptr,
57  vtkAlgorithm *algorithm=nullptr,
58  int threadId=0);
59 
64  const int extent[6] = nullptr,
65  vtkImageStencilData *stencil=nullptr,
66  vtkAlgorithm *algorithm=nullptr,
67  int threadId=0);
68 
70 
75  void NextSpan()
76  {
78  this->UpdatePosition();
79  }
81 
83 
88  void Next()
89  {
90  if (++(this->Id) == this->SpanEnd)
91  {
92  this->NextSpan();
93  }
94  else
95  {
96  this->Index[0]++;
97  this->Position[0] = this->Origin[0] + this->Index[0]*this->Spacing[0];
98  }
99  }
101 
105  bool IsAtEnd()
106  {
107  return this->vtkImagePointDataIterator::IsAtEnd();
108  }
109 
114  {
115  return this->Position;
116  }
117 
119 
122  void GetPosition(double x[3])
123  {
124  x[0] = this->Position[0];
125  x[1] = this->Position[1];
126  x[2] = this->Position[2];
127  }
129 
131 
134  void GetPosition(float x[3])
135  {
136  x[0] = this->Position[0];
137  x[1] = this->Position[1];
138  x[2] = this->Position[2];
139  }
141 
142 protected:
143 
145 
149  {
150  this->Position[0] = this->Origin[0] + this->Index[0]*this->Spacing[0];
151  this->Position[1] = this->Origin[1] + this->Index[1]*this->Spacing[1];
152  this->Position[2] = this->Origin[2] + this->Index[2]*this->Spacing[2];
153  }
155 
156  double Origin[3];
157  double Spacing[3];
158  double Position[3];
159 };
160 
161 #endif
162 // VTK-HeaderTest-Exclude: vtkImagePointIterator.h
vtkImagePointIterator::UpdatePosition
void UpdatePosition()
Helper method to update the position coordinate from the index.
Definition: vtkImagePointIterator.h:148
vtkImagePointDataIterator
iterate over point data in an image.
Definition: vtkImagePointDataIterator.h:42
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
vtkX3D::image
Definition: vtkX3D.h:374
vtkImagePointDataIterator::IsAtEnd
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
Definition: vtkImagePointDataIterator.h:85
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:75
vtkImagePointIterator::GetPosition
void GetPosition(double x[3])
Get the current position and place it in the provided array.
Definition: vtkImagePointIterator.h:122
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:88
vtkImagePointIterator::GetPosition
double * GetPosition()
Get the current position.
Definition: vtkImagePointIterator.h:113
vtkImagePointIterator::GetPosition
void GetPosition(float x[3])
Get the current position and place it in the provided array.
Definition: vtkImagePointIterator.h:134
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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:36
vtkImagePointDataIterator.h
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:34
vtkX3D::extent
Definition: vtkX3D.h:345
vtkImagePointIterator::IsAtEnd
bool IsAtEnd()
Test if the iterator has completed iterating over the entire extent.
Definition: vtkImagePointIterator.h:105