template/transformfactory.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_internal_transformfactory_hh
22 #define mia_internal_transformfactory_hh
23 
24 #include <set>
26 #include <mia/core/factory.hh>
27 #include <mia/core/splinekernel.hh>
30 #include <mia/core/parameter.hh>
31 
33 
43 template <typename Transform>
45 public:
46 
48  typedef typename Transform::Data plugin_data;
49 
51  typedef Transform plugin_type;
52 
54  typedef typename Transform::InterpolatorFactory InterpolatorFactory;
55 
57  typedef typename Transform::Size Size;
58 
60  typedef std::shared_ptr<TTransformCreator<Transform> > Pointer;
61 
65 
70  typename Transform::Pointer create(const Size& size) const;
71 
77  bool has_property(const char *property) const;
78 protected:
83  void add_property(const char *property);
84 private:
85  virtual typename Transform::Pointer do_create(const Size& size, const InterpolatorFactory& ipf) const = 0;
86 
87  std::set<std::string> m_properties;
88  InterpolatorFactory m_ipf;
89 };
90 
91 
97 template <typename Transform>
98 class EXPORT_HANDLER TTransformCreatorPlugin : public TFactory<TTransformCreator<Transform> > {
99 public:
101 
103  typedef typename Transform::InterpolatorFactory InterpolatorFactory;
104 
109  TTransformCreatorPlugin(const char *const name);
110 private:
111  virtual Product *do_create() const __attribute__((warn_unused_result));
112  virtual Product *do_create(const InterpolatorFactory& factory) const __attribute__((warn_unused_result)) = 0 ;
113 
114  PSplineKernel m_image_interpolator;
115  PSplineBoundaryCondition m_image_boundary;
116 };
117 
118 
120 
121 #endif