My Project
template/multicost.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_multicost_hh
22 #define mia_internal_multicost_hh
23 
24 #include <mia/template/fullcost.hh>
25 
27 
35 template <typename Transform>
36 class EXPORT_HANDLER TFullCostList : public TFullCost<Transform>
37 {
38 public:
39  TFullCostList();
40 
43 
45  typedef typename TFullCost<Transform>::Size Size;
46 
51  void push(typename TFullCost<Transform>::Pointer cost);
52 
53 
54 private:
55  bool do_has(const char *property) const;
56 
57  virtual double do_evaluate(const Transform& t, CDoubleVector& gradient) const;
58  double do_value(const Transform& t) const;
59  double do_value() const;
60  void do_set_size();
61  void do_reinit();
62  bool do_get_full_size(Size& size) const;
63  std::vector<typename TFullCost<Transform>::Pointer> m_costs;
64 };
65 
67 
68 #endif
TFullCost
Base class for a general cost function.
Definition: template/fullcost.hh:43
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
TFullCostList
A accumulation of cost functions that are weigted against each other.
Definition: template/multicost.hh:36
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
EXPORT_HANDLER
#define EXPORT_HANDLER
Definition: core/cost.hh:32
TFullCost::Pointer
std::shared_ptr< TFullCost< Transform > > Pointer
The shatred pointer type for this cost function.
Definition: template/fullcost.hh:63
TFullCostList::Pointer
TFullCost< Transform >::Pointer Pointer
The pointer type of this cost function.
Definition: template/multicost.hh:42
TFullCost::Size
Transform::Size Size
Typedef of the size of the data considered by this cost function.
Definition: template/fullcost.hh:48
TFullCostList::Size
TFullCost< Transform >::Size Size
The size type of this cost function type.
Definition: template/multicost.hh:45
TCArrayWrapper
A wrapper around the c-array to provide an STL like interface for iterators.
Definition: core/vector.hh:77
fullcost.hh