regmodel.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef mia_core_regmodel_hh
22 #define mia_core_regmodel_hh
23 
24 #include <mia/core/factory.hh>
25 
27 
29  static const char *type_descr;
30 };
31 
37 template <int Dim>
38 struct RegistrationTraits {
39  typedef void need_to_declare_RegistrationTraits_for_DIM;
40  typedef need_to_declare_RegistrationTraits_for_DIM Data;
41  typedef need_to_declare_RegistrationTraits_for_DIM Force;
42  typedef need_to_declare_RegistrationTraits_for_DIM Transformation;
43 };
45 
54 template <int Dim>
55 class TRegModel :public CProductBase {
56 public:
58  typedef typename RegistrationTraits<Dim>::Data Data;
59 
61  typedef typename RegistrationTraits<Dim>::Force Force;
62 
64  typedef typename RegistrationTraits<Dim>::Transformation Transformation;
65 
68 
70  typedef Data plugin_data;
71 
72  TRegModel();
73  virtual ~TRegModel();
74 
82  void solve (const Force& b, Transformation& x) const;
83 
88  float get_force_scale() const;
89 private:
90  virtual void do_solve(const Force& b, Transformation& x) const = 0;
91  virtual float do_get_force_scale() const;
92 };
93 
94 //
95 // implementation part of the registration model
96 //
97 
98 template <int Dim>
100 {
101 }
102 
103 template <int Dim>
105 {
106 }
107 
108 template <int Dim>
109 void TRegModel<Dim>::solve (const Force& b, Transformation& x) const
110 {
111  do_solve(b,x);
112 }
113 
114 template <int Dim>
116 {
117  return do_get_force_scale();
118 }
119 
120 template <int Dim>
122 {
123  return 1.0f;
124 }
125 
127 
128 #endif