Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
mia
template
template/fullcost.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_fullcost_hh
22
#define mia_internal_fullcost_hh
23
24
#include <
mia/core/product_base.hh
>
25
#include <
mia/core/vector.hh
>
26
#include <
mia/core/import_handler.hh
>
27
28
NS_MIA_BEGIN
29
42
template
<
typename
Transform>
43
class
EXPORT_HANDLER
TFullCost
:
public
CProductBase
{
44
public
:
45
47
typedef
typename
Transform::Size
Size
;
48
50
typedef
TFullCost<Transform>
plugin_data
;
51
53
typedef
TFullCost<Transform>
plugin_type
;
54
56
static
const
char
*
type_descr
;
57
59
static
const
char
*
data_descr
;
60
62
typedef
std::shared_ptr<TFullCost<Transform> >
Pointer
;
63
68
TFullCost
(
double
weight);
69
70
78
double
evaluate(
const
Transform& t,
CDoubleVector
& gradient)
const
;
79
85
double
cost_value(
const
Transform& t)
const
;
86
91
double
cost_value()
const
;
92
96
void
reinit();
97
101
void
set_size(
const
Size
& size);
102
109
bool
get_full_size(
Size
& size)
const
;
110
111
protected
:
113
double
get_weight()
const
;
114
116
const
Size
& get_current_size()
const
;
117
private
:
118
virtual
double
do_evaluate(
const
Transform& t,
CDoubleVector
& gradient)
const
= 0;
119
virtual
double
do_value(
const
Transform& t)
const
= 0;
120
virtual
double
do_value()
const
= 0;
121
virtual
void
do_reinit();
122
virtual
void
do_set_size() = 0;
123
virtual
bool
do_get_full_size(
Size
& size)
const
;
124
125
double
m_weight;
126
Size
m_current_size;
127
128
};
129
136
template
<
typename
Transform>
137
class
EXPORT_HANDLER
TFullCostPlugin
:
public
TFactory
<TFullCost<Transform> > {
138
public
:
143
TFullCostPlugin
(
const
char
*name);
144
private
:
145
virtual
TFullCost<Transform>
*do_create()
const
;
146
virtual
TFullCost<Transform>
*do_create(
float
weight)
const
= 0;
147
float
m_weight;
148
};
149
150
151
NS_MIA_END
152
153
#endif
Generated on Tue Oct 15 2013 13:56:37 by
1.8.4