2d/timestep.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_2d_timestep_hh
22 #define mia_2d_timestep_hh
23 
24 #include <mia/core/factory.hh>
25 #include <mia/core/typedescr.hh>
26 #include <mia/2d/image.hh>
27 #include <mia/2d/transform.hh>
28 
30 
43 public:
46 
48  typedef timestep_type plugin_type;
49 
56  C2DRegTimeStep(float min, float max);
57 
58 
59  virtual ~C2DRegTimeStep();
60 
71  float calculate_pertuberation(C2DFVectorfield& io,
72  const C2DTransformation& shift) const;
73 
82  bool regrid_requested(const C2DTransformation& b, const C2DFVectorfield& v,
83  float delta) const;
84 
91  bool decrease();
92 
94  void increase();
95 
101  float get_delta(float maxshift) const;
102 
104  bool has_regrid () const;
105 
106 private:
107  virtual float do_calculate_pertuberation(C2DFVectorfield& io,
108  const C2DTransformation& shift) const = 0;
109  virtual bool do_regrid_requested (const C2DTransformation& b,
110  const C2DFVectorfield& v, float delta) const = 0;
111 
112  virtual bool do_has_regrid () const = 0;
113 
114  float m_min;
115  float m_max;
116  float m_current;
117  float m_step;
118 };
119 
121 typedef std::shared_ptr<C2DRegTimeStep > P2DRegTimeStep;
122 
130 class EXPORT_2D C2DRegTimeStepPlugin : public TFactory<C2DRegTimeStep>
131 {
132 public:
137  C2DRegTimeStepPlugin(const char *name);
138 protected:
140  float get_min_timestep() const;
141 
143  float get_max_timestep() const;
144 private:
145  float m_min;
146  float m_max;
147 };
148 
155 
157 
158 #endif