VTK  9.1.0
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().
 
 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.
 
void Initialize (vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
 Initialize an iterator.
 
bool IsAtEnd ()
 Test if the iterator has completed iterating over the entire extent.
 
double * GetPosition ()
 Get the current position.
 
void NextSpan ()
 Move the iterator to the beginning of the next span.
 
void Next ()
 Move to the next position (rather than directly to the next span).
 
void GetPosition (double x[3])
 Get the current position and place it in the provided array.
 
void GetPosition (float x[3])
 Get the current position and place it in the provided array.
 
- Public Member Functions inherited from vtkImagePointDataIterator
 vtkImagePointDataIterator ()
 Default constructor, its use must be followed by Initialize().
 
 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.
 
void Initialize (vtkImageData *image, const int extent[6]=nullptr, vtkImageStencilData *stencil=nullptr, vtkAlgorithm *algorithm=nullptr, int threadId=0)
 Initialize an iterator.
 
void NextSpan ()
 Move the iterator to the beginning of the next 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.
 
const int * GetIndex ()
 Get the index at the beginning of the current span.
 
vtkIdType GetId ()
 Get the point Id at the beginning of the current span.
 
vtkIdType SpanEndId ()
 Get the end of the span.
 
void GetIndex (int result[3])
 Get the index at the beginning of the current span.
 

Protected Member Functions

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

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
 
vtkAlgorithmAlgorithm
 
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.
 
static void * GetVoidPointer (vtkDataArray *array, vtkIdType i=0, int *pixelIncrement=nullptr)
 Get a void pointer and pixel increment for the given point Id.
 

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

Definition at line 36 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 68 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 81 of file vtkImagePointIterator.h.

◆ IsAtEnd()

bool vtkImagePointIterator::IsAtEnd ( )
inline

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

Definition at line 98 of file vtkImagePointIterator.h.

◆ GetPosition() [1/3]

double * vtkImagePointIterator::GetPosition ( )
inline

Get the current position.

Definition at line 103 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 109 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 121 of file vtkImagePointIterator.h.

◆ UpdatePosition()

void vtkImagePointIterator::UpdatePosition ( )
inlineprotected

Helper method to update the position coordinate from the index.

Definition at line 134 of file vtkImagePointIterator.h.

Member Data Documentation

◆ Origin

double vtkImagePointIterator::Origin[3]
protected

Definition at line 142 of file vtkImagePointIterator.h.

◆ Spacing

double vtkImagePointIterator::Spacing[3]
protected

Definition at line 143 of file vtkImagePointIterator.h.

◆ Position

double vtkImagePointIterator::Position[3]
protected

Definition at line 144 of file vtkImagePointIterator.h.


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