NPL
Neurological Programs and Libraries
Iterators for NDarray/Image

Classes

class  npl::FlatIter< T >
 Flat iterator for NDArray. No information is kept about the current ND index. Just goes through all data. This casts the output to the type specified using T. More...
 
class  npl::FlatConstIter< T >
 Flat iterator iterator for NDArray. No information is kept about the current index. Just goes through all data. This casts the output to the type specified using T. More...
 
class  npl::NDConstIter< T >
 Constant iterator for NDArray. Typical usage calls for NDConstIter it(array); it++; *it. More...
 
class  npl::NDIter< T >
 This class is used to iterate through an N-Dimensional array. More...
 
class  npl::ChunkConstIter< T >
 Constant iterator for NDArray. This is slightly different from order iterator in that the ROI may be broken down into chunks. When the end of a chunk is reached, no more iteration can be performed until nextChunk() is called. isEnd() will return false until nextChunk() is called while the current chunk is at the last available. Note that if setBreaks uses an array that is smaller than input dimension, then the whole of the dimension will be used. More...
 
class  npl::ChunkIter< T >
 This class is used to iterate through an N-Dimensional array. More...
 
class  npl::KernelIter< T >
 Iterator for an image, that allows for easy access to the neighbors of the current element/pixel. Neighbors can be accessed through offset(i) which simply provides the value of the i'th neighbor. To get that neighbors index you can use it.offset_index(i). For the center use it.center()/it.center_index(). [] may also be used in place of offset. To get the number of neighbors in the kernel use ksize(), so it.offset(0), it.offset(1), ..., it.offset(ksize()-1) are valid calls. More...
 
class  npl::Vector3DIter< T >
 This class is used to iterate through an 3D array, where each point then has has multiple higher dimensional variable. This is analogous to Vector3DView, where even if there are multiple higher dimensions they are all alligned into a single vector at each 3D point. This makes them easier to than simple iteration in N-dimensions. More...
 
class  npl::Vector3DConstIter< T >
 This class is used to iterate through an 3D array, where each point then has has multiple higher dimensional variable. This is analogous to Vector3DView, where even if there are multiple higher dimensions they are all alligned into a single vector at each 3D point. This makes them easier to than simple iteration in N-dimensions. This is the constant version. More...
 

Typedefs

template<class T >
using npl::OrderIter = NDIter< T >
 To maintain backward compatability, I have saved the OrderIter and OrderConstIter name, but eventually they may be deprecated. More...
 
template<class T >
using npl::OrderConstIter = NDConstIter< T >
 To maintain backward compatability, I have saved the OrderIter and OrderConstIter name, but eventually they may be deprecated. More...
 

Detailed Description

Iterators are similar to accessors in that they perform casting, however they also advance through pixels. Thus they are designed to walk over the image or array space.

A simple example:

double sum = 0;
for(FlatIter<double> it(img); !it.isEnd(); ++it) {
sum += *it;
}

FlatIter doesn't maintain an ND-index however, so if you need index information try NDIter. So for instance the code below would set pixels to their x index:

vector<int64_t> ind(img->ndim());
for(NDIter<double> it(img); !it.eof(); ++it) {
it.index(ind);
it.set(ind[0]);
}

Typedef Documentation

template<class T >
using npl::OrderConstIter = typedef NDConstIter<T>

To maintain backward compatability, I have saved the OrderIter and OrderConstIter name, but eventually they may be deprecated.

Template Parameters
TPixelType to read out

Definition at line 1176 of file iterators.h.

template<class T >
using npl::OrderIter = typedef NDIter<T>

To maintain backward compatability, I have saved the OrderIter and OrderConstIter name, but eventually they may be deprecated.

Template Parameters
TPixelType to read out

Definition at line 1168 of file iterators.h.