Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

bmrf_node Class Reference

#include <bmrf_node.h>

Inheritance diagram for bmrf_node:

Inheritance graph
[legend]
List of all members.

Detailed Description

A Markov Random Field (MRF) node.

Definition at line 28 of file bmrf_node.h.

Public Types

typedef vcl_list< bmrf_arc_sptr
>::iterator 
arc_iterator
 iterator over neighboring nodes.
enum  neighbor_type { SPACE, TIME, ALPHA, ALL }
 The values of this enum categorize the neighbors. More...

Public Member Functions

 bmrf_node (const bmrf_epi_seg_sptr &epi_seg=NULL, int frame_num=0, double prob=-1.0)
 Constructor.
 bmrf_node (bmrf_node const &n)
 Copy constructor.
 ~bmrf_node ()
 Destructor.
double probability ()
 Return the probability of this node.
bmrf_gamma_func_sptr gamma ()
 Return the gamma funtion of this node.
double probability (const bmrf_gamma_func_sptr &gamma, int time_step)
 Calculate the probability given the gamma function and neighbors.
arc_iterator begin (neighbor_type type=ALL)
 Returns an iterator to the beginning of the type type neighbors.
arc_iterator end (neighbor_type type=ALL)
 Returns an iterator to the end of the type type neighbors.
bmrf_epi_seg_sptr epi_seg () const
 Return the frame number at which this node is found.
int num_neighbors (neighbor_type type=ALL)
 Returns the number of outgoing neighbors to this node of type type.
int frame_num () const
 Return the frame number at which this node is found.
void b_write (vsl_b_ostream &os) const
 Binary save self to stream.
void b_read (vsl_b_istream &is)
 Binary load self from stream.
short version () const
 Return IO version number;.
void print_summary (vcl_ostream &os) const
 Print an ascii summary to the stream.
void ref ()
void unref ()
int get_references () const
bool is_referenced () const

Protected Member Functions

void compute_probability ()
 Compute the conditional probability that this node is correct given its neighbors.
void prune_by_probability (double threshold, bool relative=false)
 Prune neighbors with a probability below threshold.
void prune_by_gamma (double min_gamma, double max_gamma)
 Prune neighbors with a gamma outside this range.
void prune_directed ()
 Prune directed arcs leaving only arcs to nodes which have arcs back to this node.
bool add_neighbor (const bmrf_node_sptr &node, neighbor_type type)
 Add node as a neighbor of type type.
bool add_arc (const bmrf_arc_sptr &arc, neighbor_type type)
 Add an arc arc of type type.
bool remove_neighbor (bmrf_node_sptr node, neighbor_type type=ALL)
 Remove node from the neighborhood.
bool remove_helper (arc_iterator &a_itr, neighbor_type type)
 Remove the arc associated with the outgoing iterator.
void strip ()
 Strip all of the arcs from this node.
bool purge ()
 Remove any arcs to or from NULL nodes.

Private Attributes

bmrf_epi_seg_sptr segment_
 A smart pointer to the underlying epi-segment data.
int frame_num_
 The frame number associated with this node.
double probability_
 The cached probability value.
bmrf_gamma_func_sptr gamma_
 The estimate of the gamma function.
vcl_list< bmrf_arc_sptrout_arcs_
 The pointers to outgoing arcs.
vcl_list< bmrf_arc_sptrin_arcs_
 The pointers to incoming arcs.
vcl_vector< arc_iteratorboundaries_
 The the iterators into neighbors_ that represent the boundary between types.
vcl_vector< int > sizes_
 The number of neighbors for each type.

Friends

class bmrf_network
class bmrf_arc


Member Typedef Documentation

typedef vcl_list<bmrf_arc_sptr>::iterator bmrf_node::arc_iterator
 

iterator over neighboring nodes.

Definition at line 36 of file bmrf_node.h.


Member Enumeration Documentation

enum bmrf_node::neighbor_type
 

The values of this enum categorize the neighbors.

Note:
ALL is a special type and should be kept last
Enumerator:
SPACE 
TIME 
ALPHA 
ALL 

Definition at line 40 of file bmrf_node.h.


Constructor & Destructor Documentation

bmrf_node::bmrf_node const bmrf_epi_seg_sptr epi_seg = NULL,
int  frame_num = 0,
double  prob = -1.0
 

Constructor.

Definition at line 17 of file bmrf_node.cxx.

bmrf_node::bmrf_node bmrf_node const &  n  ) 
 

Copy constructor.

Definition at line 25 of file bmrf_node.cxx.

bmrf_node::~bmrf_node  )  [inline]
 

Destructor.

Definition at line 50 of file bmrf_node.h.


Member Function Documentation

bool bmrf_node::add_arc const bmrf_arc_sptr arc,
neighbor_type  type
[protected]
 

Add an arc arc of type type.

Return values:
true if the arc was added successfully
false if the arc is not valid or already exists

Definition at line 278 of file bmrf_node.cxx.

bool bmrf_node::add_neighbor const bmrf_node_sptr node,
neighbor_type  type
[protected]
 

Add node as a neighbor of type type.

Return values:
true if the node was added successfully
false if the neighbor is not valid or already exists

Definition at line 250 of file bmrf_node.cxx.

void bmrf_node::b_read vsl_b_istream is  ) 
 

Binary load self from stream.

