00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OLENA_SNAKES_ENERGIES_HH
00029 # define OLENA_SNAKES_ENERGIES_HH
00030
00031 namespace oln {
00032
00033 namespace snakes {
00034
00037 template <class I>
00038 class energy
00039 {
00040 public:
00041 energy() {}
00042 energy(void *) {}
00043
00044 public:
00050 ntg::float_s
00051 compute(const I&, const node<I>&, const node<I>&, const node<I>&)
00052 {
00053
00054
00055
00056
00057 user_defined_external_energy_functor::compute();
00058 return 0.f;
00059 }
00060
00061 public:
00063 static void* cookie() { return 0; };
00064
00065 private:
00066 struct user_defined_external_energy_functor{};
00067 };
00068
00069
00078 template <class I>
00079 class continuity_energy : public energy<I>
00080 {
00081 public:
00082 typedef I image_type;
00083
00084 public:
00085 continuity_energy(ntg::float_s* average_dist) :
00086 average_dist(average_dist) {}
00087
00088 public:
00089 inline
00090 ntg::float_s
00091 compute(const I&,
00092 const node<I>& prev,
00093 const node<I>& current,
00094 const node<I>&);
00095
00096 private:
00097 ntg::float_s* average_dist;
00098 };
00099
00100
00108 template <class I>
00109 class curvature_energy : public energy<I>
00110 {
00111 public:
00112 typedef I image_type;
00113
00114 public:
00115 curvature_energy(void *) {}
00116
00117 public:
00118 static inline
00119 ntg::float_s
00120 compute(const I&,
00121 const node<I>& prev,
00122 const node<I>& current,
00123 const node<I>& next);
00124 };
00125
00126
00132 template <class I>
00133 class image_energy : public energy<I>
00134 {
00135 public:
00136 typedef I image_type;
00137
00138 public:
00139 image_energy(void*) {}
00140
00141 public:
00142 static inline
00143 ntg::float_s
00144 compute(const I& gradient,
00145 const node<I>&,
00146 const node<I>& current,
00147 const node<I>&);
00148 };
00149
00150
00155 #define oln_snakes_define_external_energy(Energy, Gradient, PrevNode, CurrentNode, NextNode) \
00156 \
00157 template<class I> \
00158 class Energy : public energy<I> \
00159 { \
00160 public: \
00161 typedef I image_type; \
00162 \
00163 public: \
00164 Energy(void*) {} \
00165 \
00166 public: \
00167 ::ntg::float_s \
00168 compute(const I& gradient, \
00169 const ::oln::snakes::node<I>&, \
00170 const ::oln::snakes::node<I>&, \
00171 const ::oln::snakes::node<I>&); \
00172 }; \
00173 \
00174 template<class I> \
00175 ::ntg::float_s \
00176 Energy<I>::compute(const I& Gradient, \
00177 const ::oln::snakes::node<I>& PrevNode, \
00178 const ::oln::snakes::node<I>& CurrentNode, \
00179 const ::oln::snakes::node<I>& NextNode)
00180
00181
00183 oln_snakes_define_external_energy(dummy_energy,,,,)
00184 {
00185 return 0;
00186 }
00187
00188 }
00189
00190 }
00191
00192 #include <oln/snakes/energies.hxx>
00193
00194 #endif // !OLENA_SNAKES_ENERGIES_HH