highres-cortex 6.0.4
laplace_solver.hh
Go to the documentation of this file.
1/*
2Copyright Télécom ParisTech (2015).
3
4Contributor: Yann Leprince <yann.leprince@ylep.fr>.
5
6This file is part of highres-cortex, a collection of software designed
7to process high-resolution magnetic resonance images of the cerebral
8cortex.
9
10This software is governed by the CeCILL licence under French law and
11abiding by the rules of distribution of free software. You can use,
12modify and/or redistribute the software under the terms of the CeCILL
13licence as circulated by CEA, CNRS and INRIA at the following URL:
14<http://www.cecill.info/>.
15
16As a counterpart to the access to the source code and rights to copy,
17modify and redistribute granted by the licence, users are provided only
18with a limited warranty and the software's author, the holder of the
19economic rights, and the successive licensors have only limited
20liability.
21
22In this respect, the user's attention is drawn to the risks associated
23with loading, using, modifying and/or developing or reproducing the
24software by the user in light of its specific status of scientific
25software, that may mean that it is complicated to manipulate, and that
26also therefore means that it is reserved for developers and experienced
27professionals having in-depth computer knowledge. Users are therefore
28encouraged to load and test the software's suitability as regards their
29requirements in conditions enabling the security of their systems and/or
30data to be ensured and, more generally, to use and operate it in the
31same conditions as regards security.
32
33The fact that you are presently reading this means that you have had
34knowledge of the CeCILL licence and that you accept its terms.
35*/
36
37#ifndef LAPLACE_SOLVER_HH_INCLUDED
38#define LAPLACE_SOLVER_HH_INCLUDED
39
40#include <limits>
41
42#include <boost/static_assert.hpp>
43
44#include <cartodata/volume/volume.h>
45
46namespace yl
47{
48
49template <typename Real>
51{
52 BOOST_STATIC_ASSERT_MSG(std::numeric_limits<Real>::is_specialized,
53 "LaplaceSolver can only be specialized for types"
54 " with std::numeric_limits support");
55 BOOST_STATIC_ASSERT_MSG(!std::numeric_limits<Real>::is_integer,
56 "LaplaceSolver can only be specialized for "
57 " floating-point (non-integer) types");
58
59public:
60 explicit LaplaceSolver(const carto::VolumeRef<int16_t>& classif);
61
67
68 void SOR(Real absolute_precision,
69 float typical_cortical_thickness);
70 void clamp_to_range(Real min, Real max);
72
74
75 static Real best_precision() {
77 }
78
79 void set_verbosity(const int verbosity) {
80 m_verbosity = verbosity;
81 }
82
83private:
84 static const int s_border_width = 1;
85
86 const carto::VolumeRef<int16_t> m_classif;
87 carto::VolumeRef<Real> m_solution;
88 int m_verbosity;
89};
90
91} // namespace yl
92
93#endif // !defined(LAPLACE_SOLVER_HH_INCLUDED)
static Real best_precision()
carto::VolumeRef< Real > solution() const
void eliminate_extrema()
void initialize_solution()
Initialize the output volume to a reasonable value.
void set_verbosity(const int verbosity)
void clamp_to_range(Real min, Real max)
LaplaceSolver(const carto::VolumeRef< int16_t > &classif)
void SOR(Real absolute_precision, float typical_cortical_thickness)
T min(const Volume< T > &vol)
T max(const Volume< T > &vol)
Definition cortex.hh:41
static const bool is_integer
static const bool is_specialized
static _Tp epsilon()