Developer documentation
Version 3.0.3-105-gd3941f44
index_remapper.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17
18#ifndef __fixel_index_remapper_h__
19#define __fixel_index_remapper_h__
20
21#include <limits>
22
23#include "image.h"
24#include "types.h"
25#include "fixel/types.h"
26
27namespace MR
28{
29 namespace Fixel
30 {
31
32
33
36 public:
37 IndexRemapper () : mapping_is_default (true) { }
38 IndexRemapper (const index_type num_fixels);
40
41 index_type e2i (const index_type e) const {
42 assert (e < num_external());
43 return external2internal[e];
44 }
45
46 index_type i2e (const index_type i) const {
47 assert (i < num_internal());
48 return internal2external[i];
49 }
50
51 index_type num_external() const { return external2internal.size(); }
52 index_type num_internal() const { return internal2external.size(); }
53
54 bool is_default() const { return mapping_is_default; }
55
56 static constexpr index_type invalid = std::numeric_limits<index_type>::max();
57
58 private:
59 bool mapping_is_default;
60 vector<index_type> external2internal;
61 vector<index_type> internal2external;
62
63 };
64
65
66
67 }
68}
69
70#endif
index_type i2e(const index_type i) const
IndexRemapper(const index_type num_fixels)
IndexRemapper(Image< bool > fixel_mask)
index_type num_external() const
index_type num_internal() const
static constexpr index_type invalid
index_type e2i(const index_type e) const
constexpr double e
Definition: math.h:39
#define NOMEMALIGN
Definition: memory.h:22
uint32_t index_type
Definition: types.h:25
Definition: base.h:24