STIR  6.2.0
array_index_functions.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2004- 2008, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
11 
12 #ifndef __stir_array_index_functions_h_
13 #define __stir_array_index_functions_h_
14 
25 #include "stir/Array.h"
26 #include "stir/BasicCoordinate.h"
27 
28 START_NAMESPACE_STIR
29 
30 /* \ingroup Array
31  \name Functions for writing generic code with indexing of multi-dimensional arrays
32  */
34 
36 
37 template <int num_dimensions, int num_dimensions2, typename elemT>
38 inline const Array<num_dimensions - num_dimensions2, elemT>& get(const Array<num_dimensions, elemT>& a,
39  const BasicCoordinate<num_dimensions2, int>& c);
40 
42 
43 template <int num_dimensions, typename elemT>
44 inline const elemT& get(const Array<num_dimensions, elemT>& a, const BasicCoordinate<num_dimensions, int>& c);
45 
47 
50 template <int num_dimensions, typename T>
51 inline BasicCoordinate<num_dimensions, int> get_min_indices(const Array<num_dimensions, T>& a);
52 
54 
68 template <int num_dimensions, typename T, int num_dimensions2>
69 inline bool next(BasicCoordinate<num_dimensions, int>& indices, const Array<num_dimensions2, T>& a);
70 
72 
73 END_NAMESPACE_STIR
74 
76 
77 #endif
BasicCoordinate< num_dimensions, int > get_min_indices(const Array< num_dimensions, T > &a)
Get the first multi-dimensional index of the array.
Definition: array_index_functions.inl:100
implementation of functions in stir/array_index_functions.h
defines the Array class for multi-dimensional (numeric) arrays
This file declares class stir::BasicCoordinate and some functions acting on stir::BasicCoordinate obj...
bool next(BasicCoordinate< num_dimensions, int > &indices, const Array< num_dimensions2, T > &a)
Given an index into an array, increment it to the next one.
Definition: array_index_functions.inl:107