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

multi_fwd.hxx
1/************************************************************************/
2/* */
3/* Copyright 2011-2014 by Ullrich Koethe */
4/* */
5/* This file is part of the VIGRA computer vision library. */
6/* The VIGRA Website is */
7/* http://hci.iwr.uni-heidelberg.de/vigra/ */
8/* Please direct questions, bug reports, and contributions to */
9/* ullrich.koethe@iwr.uni-heidelberg.de or */
10/* vigra@informatik.uni-hamburg.de */
11/* */
12/* Permission is hereby granted, free of charge, to any person */
13/* obtaining a copy of this software and associated documentation */
14/* files (the "Software"), to deal in the Software without */
15/* restriction, including without limitation the rights to use, */
16/* copy, modify, merge, publish, distribute, sublicense, and/or */
17/* sell copies of the Software, and to permit persons to whom the */
18/* Software is furnished to do so, subject to the following */
19/* conditions: */
20/* */
21/* The above copyright notice and this permission notice shall be */
22/* included in all copies or substantial portions of the */
23/* Software. */
24/* */
25/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32/* OTHER DEALINGS IN THE SOFTWARE. */
33/* */
34/************************************************************************/
35
36#ifndef VIGRA_MULTI_FWD_HXX
37#define VIGRA_MULTI_FWD_HXX
38
39#include <memory>
40#include "metaprogramming.hxx"
41#include "tinyvector.hxx"
42
43 namespace vigra {
44
45/** \addtogroup MultiIteratorGroup Multi-dimensional Shapes and Array Iterators
46
47 \brief Shape objects and general iterators for arrays of arbitrary dimension.
48*/
49//@{
50
51/********************************************************/
52/* */
53/* shape */
54/* */
55/********************************************************/
56
57 /** Index type for a single dimension of a MultiArrayView or
58 MultiArray.
59 */
60 typedef std::ptrdiff_t MultiArrayIndex;
61
62 template <unsigned int N>
63 class MultiArrayShape;
64
65/********************************************************/
66/* */
67/* memory layout */
68/* */
69/********************************************************/
70
71// the resulting MultiArray has no explicit channel axis
72// (i.e. the number of channels is implicitly one)
73 template <class T>
74 struct Singleband;
75
76// the last axis is explicitly designated as channel axis
77 template <class T>
78 struct Multiband;
79
80// the array is organised in chunks
81 template <class T>
82 struct ChunkedMemory;
83
84// helper classes to map memory layout to actual type
85 namespace detail {
86
87 template <class T>
88 struct ResolveMultiband;
89
90 template <class T>
91 struct ResolveChunkedMemory;
92
93} // namespace detail
94
95/********************************************************/
96/* */
97/* constructor tag */
98/* */
99/********************************************************/
100
101 /** \brief Initialize a MultiArray in a standard way.
102
103 */
104 enum MultiArrayInitializationTag {
105 LinearSequence ///< Initialize array by a linear sequence in scan order
106};
107
108/********************************************************/
109/* */
110/* element handles */
111/* */
112/********************************************************/
113
114 template <class T, class NEXT>
115 class CoupledHandle;
116
117 template <unsigned int N, class T>
118 class SharedChunkHandle;
119
120/********************************************************/
121/* */
122/* array types */
123/* */
124/********************************************************/
125
126 template <unsigned int N, class T, class C = StridedArrayTag>
127 class MultiArrayView;
128
129 template <unsigned int N, class T,
130 class A = std::allocator<typename detail::ResolveMultiband<T>::type> >
131 class MultiArray;
132
133 template <unsigned int N, class T>
134 class ChunkedArrayBase;
135
136 template <unsigned int N, class T>
137 class ChunkedArray;
138
139/********************************************************/
140/* */
141/* iterators / traversers */
142/* */
143/********************************************************/
144
145// DEPRECATED!
146// hierarchical iterator whose innermost dimension is unstrided
147 template <unsigned int N, class T, class REFERENCE = T &, class POINTER = T *>
148 class MultiIterator;
149
150// DEPRECATED!
151// hierarchical iterator whose innermost dimension may be strided
152 template <unsigned int N, class T, class REFERENCE = T &, class POINTER = T *>
153 class StridedMultiIterator;
154
155// multi-dimensional scan-order iteration returning the coordinate of the current element
156 template<unsigned int N>
157 class MultiCoordinateIterator;
158
159// scan-order iteration returning the current element of a multi-dimensional array
160 template <unsigned int N, class V, class REFERENCE, class POINTER>
161 class StridedScanOrderIterator;
162
163// simultaneous scan-order iteration over several multi-dimensional arrays
164 template <unsigned int N,
165 class HANDLES=CoupledHandle<TinyVector<MultiArrayIndex, N>, void>,
166 int DIMENSION = N-1>
167 class CoupledScanOrderIterator;
168
169// scan-order iteration over the chunks of a chunked array
170// returns a MultiArrayView for the current chunk
171 template<unsigned int N, class T>
172 class ChunkIterator;
173
174/********************************************************/
175/* */
176/* neighborhood types */
177/* */
178/********************************************************/
179
180 /** \brief Choose the neighborhood system in a dimension-independent way.
181
182 DirectNeighborhood corresponds to 4-neighborhood in 2D and 6-neighborhood in 3D, whereas
183 IndirectNeighborhood means 8-neighborhood in 2D and 26-neighborhood in 3D. The general
184 formula for N dimensions are 2*N for direct neighborhood and 3^N-1 for indirect neighborhood.
185 */
186 enum NeighborhoodType {
187 DirectNeighborhood=0, ///< use only direct neighbors
188 IndirectNeighborhood=1 ///< use direct and indirect neighbors
189};
190
191
192/********************************************************/
193/* */
194/* grid graph */
195/* */
196/********************************************************/
197
198 template<unsigned int N, bool BackEdgesOnly=false>
199 class GridGraphNeighborIterator;
200
201 template<unsigned int N, bool BackEdgesOnly=false>
202 class GridGraphEdgeIterator;
203
204 template<unsigned int N, bool BackEdgesOnly=false>
205 class GridGraphOutEdgeIterator;
206
207 template<unsigned int N, bool BackEdgesOnly=false>
208 class GridGraphArcIterator;
209
210 template<unsigned int N, bool BackEdgesOnly=false>
211 class GridGraphOutArcIterator;
212
213 template<unsigned int N, bool BackEdgesOnly=false>
214 class GridGraphInArcIterator;
215
216 template<unsigned int N, class DirectedTag>
217 class GridGraph;
218
219//@}
220
221} // namespace vigra
222
223#endif // VIGRA_MULTI_FWD_HXX
vigra::MultiArrayShape
Definition multi_shape.hxx:267
vigra
vigra::MultiArrayInitializationTag
MultiArrayInitializationTag
Initialize a MultiArray in a standard way.
Definition multi_fwd.hxx:104
vigra::LinearSequence
@ LinearSequence
Initialize array by a linear sequence in scan order.
Definition multi_fwd.hxx:105
vigra::NeighborhoodType
NeighborhoodType
Choose the neighborhood system in a dimension-independent way.
Definition multi_fwd.hxx:186
vigra::IndirectNeighborhood
@ IndirectNeighborhood
use direct and indirect neighbors
Definition multi_fwd.hxx:188
vigra::DirectNeighborhood
@ DirectNeighborhood
use only direct neighbors
Definition multi_fwd.hxx:187
vigra::MultiArrayIndex
std::ptrdiff_t MultiArrayIndex
Definition multi_fwd.hxx:60

© 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