Definition at line 427 of file bmrf_node.cxx.

void bmrf_node::b_write vsl_b_ostream os  )  const
 

Binary save self to stream.

Definition at line 397 of file bmrf_node.cxx.

bmrf_node::arc_iterator bmrf_node::begin neighbor_type  type = ALL  ) 
 

Returns an iterator to the beginning of the type type neighbors.

Note:
if type is ALL then iteration is over all types

Definition at line 370 of file bmrf_node.cxx.

void bmrf_node::compute_probability  )  [protected]
 

Compute the conditional probability that this node is correct given its neighbors.

Definition at line 114 of file bmrf_node.cxx.

bmrf_node::arc_iterator bmrf_node::end neighbor_type  type = ALL  ) 
 

Returns an iterator to the end of the type type neighbors.

Note:
if type is ALL then iteration is over all types

Definition at line 379 of file bmrf_node.cxx.

bmrf_epi_seg_sptr bmrf_node::epi_seg  )  const [inline]
 

Return the frame number at which this node is found.

Definition at line 71 of file bmrf_node.h.

int bmrf_node::frame_num  )  const [inline]
 

Return the frame number at which this node is found.

Definition at line 78 of file bmrf_node.h.

bmrf_gamma_func_sptr bmrf_node::gamma  ) 
 

Return the gamma funtion of this node.

Definition at line 96 of file bmrf_node.cxx.

int bmrf_node::num_neighbors neighbor_type  type = ALL  ) 
 

Returns the number of outgoing neighbors to this node of type type.

Note:
if type is ALL then this returns the total number of neighbors

Definition at line 388 of file bmrf_node.cxx.

void bmrf_node::print_summary vcl_ostream &  os  )  const
 

Print an ascii summary to the stream.

Definition at line 500 of file bmrf_node.cxx.

double bmrf_node::probability const bmrf_gamma_func_sptr gamma,
int  time_step
 

Calculate the probability given the gamma function and neighbors.

Definition at line 221 of file bmrf_node.cxx.

double bmrf_node::probability  ) 
 

Return the probability of this node.

Note:
probability is computed as needed

Definition at line 85 of file bmrf_node.cxx.

void bmrf_node::prune_by_gamma double  min_gamma,
double  max_gamma
[protected]
 

Prune neighbors with a gamma outside this range.

Definition at line 176 of file bmrf_node.cxx.

void bmrf_node::prune_by_probability double  threshold,
bool  relative = false
[protected]
 

Prune neighbors with a probability below threshold.

Definition at line 145 of file bmrf_node.cxx.

void bmrf_node::prune_directed  )  [protected]
 

Prune directed arcs leaving only arcs to nodes which have arcs back to this node.

Definition at line 195 of file bmrf_node.cxx.

bool bmrf_node::purge  )  [protected]
 

Remove any arcs to or from NULL nodes.

Return values:
true if any arcs were removed
false if all arcs are valid

Definition at line 52 of file bmrf_node.cxx.

bool bmrf_node::remove_helper arc_iterator a_itr,
neighbor_type  type
[protected]
 

Remove the arc associated with the outgoing iterator.

Definition at line 332 of file bmrf_node.cxx.

bool bmrf_node::remove_neighbor bmrf_node_sptr  node,
neighbor_type  type = ALL
[protected]
 

Remove node from the neighborhood.

Return values:
true if the node is removed successfully
false if the node was not a neighbor

Definition at line 304 of file bmrf_node.cxx.

void bmrf_node::strip  )  [protected]
 

Strip all of the arcs from this node.

This also removes arcs to and from this node in neighboring nodes

Definition at line 34 of file bmrf_node.cxx.

short bmrf_node::version  )  const
 

Return IO version number;.

Definition at line 492 of file bmrf_node.cxx.


Friends And Related Function Documentation

friend class bmrf_arc [friend]
 

Definition at line 33 of file bmrf_node.h.

friend class bmrf_network [friend]
 

Definition at line 32 of file bmrf_node.h.


Member Data Documentation

vcl_vector<arc_iterator> bmrf_node::boundaries_ [private]
 

The the iterators into neighbors_ that represent the boundary between types.

Definition at line 152 of file bmrf_node.h.

int bmrf_node::frame_num_ [private]
 

The frame number associated with this node.

Definition at line 137 of file bmrf_node.h.

bmrf_gamma_func_sptr bmrf_node::gamma_ [private]
 

The estimate of the gamma function.

Definition at line 143 of file bmrf_node.h.

vcl_list<bmrf_arc_sptr> bmrf_node::in_arcs_ [private]
 

The pointers to incoming arcs.

Definition at line 149 of file bmrf_node.h.

vcl_list<bmrf_arc_sptr> bmrf_node::out_arcs_ [private]
 

The pointers to outgoing arcs.

Definition at line 146 of file bmrf_node.h.

double bmrf_node::probability_ [private]
 

The cached probability value.

Definition at line 140 of file bmrf_node.h.

bmrf_epi_seg_sptr bmrf_node::segment_ [private]
 

A smart pointer to the underlying epi-segment data.

Definition at line 134 of file bmrf_node.h.

vcl_vector<int> bmrf_node::sizes_ [private]
 

The number of neighbors for each type.

Definition at line 155 of file bmrf_node.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:51:55 2008 for contrib/brl/bseg/bmrf by  doxygen 1.4.4