My Project
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-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_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 {
46 public:
47 
49  typedef typename Transform::Data plugin_data;
50 
52  typedef Transform plugin_type;
53 
55  typedef typename Transform::InterpolatorFactory InterpolatorFactory;
56 
58  typedef typename Transform::Size Size;
59 
61  typedef std::shared_ptr<TTransformCreator<Transform>> Pointer;
62 
66 
71  typename Transform::Pointer create(const Size& size) const;
72 
78  bool has_property(const char *property) const;
79 protected:
84  void add_property(const char *property);
85 private:
86  virtual typename Transform::Pointer do_create(const Size& size, const InterpolatorFactory& ipf) const = 0;
87 
88  std::set<std::string> m_properties;
89  InterpolatorFactory m_ipf;
90 };
91 
92 
98 template <typename Transform>
99 class EXPORT_HANDLER TTransformCreatorPlugin : public TFactory<TTransformCreator<Transform>>
100 {
101 public:
103 
105  typedef typename Transform::InterpolatorFactory InterpolatorFactory;
106 
111  TTransformCreatorPlugin(const char *const name);
112 private:
113  virtual Product *do_create() const __attribute__((warn_unused_result));
114  virtual Product *do_create(const InterpolatorFactory& factory) const __attribute__((warn_unused_result)) = 0 ;
115 
116  PSplineKernel m_image_interpolator;
117  PSplineBoundaryCondition m_image_boundary;
118 };
119 
120 
122 
123 #endif
The base class for all plug-in created object.
Definition: product_base.hh:41
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:51
Factory class that is used to create the transformation creator.
TTransformCreatorPlugin(const char *const name)
Transform::InterpolatorFactory InterpolatorFactory
the type of the interpolation factory used by the transformation
TFactory< TTransformCreator< Transform > >::Product Product
void add_property(const char *property)
Transform::InterpolatorFactory InterpolatorFactory
the type of the interpolation factory used by this transformation
bool has_property(const char *property) const
std::shared_ptr< TTransformCreator< Transform > > Pointer
the pointer type for this transformation creator
Transform plugin_type
helper type for plug-in handling
Transform::Pointer create(const Size &size) const
Transform::Size Size
the size type of this transformation
Transform::Data plugin_data
helper type for plug-in handling
TTransformCreator(const InterpolatorFactory &ipf)
#define EXPORT_HANDLER
Definition: core/cost.hh:32
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
CSplineBoundaryCondition::Pointer PSplineBoundaryCondition
std::shared_ptr< CSplineKernel > PSplineKernel