masked_cost.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_template_masked_cost_hh
#define mia_template_masked_cost_hh
#include <mia/core/factory.hh>
#include <mia/core/refholder.hh>
#ifndef EXPORT_HANDLER
# ifdef WIN32
# define EXPORT_HANDLER __declspec(dllimport)
# else
# define EXPORT_HANDLER
# endif
#endif
NS_MIA_BEGIN
struct EXPORT_CORE masked_cost_type {
static const char *type_descr;
};
template <typename T, typename M, typename V>
class EXPORT_HANDLER TMaskedCost : public CProductBase
{
public:
typedef T Data;
typedef M Mask;
typedef V Force;
typedef TRefHolder<T> RData;
typedef typename RData::Pointer PData;
typedef T plugin_data;
typedef masked_cost_type plugin_type;
virtual ~TMaskedCost();
double value(const T& mov, const M& mask) const;
double evaluate_force(const T& mov, const M& mask, V& force) const;
void set_reference(const T& ref);
private:
virtual double do_value(const T& a, const T& b, const M& mask) const = 0;
virtual double do_evaluate_force(const T& a, const T& b, const M& mask, V& force) const = 0;
virtual void post_set_reference(const T& ref);
PData m_reference;
};
NS_MIA_END
#endif
CProductBase
The base class for all plug-in created object.
Definition product_base.hh:41
TMaskedCost
The generic cost function interface.
Definition masked_cost.hh:65
TMaskedCost::set_reference
void set_reference(const T &ref)
TMaskedCost::value
double value(const T &mov, const M &mask) const
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::plugin_type
masked_cost_type plugin_type
Definition masked_cost.hh:86
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::Force
C2DFVectorfield Force
Definition masked_cost.hh:74
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::plugin_data
C2DImage plugin_data
Definition masked_cost.hh:83
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::Mask
C2DBitImage Mask
Definition masked_cost.hh:71
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::Data
C2DImage Data
Definition masked_cost.hh:68
TMaskedCost::~TMaskedCost
virtual ~TMaskedCost()
ensure virtual destruction, since we have virtual functions
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::RData
TRefHolder< C2DImage > RData
Definition masked_cost.hh:77
TMaskedCost< C2DImage, C2DBitImage, C2DFVectorfield >::PData
RData::Pointer PData
Definition masked_cost.hh:80
TMaskedCost::evaluate_force
double evaluate_force(const T &mov, const M &mask, V &force) const
TRefHolder
A class to make a const reference not so const.
Definition refholder.hh:40
TRefHolder::Pointer
std::shared_ptr< TRefHolder< T > > Pointer
pointer type of this reference holder.
Definition refholder.hh:43
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
factory.hh
EXPORT_HANDLER
#define EXPORT_HANDLER
Definition masked_cost.hh:32
refholder.hh
masked_cost_type
plugin helper type
Definition masked_cost.hh:39
masked_cost_type::type_descr
static const char * type_descr
plugin path helper variable
Definition masked_cost.hh:41