My Project
3d/splinetransformpenalty.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-2017 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_3d_splinetransformpenalty_hh
22 #define mia_3d_splinetransformpenalty_hh
23 
24 #include <mia/3d/interpolator.hh>
25 #include <mia/3d/datafield.hh>
26 #include <mia/core/vector.hh>
27 #include <mia/core/product_base.hh>
28 
29 
31 
40 {
41 
42 public:
44  static const char *data_descr;
46  static const char *type_descr;
47 
53  C3DSplineTransformPenalty(double weight, bool normalize);
54 
56  C3DSplineTransformPenalty& operator = (const C3DSplineTransformPenalty& org) = delete;
57 
62  C3DSplineTransformPenalty *clone() const __attribute__((warn_unused_result));
63 
65 
72  void initialize(const C3DBounds& size, const C3DFVector& range, PSplineKernel kernel);
73 
79  double value(const C3DFVectorfield& coefficients) const;
80 
89  double value_and_gradient(const C3DFVectorfield& coefficients, CDoubleVector& gradient) const;
90 
91 protected:
92 
93 
94 
95  const C3DBounds& get_size() const;
96 
97  const C3DFVector& get_range() const;
98 
99  PSplineKernel get_kernel() const;
100 
101  double get_weight() const;
102 
103  bool get_normalize() const;
104 
105 private:
106 
107  virtual void do_initialize() = 0;
108 
109  virtual double do_value(const C3DFVectorfield& coefficients) const = 0;
110 
111  virtual double do_value_and_gradient(const C3DFVectorfield& coefficients, CDoubleVector& gradient) const = 0;
112 
113  virtual C3DSplineTransformPenalty *do_clone() const = 0;
114 
115  double m_weight;
116  bool m_normalize;
117 
118  C3DBounds m_size;
119  C3DFVector m_range;
120  PSplineKernel m_kernel;
121 };
122 
124 
125 
127 {
128 public:
129  C3DSplineTransformPenaltyPlugin(char const *const name);
130 private:
131  virtual Product *do_create() const __attribute__((warn_unused_result));
132  virtual Product *do_create(float weight, bool normalize) const __attribute__((warn_unused_result)) = 0 ;
133 
134  float m_weight;
135  bool m_normalize;
136 };
137 
138 
142 
143 
145 
146 
148 
149 
151 {
152 public:
154 };
155 
157 
158 #endif
C3DSplineTransformPenalty::type_descr
static const char * type_descr
Definition: 3d/splinetransformpenalty.hh:46
C3DSplineTransformPenalty
Base class for transformation penalties in spline based deformations.
Definition: 3d/splinetransformpenalty.hh:40
C3DSplineTransformPenalty::plugin_type
C3DSplineTransformPenalty plugin_type
Definition: 3d/splinetransformpenalty.hh:45
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
C3DSplineTransformPenaltyPlugin
Definition: 3d/splinetransformpenalty.hh:127
P3DSplineTransformPenalty
std::shared_ptr< C3DSplineTransformPenalty > P3DSplineTransformPenalty
Definition: 3d/splinetransformpenalty.hh:123
produce_3d_spline_transform_penalty
EXPORT_3D C3DSplineTransformPenaltyPluginHandler::ProductPtr produce_3d_spline_transform_penalty(const std::string &descr)
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
THandlerSingleton
the singleton that a plug-in handler really is
Definition: handler.hh:159
C3DFVectorfield
a 3D field of floating point single accuracy 3D vectors
Definition: 3d/vectorfield.hh:103
C3DSplineTransformPenaltyPluginHandlerTest::C3DSplineTransformPenaltyPluginHandlerTest
C3DSplineTransformPenaltyPluginHandlerTest()
vector.hh
C3DSplineTransformPenalty::C3DSplineTransformPenalty
C3DSplineTransformPenalty(double weight, bool normalize)
PSplineKernel
std::shared_ptr< CSplineKernel > PSplineKernel
Definition: splinekernel.hh:291
datafield.hh
normalize
std::shared_ptr< Image > normalize(const Image &image)
a normalizer for image intensities
Definition: normalize.hh:135
CProductBase
The base class for all plug-in created object.
Definition: product_base.hh:41
C3DSplineTransformPenalty::C3DSplineTransformPenalty
C3DSplineTransformPenalty(const C3DSplineTransformPenalty &org)=delete
EXPORT_3D
#define EXPORT_3D
Definition: defines3d.hh:45
TFactoryPluginHandler
the Base class for all plugn handlers that deal with factory plugins.
Definition: factory.hh:95
C3DSplineTransformPenaltyPlugin::C3DSplineTransformPenaltyPlugin
C3DSplineTransformPenaltyPlugin(char const *const name)
C3DSplineTransformPenalty::clone
C3DSplineTransformPenalty * clone() const __attribute__((warn_unused_result))
std
Definition: gsl_iterator.hh:324
product_base.hh
TCArrayWrapper
A wrapper around the c-array to provide an STL like interface for iterators.
Definition: core/vector.hh:78
C3DSplineTransformPenaltyPluginHandlerTest
Definition: 3d/splinetransformpenalty.hh:151
C3DSplineTransformPenalty::data_descr
static const char * data_descr
Definition: 3d/splinetransformpenalty.hh:44
private
class EXPORT_CORE CMeans private
interpolator.hh
T3DVector< unsigned int >
FACTORY_TRAIT
FACTORY_TRAIT(C3DSplineTransformPenaltyPluginHandler)
C3DSplineTransformPenalty::plugin_data
C3DSplineTransformPenalty plugin_data
Definition: 3d/splinetransformpenalty.hh:43
TFactory
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:51