3d/splinetransformpenalty.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_3d_splinetransformpenalty_hh
#define mia_3d_splinetransformpenalty_hh
#include <mia/3d/interpolator.hh>
#include <mia/3d/datafield.hh>
#include <mia/core/vector.hh>
#include <mia/core/product_base.hh>
NS_MIA_BEGIN
class EXPORT_3D C3DSplineTransformPenalty : public CProductBase
{
public:
typedef C3DSplineTransformPenalty plugin_data;
static const char *data_descr;
typedef C3DSplineTransformPenalty plugin_type;
static const char *type_descr;
C3DSplineTransformPenalty(double weight, bool normalize);
C3DSplineTransformPenalty(const C3DSplineTransformPenalty& org) = delete;
C3DSplineTransformPenalty& operator = (const C3DSplineTransformPenalty& org) = delete;
C3DSplineTransformPenalty *clone() const __attribute__((warn_unused_result));
virtual ~C3DSplineTransformPenalty();
void initialize(const C3DBounds& size, const C3DFVector& range, PSplineKernel kernel);
double value(const C3DFVectorfield& coefficients) const;
double value_and_gradient(const C3DFVectorfield& coefficients, CDoubleVector& gradient) const;
protected:
const C3DBounds& get_size() const;
const C3DFVector& get_range() const;
PSplineKernel get_kernel() const;
double get_weight() const;
bool get_normalize() const;
private:
virtual void do_initialize() = 0;
virtual double do_value(const C3DFVectorfield& coefficients) const = 0;
virtual double do_value_and_gradient(const C3DFVectorfield& coefficients, CDoubleVector& gradient) const = 0;
virtual C3DSplineTransformPenalty *do_clone() const = 0;
double m_weight;
bool m_normalize;
C3DBounds m_size;
C3DFVector m_range;
PSplineKernel m_kernel;
};
typedef std::shared_ptr<C3DSplineTransformPenalty> P3DSplineTransformPenalty;
class EXPORT_3D C3DSplineTransformPenaltyPlugin: public TFactory<C3DSplineTransformPenalty>
{
public:
C3DSplineTransformPenaltyPlugin(char const *const name);
private:
virtual Product *do_create() const __attribute__((warn_unused_result));
virtual Product *do_create(float weight, bool normalize) const __attribute__((warn_unused_result)) = 0 ;
float m_weight;
bool m_normalize;
};
typedef THandlerSingleton<TFactoryPluginHandler<C3DSplineTransformPenaltyPlugin>>
C3DSplineTransformPenaltyPluginHandler;
FACTORY_TRAIT(C3DSplineTransformPenaltyPluginHandler);
EXPORT_3D C3DSplineTransformPenaltyPluginHandler::ProductPtr produce_3d_spline_transform_penalty(const std::string& descr);
class EXPORT_3D C3DSplineTransformPenaltyPluginHandlerTest
{
public:
C3DSplineTransformPenaltyPluginHandlerTest();
};
NS_MIA_END
#endif
datafield.hh
interpolator.hh
P3DSplineTransformPenalty
std::shared_ptr< C3DSplineTransformPenalty > P3DSplineTransformPenalty
Definition 3d/splinetransformpenalty.hh:123
C3DSplineTransformPenaltyPluginHandler
THandlerSingleton< TFactoryPluginHandler< C3DSplineTransformPenaltyPlugin > > C3DSplineTransformPenaltyPluginHandler
Plugin handler for image combiner plugins.
Definition 3d/splinetransformpenalty.hh:141
produce_3d_spline_transform_penalty
EXPORT_3D C3DSplineTransformPenaltyPluginHandler::ProductPtr produce_3d_spline_transform_penalty(const std::string &descr)
C3DBounds
T3DVector< unsigned int > C3DBounds
A unsinged int 3D Vector (used for 3D field sizes).
Definition 3d/vector.hh:415
C3DFVector
T3DVector< float > C3DFVector
A float 3D Vector.
Definition 3d/vector.hh:409
C3DFVectorfield
a 3D field of floating point single accuracy 3D vectors
Definition 3d/vectorfield.hh:103
C3DSplineTransformPenaltyPluginHandlerTest::C3DSplineTransformPenaltyPluginHandlerTest
C3DSplineTransformPenaltyPluginHandlerTest()
C3DSplineTransformPenaltyPlugin::C3DSplineTransformPenaltyPlugin
C3DSplineTransformPenaltyPlugin(char const *const name)
C3DSplineTransformPenalty
Base class for transformation penalties in spline based deformations.
Definition 3d/splinetransformpenalty.hh:40
C3DSplineTransformPenalty::value
double value(const C3DFVectorfield &coefficients) const
C3DSplineTransformPenalty::get_weight
double get_weight() const
C3DSplineTransformPenalty::get_kernel
PSplineKernel get_kernel() const
C3DSplineTransformPenalty::plugin_type
C3DSplineTransformPenalty plugin_type
Definition 3d/splinetransformpenalty.hh:45
C3DSplineTransformPenalty::type_descr
static const char * type_descr
Definition 3d/splinetransformpenalty.hh:46
C3DSplineTransformPenalty::get_range
const C3DFVector & get_range() const
C3DSplineTransformPenalty::clone
C3DSplineTransformPenalty * clone() const __attribute__((warn_unused_result))
C3DSplineTransformPenalty::C3DSplineTransformPenalty
C3DSplineTransformPenalty(const C3DSplineTransformPenalty &org)=delete
C3DSplineTransformPenalty::C3DSplineTransformPenalty
C3DSplineTransformPenalty(double weight, bool normalize)
C3DSplineTransformPenalty::get_size
const C3DBounds & get_size() const
C3DSplineTransformPenalty::plugin_data
C3DSplineTransformPenalty plugin_data
Definition 3d/splinetransformpenalty.hh:43
C3DSplineTransformPenalty::get_normalize
bool get_normalize() const
C3DSplineTransformPenalty::data_descr
static const char * data_descr
Definition 3d/splinetransformpenalty.hh:44
C3DSplineTransformPenalty::initialize
void initialize(const C3DBounds &size, const C3DFVector &range, PSplineKernel kernel)
C3DSplineTransformPenalty::value_and_gradient
double value_and_gradient(const C3DFVectorfield &coefficients, CDoubleVector &gradient) const
CProductBase
The base class for all plug-in created object.
Definition product_base.hh:41
TFactoryPluginHandler
the Base class for all plugn handlers that deal with factory plugins.
Definition factory.hh:95
TFactory< C3DSplineTransformPenalty >::Product
C3DSplineTransformPenalty Product
Definition factory.hh:55
TFactory< C3DSplineTransformPenalty >::TFactory
TFactory(char const *const name)
Definition factory.hh:173
THandlerSingleton
the singleton that a plug-in handler really is
Definition handler.hh:159
vector.hh
EXPORT_3D
#define EXPORT_3D
Definition defines3d.hh:45
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
PSplineKernel
std::shared_ptr< CSplineKernel > PSplineKernel
Definition splinekernel.hh:291
CDoubleVector
TCArrayWrapper< double > CDoubleVector
Definition core/vector.hh:266
FACTORY_TRAIT
#define FACTORY_TRAIT(F)
Definition factory_trait.hh:69
std
Definition gsl_iterator.hh:324
normalize
std::shared_ptr< Image > normalize(const Image &image)
a normalizer for image intensities
Definition normalize.hh:135
product_base.hh