oln::snakes::segment< I > Class Template Reference

#include <segment.hh>

Inheritance diagram for oln::snakes::segment< I >:

Inheritance graph
[legend]
Collaboration diagram for oln::snakes::segment< I >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< node<
I > >::iterator 
iter_type
typedef std::vector< node<
I > >::const_iterator 
const_iter_type
typedef I::point_type point_type

Public Member Functions

 segment (std::list< point_type > &initial_contour)
ntg::float_s energy (const I &gradient) const
std::list< point_type > contour (void) const
 Return the points of the segment.

const_iter_type begin (void) const
iter_type begin (void)
 Return an iterator on the first node of the segment.

const_iter_type end (void) const
iter_type end (void)
 Return an iterator on the last node of the segment.

const node< I > prev_node (void) const
 Node before the first node of this segment.

const node< I > next_node (void) const
 Node after the next node of this segment.


Friends

std::ostream & operator<< (std::ostream &, const segment &)

Detailed Description

template<class I>
class oln::snakes::segment< I >

A segment is a list of node.

Todo:
FIXME: Do not work due to the function node::energy.

Definition at line 45 of file segment.hh.


Member Function Documentation

template<class I>
ntg::float_s oln::snakes::segment< I >::energy const I &  gradient  )  const [inline]
 

Just iterate through the vector and sums up point energies.

Attention:
FIXME: Do not work due to the function node::energy.

Definition at line 49 of file segment.hxx.

References oln::snakes::segment< I >::next_node(), and oln::snakes::segment< I >::prev_node().

00050     {
00051       ntg::float_s e = 0.f;
00052       typename segment<I>::const_iter_type p = nodes.begin();
00053       typename segment<I>::const_iter_type c = nodes.begin();
00054       typename segment<I>::const_iter_type n = nodes.begin();
00055 
00056       ++n;
00057       e += c->energy(gradient, prev_node(), *n);
00058       for (++c, ++n; n != nodes.end(); ++p, ++c, ++n)
00059         e += c->energy(gradient, *p, *n);
00060       e += c->energy(gradient, *p, next_node());
00061       return e;
00062     }


The documentation for this class was generated from the following files:
Generated on Thu Apr 15 20:17:05 2004 for Olena by doxygen 1.3.6-20040222