pandore::Graph3d Class Reference

#include <graph.h>

List of all members.


Detailed Description

A 3D graph.

A graph is a set of nodes connected to some other nodes. The two types of graph are supported: directed and undirected; the type must be specified with the constructor. A node is characterized by a value which determines if the node is active in the representation of the graph or not. A node can reference any of the Pandore object. It indexes an item in a separate array of items by a long value. It is equivalent to a pointer to an objet in an array except that not type is needed.
see The Graphs.


Public Types

typedef Double ValueType

Public Member Functions

Typobj Type () const
std::string Name () const
bool isDirected () const
Long Width () const
Long Height () const
Long Depth () const
Long Size () const
Dimension3d ImageSize () const
PobjectProps Props () const
 Graph3d (bool directed=false)
 Graph3d (Long s, bool directed=false)
 Graph3d (Long s, Long d, Long h, Long w, bool directed=false)
 Graph3d (Long s, const Dimension3d &d, bool directed=false)
 Graph3d (const PobjectProps &p)
 ~Graph3d ()
void New (Long s, Long d, Long h, Long w)
void New (const PobjectProps &p)
void Delete ()
Errc Init (const Reg3d &rgs, const Reg3d &seeds)
Errc Init (const Reg3d &rgs)
Graph3doperator= (const Graph3d &src)
Pobject * Clone () const
GNode< Point3d > * operator[] (Long pos)
const GNode< Point3d > * operator[] (Long pos) const
Errc Add (Long node, Long item, const Point3d &pt)
Errc Add (Long node, Long item)
Errc Add (Long node, Long item, Long z, Long y, Long x)
Errc Del (Long s)
Errc Link (Long s1, Long s2, Double weight=1.0F, bool add=false)
Errc Link (Long s1, Long s2, Long i, Double weight=1.0F, bool add=false)
Errc Unlink (Long s1, Long s2)
Errc Unlink (Long s1, Long s2, Long i)
Errc Merge (Long s1, Long s2)
Errc Split (Long s1, Long s2)
Errc LoadAttributes (FILE *file)
Errc SaveAttributes (FILE *file) const
Errc LoadData (FILE *file)
Errc SaveData (FILE *file) const
Pobject * Mask (const Pobject *mask)
Pobject * UnMask (const Pobject *mask, const Pobject *reference)
 Graph3d (const Graph3d &grs)


Member Typedef Documentation

typedef Double pandore::Graph3d::ValueType
 

The type of the data (for instance Double).


Constructor & Destructor Documentation

pandore::Graph3d::Graph3d bool  directed = false  )  [inline]
 

Creates a new graph with no data.

Parameters:
directed true for creating a directed graph.

pandore::Graph3d::Graph3d Long  s,
bool  directed = false
[inline]
 

Creates a new graph with the specified number of nodes and the specified dimension of the related image. Allocates therefrom the related data.

Warning:
the node value is not initialized with 0.
Parameters:
s the number of nodes.
directed true for creating a directed graph.

pandore::Graph3d::Graph3d Long  s,
Long  d,
Long  h,
Long  w,
bool  directed = false
[inline]
 

Creates a new graph with the specified number of nodes and the specified dimension of the related image. Allocates therefrom the related data.

Warning:
the node value is not initialized with 0.
Parameters:
s the number of nodes.
d the number of bands of the related image.
h the height of the related image.
w the width of the related image.
directed true for creating a directed graph.

pandore::Graph3d::Graph3d Long  s,
const Dimension3d d,
bool  directed = false
[inline]
 

Creates a new graph with the specified number of nodes and the specified dimension of the related image.

