/home/jpiovano/src/Odyssee++/trunk/Libs/LevelSet/src/SegmentationModule/RegularizationModule.h
Go to the documentation of this file.00001
00009 #ifndef REGULARIZATIONMODULE_H
00010 #define REGULARIZATIONMODULE_H
00011
00012 #include <SegmentationModule/SegmentationModule.h>
00013
00014 namespace segmentation {
00015
00016
00025 template <unsigned DIM, typename Pixel>
00026 class RegularizationModule : public SegmentationModule<DIM, Pixel>
00027 {
00028 public:
00029
00030 typedef SegmentationModule<DIM, Pixel> base;
00031 typedef typename base::LevelSet LevelSet;
00032 typedef typename base::Index Index;
00033 typedef typename base::Schemes Schemes;
00034
00037
00039 RegularizationModule(float _w = 1.f,
00040 bool _mean_curv_motion = false
00041 );
00042
00044 virtual ~RegularizationModule();
00045
00046
00048
00050
00052 void mean_curv_motion(bool _b=true);
00053
00055
00057
00059 float value(const LevelSet & phi, const Index & ind);
00061 float energy(const LevelSet & phi, const Index & ind);
00062
00064
00066
00067 protected:
00068
00069 bool m_mean_curv_motion;
00070
00072
00073 };
00074
00075
00077
00078
00079
00080 template <unsigned DIM, typename Pixel>
00081 RegularizationModule<DIM, Pixel>::RegularizationModule(float _w, bool _mean_curv_motion)
00082 :SegmentationModule<DIM, Pixel>(_w, false), m_mean_curv_motion(_mean_curv_motion)
00083 { }
00084
00085 template <unsigned DIM, typename Pixel>
00086 RegularizationModule<DIM, Pixel>::~RegularizationModule()
00087 { }
00088
00089
00091
00092
00093
00094 template <unsigned DIM, typename Pixel>
00095 void RegularizationModule<DIM, Pixel>::mean_curv_motion(bool _b)
00096 {
00097 m_mean_curv_motion = _b;
00098 }
00099
00100
00102
00103
00104
00105 template <unsigned DIM, typename Pixel>
00106 float RegularizationModule<DIM, Pixel>::value(const LevelSet & phi, const Index & ind)
00107 {
00108 return Schemes::mean_curvature(phi,ind) * ((m_mean_curv_motion) ? Schemes::norm_gradient(phi,ind) : Globals::delta(phi(ind)));
00109
00110 }
00111
00112 template <unsigned DIM, typename Pixel>
00113 float RegularizationModule<DIM, Pixel>::energy(const LevelSet & phi, const Index & ind)
00114 {
00115 return Schemes::norm_gradient(phi,ind) * Globals::delta(phi(ind));
00116 }
00117 }
00118
00119 #endif // REGULARIZATIONMODULE_H