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_SEGMENT_HH
00029 # define OLENA_SNAKES_SEGMENT_HH
00030
00031 #include <oln/snakes/node.hh>
00032
00033 #include <vector>
00034 #include <list>
00035
00036 namespace oln {
00037
00038 namespace snakes {
00039
00044 template <class I>
00045 class segment
00046 {
00047 public:
00048 typedef typename std::vector<node<I> >::iterator iter_type;
00049 typedef typename std::vector<node<I> >::const_iterator const_iter_type;
00050 typedef typename I::point_type point_type;
00051
00052 public:
00053 segment(std::list<point_type>& initial_contour);
00054
00055 public:
00056 inline
00057 ntg::float_s
00058 energy(const I& gradient) const;
00062
00063
00064 public:
00065 std::list<point_type>
00066 contour(void) const;
00068
00069 public:
00070 const_iter_type begin(void) const;
00071 iter_type begin(void);
00073 const_iter_type end(void) const;
00074 iter_type end(void);
00076
00077 public:
00078 const node<I> prev_node(void) const;
00080 const node<I> next_node(void) const;
00082
00083 private:
00084 std::vector<node<I> > nodes;
00085 segment& prev_segment;
00086 segment& next_segment;
00087
00088 const node<I> front(void) const;
00089 const node<I> back(void) const;
00090
00091 friend
00092 std::ostream&
00093 ::operator<< <>(std::ostream&, const segment&);
00094 };
00095
00096 }
00097
00098 }
00099
00100
00101 template <class I>
00102 std::ostream& operator<<(std::ostream& os, const oln::snakes::segment<I>& s)
00103 {
00104 os << "Segment:" << std::endl;
00105 for (typename oln::snakes::segment<I>::const_iter_type it = s.begin();
00106 it != s.end();
00107 ++it)
00108 os << *it << std::endl;
00109 return os;
00110 }
00111
00112 #include <oln/snakes/segment.hxx>
00113
00114 #endif // !OLENA_SNAKES_SEGMENT_HH