Warning:
the node value is not initialized with 0. Allocates therefrom the related data.
Parameters:
s the number of nodes.
d the dimension of the i`mage.
directed true for creating a directed graph.

pandore::Graph3d::Graph3d const PobjectProps &  p  )  [inline]
 

Creates a new graph with the specified properties. Allocates therefrom the related data.

Warning:
the node value is not initialized with 0.
Parameters:
p the properties.

pandore::Graph3d::~Graph3d  )  [inline]
 

Deletes the current graph.

pandore::Graph3d::Graph3d const Graph3d grs  )  [inline]
 

Creates a new graph by copy. Allocates the related data and sets the values with the grs values. If needed casts the values by using the C casting.

Parameters:
grs the specified graph.


Member Function Documentation

Errc pandore::Graph3d::Add Long  node,
Long  item,
Long  z,
Long  y,
Long  x
[inline]
 

Adds the specified node that references the specified item. The coordinates of the node is set to the specified cordinates.

Parameters:
node the index of the node.
item the index of the related item.
z the plane coordinate.
y the row coordinate.
x the column coordinate.
Returns:
SUCCESS or FAILURE.

Errc pandore::Graph3d::Add Long  node,
Long  item
[inline]
 

Adds the specified node that references the specified item. The coordinates of the node is set to (0, 0, 0).

Parameters:
node the index of the node.
item the index of the related item.
Returns:
SUCCESS or FAILURE.

Errc pandore::Graph3d::Add Long  node,
Long  item,
const Point3d pt
 

Adds the specified node that references the specified item.

Parameters:
node the index of the node.
item the index of the related item.
pt the coordinate of the node.

Pobject* pandore::Graph3d::Clone  )  const
 

Creates and returns a distinct copy of this object.

Returns:
a new graph.

Errc pandore::Graph3d::Del Long  s  ) 
 

Deletes the specified node from the graph. Unlinks it from connected nodes.

Parameters:
s the node to be deleted.
Returns:
SUCCESS or FAILURE.

void pandore::Graph3d::Delete  ) 
 

Deletes the graph data.

Long pandore::Graph3d::Depth  )  const [inline]
 

Returns the number of planes of the related image.

Returns:
the depth.

Long pandore::Graph3d::Height  )  const [inline]
 

Returns the number of rows of the related image.

Returns:
the width.

Dimension3d pandore::Graph3d::ImageSize  )  const [inline]
 

Returns the dimension of the related image.

Returns:
the dimension.

Errc pandore::Graph3d::Init const Reg3d rgs  ) 
 

Initializes the graph with the given region map. Each region is represented as a node, and connected regions are represented as a link between the related nodes.

Parameters:
rgs the region map.
Returns:
SUCCESS or FAILURE.

Errc pandore::Graph3d::Init const Reg3d rgs,
const Reg3d seeds
 

Initializes the graph with the given region map. Each region is represented as a node, and connected regions are represented as a link between the related nodes. The seed map is used to set the coordinates of each node.

Parameters:
rgs the region map.
seeds the region map that holds the seeds.
Returns:
SUCCESS or FAILURE.

bool pandore::Graph3d::isDirected  )  const [inline]
 

Returns:
true if the graph is directed.

Errc pandore::Graph3d::Link Long  s1,
Long  s2,
Long  i,
Double  weight = 1.0F,
bool  add = false
 

Links the two specified nodes s1 and s2 by adding two identified edges one from s1 to s2 and one from s2 to s1 and sets the specified value for the link weight, either by adding it to the current weight if add = true or by setting it.

Parameters:
s1 the first node.
s2 the second node.
i the identifier of the edge.
weight the weight for the link.
add if true adds the weight to the current weight, otherwise sets the new value.
Returns:
SUCCESS or FAILURE.

Errc pandore::Graph3d::Link Long  s1,
Long  s2,
Double  weight = 1.0F,
bool  add = false
 

Links the two specified nodes s1 and s2 by adding two edges one from s1 to s2 and one from s2 to s1 and sets the specified value for the link weight, either by adding it to the current weight if add = true or by setting it.

Parameters:
s1 the first node.
s2 the second node.
weight the weight for the link.
add if true adds the weight to the current weight, otherwise sets the new value.
Returns:
SUCCESS or FAILURE.

Errc pandore::Graph3d::LoadAttributes FILE *  file  ) 
 

Loads attribute values from the specified file. Allocates therefrom the related data.

Parameters:
file the file where to read attributes values.
Returns:
SUCCESS or FAILURE in case of IO errors..

Errc pandore::Graph3d::LoadData FILE *  file  ) 
 

Loads data from the specified file.

Parameters:
file the file where to read data.
Returns:
SUCCESS or FAILURE in case of IO errors.

Pobject* pandore::Graph3d::Mask const Pobject *  mask  ) 
 

Creates a new graph where the data are masked by the given mask. It means that value are set to 0 when the related label in the mask is 0.

Parameters:
mask the region map that is used as a mask.
Returns:
a new Graph.

Errc pandore::Graph3d::Merge Long  s1,
Long  s2
 

Merges the two specified nodes.This means keeps only the first node and merges all neighbours of the second node. The result weight is the sum of the weight, but the seed is still the seed of the first node.

Parameters:
s1 the first node.
s2 the second node.
Returns:
SUCCESS or FAILURE.

std::string pandore::Graph3d::Name  )  const [inline]
 

Returns the name of the graph type.

Returns:
the string with the name.

void pandore::Graph3d::New const PobjectProps &  p  )  [inline]
 

Allocates the image data from the specified vector of properties.

Warning:
the node value is not initialized with 0.
Parameters:
p the vector of properties.

void pandore::Graph3d::New Long  s,
Long  d,
Long  h,
Long  w
 

Allocates the data from the specified number of nodes, and the specified dimension of the related image.

Warning:
the node value is not initialized with 0.
Parameters:
s the number of nodes.
d the depth of the related image.
h the height of the related image.
w the width of the related image.

Graph3d& pandore::Graph3d::operator= const Graph3d src  ) 
 

Sets the values of the graph from the specified graph values. If needed, deletes the previous data and reallocs new data.

Parameters:
src the reference graph.

const GNode<Point3d>* pandore::Graph3d::operator[] Long  pos  )  const [inline]
 

Returns the node at the specified coordinates.

Parameters:
pos the coordinates.
Returns:
the node at the specified coordinates.

GNode<Point3d>* pandore::Graph3d::operator[] Long  pos  )  [inline]
 

Returns the node at the specified coordinates.

Parameters:
pos the coordinates.
Returns:
the node at the specified coordinates.

PobjectProps pandore::Graph3d::Props  )  const [inline]
 

Returns the related vector of properties.

Returns:
the vector of properties.

Errc pandore::Graph3d::SaveAttributes FILE *  file  )  const
 

Saves the current attribute values.

Parameters:
file the file.
Returns:
SUCCESS or FAILURE in case of IO errors.

Errc pandore::Graph3d::SaveData FILE *  file  )  const
 

Saves data in the specified file. Allocates therefrom the related data.

Parameters:
file the file where to save data.
Returns:
SUCCESS or FAILURE in case of IO errors.

Long pandore::Graph3d::Size  )  const [inline]
 

Returns the number of nodes.

Errc pandore::Graph3d::Split Long  s1,
Long  s2
 

Splits the first node to create the second node. The list of neighbours, the weight and the seeds are duplicated.

Parameters:
s1 the first node.
s2 the second node.
Returns:
SUCCESS or FAILURE.

Typobj pandore::Graph3d::Type  )  const [inline]
 

Returns the graph identifier.

Returns:
the identifier.

Errc pandore::Graph3d::Unlink Long  s1,
Long  s2,
Long  i
 

Unlinks the two specified nodes (linked be the identified edge). s1 will no longer be a neighbour of s2 (and vice versa).

Parameters:
s1 the first node.
s2 the second node.
i the identifier of the edge
Returns:
SUCCESS or FAILURE.

Errc pandore::Graph3d::Unlink Long  s1,
Long  s2
 

Unlinks the two specified nodes. s1 will no longer be a neighbour of s2 (and vice versa).

Parameters:
s1 the first node.
s2 the second node.
Returns:
SUCCESS or FAILURE.

Pobject* pandore::Graph3d::UnMask const Pobject *  mask,
const Pobject *  reference
 

Creates a new Graph of the same type but where the data are ummasked by the given mask and the given reference image. It means that values are set to the value of the reference object when the related label in the mask is 0.

Parameters:
mask the region map that is used as a mask.
reference the object that is used as a reference.
Returns:
the new Graph.

Long pandore::Graph3d::Width  )  const [inline]
 

Returns the number of columns of the related image.

Returns:
the width.


The documentation for this class was generated from the following file:

The Pantheon project
Image Team GREYC Laboratory
UMR CNRS 6072 - ENSICAEN - University of Caen, France
This page was last modified on 19 June 2015