Developer documentation
Version 3.0.3-105-gd3941f44
extract.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_extract_h__
18#define __dwi_tractography_connectome_extract_h__
19
20
21#include "file/ofstream.h"
22
27
28
29namespace MR {
30namespace DWI {
31namespace Tractography {
32namespace Connectome {
33
34
35
36
37
38
40{ MEMALIGN(Selector)
41 public:
42 Selector (const node_t node, const bool keep_self = true) :
43 list (1, node),
44 exact_match (false),
45 keep_self (keep_self) { }
46 Selector (const node_t node_one, const node_t node_two) :
47 exact_match (true),
48 keep_self (true) { list.push_back (node_one); list.push_back (node_two); }
49 Selector (const vector<node_t>& node_list, const bool both, const bool keep_self = false) :
50 list (node_list),
51 exact_match (both),
52 keep_self (keep_self) { }
53 Selector (const Selector& that) :
54 list (that.list), exact_match (that.exact_match), keep_self (that.keep_self) { }
55 Selector (Selector&& that) :
56 list (std::move (that.list)), exact_match (that.exact_match), keep_self (that.keep_self) { }
57
58 bool operator() (const node_t) const;
59 bool operator() (const NodePair&) const;
60 bool operator() (const node_t one, const node_t two) const { return (*this) (NodePair (one, two)); }
61 bool operator() (const vector<node_t>&) const;
62
63 private:
64 vector<node_t> list;
65 bool exact_match, keep_self;
66
67};
68
69
70
71
72
73
76 public:
78
79 bool operator() (const Tractography::Connectome::Streamline_nodepair&);
80 bool operator() (const Tractography::Connectome::Streamline_nodelist&);
81
82 void finalize();
83
84 void write (const node_t, const node_t, const std::string&, const std::string&);
85 void write (const node_t, const std::string&, const std::string&);
86 void write (const std::string&, const std::string&);
87
88
89 private:
90 float step_size;
91 vector<Selector> selectors;
92 vector<Exemplar> exemplars;
93};
94
95
96
97
98
99
100
101
102
105
106 public:
107 WriterExtraction (const Tractography::Properties&, const vector<node_t>&, const bool, const bool);
108
109 void add (const node_t, const std::string&, const std::string);
110 void add (const node_t, const node_t, const std::string&, const std::string);
111 void add (const vector<node_t>&, const std::string&, const std::string);
112
113 void clear();
114
115 bool operator() (const Connectome::Streamline_nodepair&) const;
116 bool operator() (const Connectome::Streamline_nodelist&) const;
117
118 size_t file_count() const { return writers.size(); }
119
120
121 private:
122 const Tractography::Properties& properties;
123 const vector<node_t>& node_list;
124 const bool exclusive;
125 const bool keep_self;
126 vector< Selector > selectors;
129
130};
131
132
133
134
135
136
137}
138}
139}
140}
141
142
143#endif
144
std::pair< node_t, node_t > NodePair
Definition: connectome.h:41
MR::Connectome::node_t node_t
Definition: connectome.h:40
Definition: base.h:24
#define MEMALIGN(...)
Definition: types.h:185