VTK: vtkImagePointIterator Class Reference

| VTK 9.3.1

Public Member Functions | Protected Attributes | List of all members
vtkImagePointIterator Class Reference

iterate over all data points in an image. More...

`#include <vtkImagePointIterator.h>`

Inheritance diagram for vtkImagePointIterator:
[legend]
Collaboration diagram for vtkImagePointIterator:
[legend]

## Public Member Functions
| vtkImagePointIterator ()
| Default constructor, its use must be followed by Initialize(). More...
| vtkImagePointIterator (vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
| Create an iterator for the given image, with several options. More...
void | Initialize (vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
| Initialize an iterator. More...
bool | IsAtEnd ()
| Test if the iterator has completed iterating over the entire extent. More...
double * | GetPosition ()
| Get the current position. More...
void | NextSpan ()
| Move the iterator to the beginning of the next span. More...
void | Next ()
| Move to the next position (rather than directly to the next span). More...
void | GetPosition (double x[3])
| Get the current position and place it in the provided array. More...
void | GetPosition (float x[3])
| Get the current position and place it in the provided array. More...
Public Member Functions inherited from vtkImagePointDataIterator
| vtkImagePointDataIterator ()
| Default constructor, its use must be followed by Initialize(). More...
| vtkImagePointDataIterator (vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
| Create an iterator for the given image, with several options. More...
void | Initialize (vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
| Initialize an iterator. More...
void | NextSpan ()
| Move the iterator to the beginning of the next span. More...
bool | IsAtEnd ()
| Test if the iterator has completed iterating over the entire extent. More...
bool | IsInStencil ()
| Check if the iterator is within the region specified by the stencil. More...
const int * | GetIndex ()
| Get the index at the beginning of the current span. More...
vtkIdType | GetId ()
| Get the point Id at the beginning of the current span. More...
vtkIdType | SpanEndId ()
| Get the end of the span. More...
void | GetIndex (int result[3])
| Get the index at the beginning of the current span. More...

## Protected Member Functions
void | UpdatePosition ()
| Helper method to update the position coordinate from the index. More...
Protected Member Functions inherited from vtkImagePointDataIterator
void | SetSpanState (int idX)
| Set all the state variables for the stencil span that includes idX. More...
void | ReportProgress ()
| Report the progress and do an abort check, for compatibility with existing image filters. More...

## Protected Attributes
double | Origin [3]
double | Spacing [3]
double | Position [3]
Protected Attributes inherited from vtkImagePointDataIterator
vtkIdType | Id
vtkIdType | SpanEnd
vtkIdType | RowEnd
vtkIdType | SliceEnd
vtkIdType | End
vtkIdType | RowIncrement
vtkIdType | SliceIncrement
vtkIdType | RowEndIncrement
vtkIdType | SliceEndIncrement
int | Extent [6]
int | Index [3]
int | StartY
bool | HasStencil
bool | InStencil
int | SpanSliceEndIncrement
int | SpanSliceIncrement
int | SpanIndex
int * | SpanCountPointer
int ** | SpanListPointer
vtkAlgorithm * | Algorithm
vtkIdType | Count
vtkIdType | Target
int | ThreadId

## Additional Inherited Members
Static Public Member Functions inherited from vtkImagePointDataIterator
static void * | GetVoidPointer (vtkImageData *image, vtkIdType i=0, int *pixelIncrement=nullptr)
| Get a void pointer and pixel increment for the given point Id. More...
static void * | GetVoidPointer (vtkDataArray *array, vtkIdType i=0, int *pixelIncrement=nullptr)
| Get a void pointer and pixel increment for the given point Id. More...

## Detailed Description

iterate over all data points in an image.

This class will iterate over an image. For each position, it provides the (x,y,z) position, the (I,J,K) index, and the point Id. If a stencil is provided, then it also reports, for each point, whether the point is inside the stencil.

The iterator can go through the image point-by-point or span-by-span. The Next() method advances to the next point, while the NextSpan() method skips to the beginning of the next span, where a span is defined as a start position and point count within an image row.

See also
  vtkImageData vtkImageStencilData vtkImageProgressIterator

Tests:
  vtkImagePointIterator (Tests)

Definition at line 28 of file vtkImagePointIterator.h.

## Constructor & Destructor Documentation

## ◆ vtkImagePointIterator() [1/2]

vtkImagePointIterator::vtkImagePointIterator | ( |  | ) |

Default constructor, its use must be followed by Initialize().

## ◆ vtkImagePointIterator() [2/2]

vtkImagePointIterator::vtkImagePointIterator | ( | vtkImageData * | image,
|  | const int | extent[6] = `nullptr`,
|  | vtkImageStencilData * | stencil = `nullptr`,
|  | vtkAlgorithm * | algorithm = `nullptr`,
|  | int | threadId = `0`
| ) |  |

Create an iterator for the given image, with several options.

If a stencil is provided, then the iterator's IsInStencil() method reports whether each span is inside the stencil. If an extent is provided, it iterates over the extent and ignores the rest of the image (the provided extent must be within the image extent). If a pointer to the algorithm is provided, then progress events will provided by the algorithm if threadId is zero.

## Member Function Documentation

## ◆ Initialize()

void vtkImagePointIterator::Initialize | ( | vtkImageData * | image,
|  | const int | extent[6] = `nullptr`,
|  | vtkImageStencilData * | stencil = `nullptr`,
|  | vtkAlgorithm * | algorithm = `nullptr`,
|  | int | threadId = `0`
| ) |  |

Initialize an iterator.

See constructor for more details.

## ◆ NextSpan()

void vtkImagePointIterator::NextSpan | ( |  | ) |
| inline

Move the iterator to the beginning of the next span.

A span is a contiguous region of the image over which nothing but the point Id and the X index changes.

Definition at line 60 of file vtkImagePointIterator.h.

## ◆ Next()

void vtkImagePointIterator::Next | ( |  | ) |
| inline

Move to the next position (rather than directly to the next span).

This will automatically advance to the next span if the end of the current span is reached.

Definition at line 73 of file vtkImagePointIterator.h.

## ◆ IsAtEnd()

bool vtkImagePointIterator::IsAtEnd | ( |  | ) |
| inline

Test if the iterator has completed iterating over the entire extent.

Definition at line 90 of file vtkImagePointIterator.h.

## ◆ GetPosition() [1/3]

double* vtkImagePointIterator::GetPosition | ( |  | ) |
| inline

Get the current position.

Definition at line 95 of file vtkImagePointIterator.h.

## ◆ GetPosition() [2/3]

void vtkImagePointIterator::GetPosition | ( | double | x[3] | ) |
| inline

Get the current position and place it in the provided array.

Definition at line 101 of file vtkImagePointIterator.h.

## ◆ GetPosition() [3/3]

void vtkImagePointIterator::GetPosition | ( | float | x[3] | ) |
| inline

Get the current position and place it in the provided array.

Definition at line 113 of file vtkImagePointIterator.h.

## ◆ UpdatePosition()

void vtkImagePointIterator::UpdatePosition | ( |  | ) |
| inlineprotected

Helper method to update the position coordinate from the index.

Definition at line 126 of file vtkImagePointIterator.h.

## Member Data Documentation

## ◆ Origin

double vtkImagePointIterator::Origin[3]
| protected

Definition at line 134 of file vtkImagePointIterator.h.

## ◆ Spacing

double vtkImagePointIterator::Spacing[3]
| protected

Definition at line 135 of file vtkImagePointIterator.h.

## ◆ Position

double vtkImagePointIterator::Position[3]
| protected

Definition at line 136 of file vtkImagePointIterator.h.

The documentation for this class was generated from the following file:

- Imaging/Core/vtkImagePointIterator.h