Developer documentation
Version 3.0.3-105-gd3941f44
line_search.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_sift2_line_search_h__
18#define __dwi_tractography_sift2_line_search_h__
19
20
21#include "types.h"
22
25
26
27
28namespace MR {
29 namespace DWI {
30 namespace Tractography {
31 namespace SIFT2 {
32
33
34
35 class TckFactor;
36
37
38
39 // New line search functor for when per-streamline projections and per-fixel correlation terms are not calculated
40 // Instead, the correlation term for the line search is derived using the TD fraction only
43
44 public:
45
46 class Result
48 public:
49 Result() : cost (0.0), first_deriv (0.0), second_deriv (0.0), third_deriv (0.0) { }
50 Result& operator+= (const Result& that) { cost += that.cost; first_deriv += that.first_deriv; second_deriv += that.second_deriv; third_deriv += that.third_deriv; return *this; }
51 Result& operator*= (const double i) { cost *= i; first_deriv *= i; second_deriv *= i; third_deriv *= i; return *this; }
52 double cost, first_deriv, second_deriv, third_deriv;
53 bool valid() const { return std::isfinite(cost) && std::isfinite(first_deriv) && std::isfinite(second_deriv) && std::isfinite(third_deriv); }
54 };
55
57
58
59 // Interfaces for line searches
60 Result get (const double) const;
61 double operator() (const double) const;
62
63
64 protected:
65
66 // Necessary information for those fixels traversed by this streamline
67 class Fixel
69 public:
70 Fixel (const SIFT::Track_fixel_contribution&, const TckFactor&, const double, const double);
71 //void set_damping (const double i) { dTD_dFs *= i; }
72 uint32_t index;
74 };
75
76
78 const double mu;
79 const double Fs;
80 const double reg_tik, reg_tv;
81
83
84 };
85
86
87
88
89
90 }
91 }
92 }
93}
94
95
96#endif
97
Fixel(const SIFT::Track_fixel_contribution &, const TckFactor &, const double, const double)
Derived & operator+=(const MR::Helper::ConstRow< ImageType > &row)
Definition: dense_base.h:28
#define NOMEMALIGN
Definition: memory.h:22
unsigned int track_t
Definition: types.h:34
Definition: base.h:24
#define MEMALIGN(...)
Definition: types.h:185