template/transformfactory.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_internal_transformfactory_hh
#define mia_internal_transformfactory_hh
#include <set>
#include <mia/core/transformation.hh>
#include <mia/core/factory.hh>
#include <mia/core/splinekernel.hh>
#include <mia/core/boundary_conditions.hh>
#include <mia/core/import_handler.hh>
#include <mia/core/parameter.hh>
NS_MIA_BEGIN
template <typename Transform>
class EXPORT_HANDLER TTransformCreator: public CProductBase
{
public:
typedef typename Transform::Data plugin_data;
typedef Transform plugin_type;
typedef typename Transform::InterpolatorFactory InterpolatorFactory;
typedef typename Transform::Size Size;
typedef std::shared_ptr<TTransformCreator<Transform>> Pointer;
TTransformCreator(const InterpolatorFactory& ipf);
typename Transform::Pointer create(const Size& size) const;
bool has_property(const char *property) const;
protected:
void add_property(const char *property);
private:
virtual typename Transform::Pointer do_create(const Size& size, const InterpolatorFactory& ipf) const = 0;
std::set<std::string> m_properties;
InterpolatorFactory m_ipf;
};
template <typename Transform>
class EXPORT_HANDLER TTransformCreatorPlugin : public TFactory<TTransformCreator<Transform>>
{
public:
typedef typename TFactory<TTransformCreator<Transform>>::Product Product;
typedef typename Transform::InterpolatorFactory InterpolatorFactory;
TTransformCreatorPlugin(const char *const name);
private:
virtual Product *do_create() const __attribute__((warn_unused_result));
virtual Product *do_create(const InterpolatorFactory& factory) const __attribute__((warn_unused_result)) = 0 ;
PSplineKernel m_image_interpolator;
PSplineBoundaryCondition m_image_boundary;
};
NS_MIA_END
#endif
boundary_conditions.hh
CProductBase
The base class for all plug-in created object.
Definition product_base.hh:41
TFactory< TTransformCreator< Transform > >::TFactory
TFactory(char const *const name)
Definition factory.hh:173
TTransformCreatorPlugin< C2DTransformation >::Product
TFactory< TTransformCreator< C2DTransformation > >::Product Product
Definition template/transformfactory.hh:102
TTransformCreatorPlugin::TTransformCreatorPlugin
TTransformCreatorPlugin(const char *const name)
TTransformCreatorPlugin< C2DTransformation >::InterpolatorFactory
C2DTransformation::InterpolatorFactory InterpolatorFactory
Definition template/transformfactory.hh:105
TTransformCreator::add_property
void add_property(const char *property)
TTransformCreator< C2DTransformation >::InterpolatorFactory
C2DTransformation::InterpolatorFactory InterpolatorFactory
Definition template/transformfactory.hh:55
TTransformCreator::has_property
bool has_property(const char *property) const
TTransformCreator< C2DTransformation >::Pointer
std::shared_ptr< TTransformCreator< C2DTransformation > > Pointer
Definition template/transformfactory.hh:61
TTransformCreator< C2DTransformation >::plugin_type
C2DTransformation plugin_type
Definition template/transformfactory.hh:52
TTransformCreator::create
Transform::Pointer create(const Size &size) const
TTransformCreator< C2DTransformation >::Size
C2DTransformation::Size Size
Definition template/transformfactory.hh:58
TTransformCreator< C2DTransformation >::plugin_data
C2DTransformation::Data plugin_data
Definition template/transformfactory.hh:49
TTransformCreator::TTransformCreator
TTransformCreator(const InterpolatorFactory &ipf)
EXPORT_HANDLER
#define EXPORT_HANDLER
Definition core/cost.hh:32
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
factory.hh
PSplineBoundaryCondition
CSplineBoundaryCondition::Pointer PSplineBoundaryCondition
Definition boundary_conditions.hh:167
PSplineKernel
std::shared_ptr< CSplineKernel > PSplineKernel
Definition splinekernel.hh:291
import_handler.hh
parameter.hh
splinekernel.hh
transformation.hh