[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

details CoupledScanOrderIterator< N, HANDLES, DIMENSION > Class Template Reference VIGRA

Iterate over multiple images simultaneously in scan order. More...

#include <vigra/multi_iterator_coupled.hxx>

Inheritance diagram for CoupledScanOrderIterator< N, HANDLES, DIMENSION >:
StridedScanOrderIterator< N, V, REFERENCE, POINTER >

Public Types

typedef HANDLES value_type
 

Public Member Functions

template<unsigned int TARGET_INDEX>
CoupledHandleCast
< TARGET_INDEX, value_type >
::type::reference 
get ()
 
template<unsigned int TARGET_INDEX>
CoupledHandleCast
< TARGET_INDEX, value_type >
::type::const_reference 
get () const
 
CoupledScanOrderIterator getEndIterator () const
 

Detailed Description

template<unsigned int N, class HANDLES = CoupledHandle<TinyVector<MultiArrayIndex, N>, void>, int DIMENSION = N-1>
class vigra::CoupledScanOrderIterator< N, HANDLES, DIMENSION >

Iterate over multiple images simultaneously in scan order.

The value type of this iterator is an instance of the handle class CoupledHandle. This allows to iterate over multiple arrays simultaneously. The coordinates can be accessed as a special band (index 0) in the handle. The scan-order is defined such that dimensions are iterated from front to back (first to last).

Instances of this class are usually constructed by calling createCoupledIterator() .

To get the type of a CoupledScanOrderIterator for arrays of a certain dimension and element types use CoupledIteratorType::type.

The iterator supports all functions listed in the STL documentation for Random Access Iterators.

Example of use:

using namespace vigra;
MultiArray<2, double> image1(Shape2(5, 5));
MultiArray<2, double> image2(Shape2(5, 5));
// fill image with data ...
typedef CoupledIteratorType<2, double, double>::type Iterator; // the type of the CoupledScanOrderIterator
Iterator start = createCoupledIterator(image1, image2); // create coupled iterator for simultaneous iteration over image1, image2 and their coordinates
Iterator end = start.getEndIterator();
for (Iterator it = start; it < end; ++it) {
std::cout << "coordinates: " << it.get<0>() << std::endl;
std::cout << "image1: " << it.get<1>() << std::endl;
std::cout << "image2: " << it.get<2>() << std::endl;
}
//random access:
Iterator::value_type handle = start[15];
std::cout << "image1: " << get<1>(handle) << std::endl;

#include <vigra/multi_iterator_coupled.hxx>
Namespace: vigra

Member Typedef Documentation

typedef HANDLES value_type

The type of the CoupledHandle.

Member Function Documentation

CoupledScanOrderIterator getEndIterator ( ) const

Returns CoupledScanOrderIterator pointing beyond the last element.

CoupledHandleCast<TARGET_INDEX, value_type>::type::reference get ( )

Returns reference to the element in the band with index TARGET_INDEX.

CoupledHandleCast<TARGET_INDEX, value_type>::type::const_reference get ( ) const

Returns constant reference to the element in the band with index TARGET_INDEX.


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

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1 (Fri May 19 2017)