Developer documentation
Version 3.0.3-105-gd3941f44
exemplar.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#ifndef __dwi_tractography_connectome_exemplar_h__
18#define __dwi_tractography_connectome_exemplar_h__
19
20#include <mutex>
21
25
26
27namespace MR {
28namespace DWI {
29namespace Tractography {
30namespace Connectome {
31
32
33
34
35class Exemplar : private Tractography::Streamline<float>
37 public:
39 Exemplar (const size_t exemplar_index, const size_t length, const NodePair& nodes, const std::pair<point_type, point_type>& COMs) :
40 Tractography::Streamline<float> (length, { 0.0f, 0.0f, 0.0f }),
41 nodes (nodes),
42 node_COMs (COMs),
43 is_finalized (false)
44 {
45 set_index (exemplar_index);
46 weight = 0.0f;
47 }
48
49 Exemplar (Exemplar&& that) :
50 Tractography::Streamline<float> (std::move (that)),
51 mutex (),
52 nodes (that.nodes),
53 node_COMs (that.node_COMs),
54 is_finalized (that.is_finalized) { }
55
56 Exemplar (const Exemplar& that) :
58 mutex (),
59 nodes (that.nodes),
60 node_COMs (that.node_COMs),
61 is_finalized (that.is_finalized) { }
62
63 Exemplar& operator= (const Exemplar& that);
64
65 void add (const Connectome::Streamline_nodepair&);
66 void add (const Connectome::Streamline_nodelist&);
67 void finalize (const float);
68
69 const Tractography::Streamline<float>& get() const { assert (is_finalized); return *this; }
70
71 bool is_diagonal() const { return nodes.first == nodes.second; }
72
73 float get_weight() const { return weight; }
74
75 private:
76 std::mutex mutex;
77 NodePair nodes;
78 std::pair<point_type, point_type> node_COMs;
79 bool is_finalized;
80
81 void add (const Tractography::Streamline<float>&, const bool is_reversed);
82};
83
84
85
86
87}
88}
89}
90}
91
92
93#endif
94
void set_index(const size_t i)
Definition: streamline.h:47
std::pair< node_t, node_t > NodePair
Definition: connectome.h:41
PointType::Scalar length(const vector< PointType > &tck)
Definition: streamline.h:134
Definition: base.h:24
#define MEMALIGN(...)
Definition: types.h:185