Developer documentation
Version 3.0.3-105-gd3941f44
upsampler.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_resampling_upsampler_h__
18#define __dwi_tractography_resampling_upsampler_h__
19
20
22
23
24namespace MR {
25 namespace DWI {
26 namespace Tractography {
27 namespace Resampling {
28
29
30
31 class Upsampler : public BaseCRTP<Upsampler>
32 { MEMALIGN(Upsampler)
33
34 public:
35 Upsampler () :
36 data (4, 3) { }
37
38 Upsampler (const size_t os_ratio) :
39 data (4, 3) {
40 set_ratio (os_ratio);
41 }
42
43 Upsampler (const Upsampler& that) :
44 M (that.M),
45 temp (M.rows(), 3),
46 data (4, 3) { }
47
48 ~Upsampler() { }
49
50
51 bool operator() (const Streamline<>&, Streamline<>&) const override;
52 bool valid () const override { return true; }
53
54 void set_ratio (const size_t);
55 size_t get_ratio() const { return (M.rows() ? (M.rows() + 1) : 1); }
56
57 private:
58 Eigen::MatrixXf M;
59 mutable Eigen::MatrixXf temp, data;
60
61 void interp_prepare (Streamline<>&) const;
62 void increment (const point_type&) const;
63
64 };
65
66
67
68 }
69 }
70 }
71}
72
73#endif
74
75
76
typename Streamline<>::point_type point_type
Definition: resampling.h:40
Definition: base.h:24