pandore::Reg2d Class Reference

#include <region.h>

Inheritance diagram for pandore::Reg2d:

pandore::Img2d< Long > pandore::Imx2d< Long > pandore::Imx3d< Long > List of all members.

Detailed Description

A 2D region map.

A region is defined as a set of connected pixels.
All the pixels of a same region have the same value (called the label, a value in [0, +4294967295])
By convention, the region with the label=0 is considered as a non region (the background).
A Reg2d region map is implemented as a 2D Ulong image where each pixel is a label (in a Ulong precision).
To create a region:

 Reg2d rgs1(256, 256);
 Reg2d *rgs2 = new(rgs1.Props());
 rgs1[10][21] = 10;

For the use of Reg2d images see The Region Maps.


Public Types

typedef Ulong ValueType

Public Member Functions

Typobj Type () const
std::string Name () const
Ulong Labels () const
Ulong Labels (Ulong n)
PobjectProps Props () const
 Reg2d ()
 Reg2d (Long h, Long w)
 Reg2d (const Dimension2d &d)
 Reg2d (const PobjectProps &p)
void New (Long h, Long w)
void New (const Dimension2d &d)
void New (const PobjectProps &p, Ulong *data=0)
void Delete ()
Pobject * Clone () const
ValueTypeVector () const
Band1dr operator[] (Long row)
const Band1dr operator[] (Long row) const
ValueTypeoperator() (Long y, Long x)
const ValueTypeoperator() (Long y, Long x) const
ValueTypeoperator[] (const Point2d &p)
const ValueTypeoperator[] (const Point2d &p) const
Reg2doperator= (const Reg2d::ValueType val)
Reg2doperator= (const Reg2d &rgs)
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)
 Reg2d (const Reg2d &rgs)

Public Attributes

Ulong nlabels

Classes

class  Band1dr
 The 1D image data. More...


Member Typedef Documentation

typedef Ulong pandore::Reg2d::ValueType
 

The type of the labels (for instance Ulong).

Reimplemented from pandore::Img2d< Long >.


Constructor & Destructor Documentation

pandore::Reg2d::Reg2d  )  [inline]
 

Creates a new region map with no size and no data.

pandore::Reg2d::Reg2d Long  h,
Long  w
[inline]
 

Creates a new region map with the specified width and height. Allocates therefrom the related data.

Warning:
the label values are not initialized with 0.
Parameters:
h the height of the map.
w the width of the map.

pandore::Reg2d::Reg2d const Dimension2d d  )  [inline]
 

Creates a new region map with the specified dimension. Allocates therefrom the related data.

Warning:
the label values are not initialized with 0.
Parameters:
d the dimension of the map.

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

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

Warning:
the label values are not initialized with 0.
Parameters:
p the properties.

pandore::Reg2d::Reg2d const Reg2d rgs  )  [inline]
 

Creates the region content by copy. Allocates the related data and sets the values with the rgs values. If needed casts the values by using the C casting.

Parameters:
rgs the specified image.


Member Function Documentation

Pobject* pandore::Reg2d::Clone  )  const [inline, virtual]
 

Creates and returns a distinct copy of this object.

Returns:
a new region map.

Reimplemented from pandore::Img2d< Long >.

void pandore::Reg2d::Delete  )  [inline]
 

Deletes the region map data without deleting the object itself.

Reimplemented from pandore::Imx3d< Long >.

Ulong pandore::Reg2d::Labels Ulong  n  )  [inline]
 

Sets the new higher label value.

Parameters:
n the new higher label value.
Returns:
the new higher label value.

Ulong pandore::Reg2d::Labels  )  const [inline]
 

Returns the higher label value.

Returns:
the higher label value.

Errc pandore::Reg2d::LoadAttributes FILE *  file  )  [virtual]
 

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

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

Reimplemented from pandore::Imx2d< Long >.

Errc pandore::Reg2d::LoadData FILE *  file  )  [virtual]
 

Loads data from the given file.

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

Reimplemented from pandore::Imx3d< Long >.

Pobject* pandore::Reg2d::Mask const Pobject *  mask  )  [virtual]
 

Creates a new Pobject of the same type but 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 region map.

Reimplemented from pandore::Imx2d< Long >.

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

Returns the name of the region type (for instance Reg2d).

Returns:
the string with the name.

Reimplemented from pandore::Img2d< Long >.

void pandore::Reg2d::New const PobjectProps &  p,
Ulong *  data = 0
[inline]
 

Allocates the region map data from the specified properties.

Warning:
the label values are not initialized with 0.
Parameters:
p the properties of the map.

void pandore::Reg2d::New const Dimension2d d  )  [inline]
 

Allocates the region map data from the specified dimension.

Warning:
the label values are not initialized with 0.
Parameters:
d the dimension of the map.

void pandore::Reg2d::New Long  h,
Long  w
[inline]
 

Allocates the region map data from the specified height and width.

Warning:
the label values are not initialized with 0.
Parameters:
h the heigth of the map.
w the width of the map.

const ValueType& pandore::Reg2d::operator() Long  y,
Long  x
const [inline]
 

Returns the specified label at the specified coordinates.

Parameters:
y the y-coordinate.
x the x-coordinate.
Returns:
the label at the specified coordinates.

Reimplemented from pandore::Img2d< Long >.

ValueType& pandore::Reg2d::operator() Long  y,
Long  x
[inline]
 

Returns the specified label at the specified coordinates.

Parameters:
y the y-coordinate.
x the x-coordinate.
Returns:
the label at the specified coordinates.

Reimplemented from pandore::Img2d< Long >.

Reg2d& pandore::Reg2d::operator= const Reg2d rgs  )  [inline]
 

Sets the region map labels with the specified region map labels.

Parameters:
reg a region map.
Returns:
the region map itself.

Reg2d& pandore::Reg2d::operator= const Reg2d::ValueType  val  )  [inline]
 

Sets the labels with the given value. This also sets the higher label value with the given value.

Parameters:
val the value.
Returns:
the region map itself.

const ValueType& pandore::Reg2d::operator[] const Point2d p  )  const [inline]
 

Returns the specified label at the specified coordinates.

Parameters:
p the coordinates.
Returns:
the label at the specified coordinates.

Reimplemented from pandore::Img2d< Long >.

ValueType& pandore::Reg2d::operator[] const Point2d p  )  [inline]
 

Returns the specified label at the specified coordinates.

Parameters:
p the coordinates.
Returns:
the label at the specified coordinates.

Reimplemented from pandore::Img2d< Long >.

const Band1dr pandore::Reg2d::operator[] Long  row  )  const [inline]
 

Returns the line at the specified row.

Parameters:
row the row.
Returns:
the vector at the specified row.

Reimplemented from pandore::Img2d< Long >.

Band1dr pandore::Reg2d::operator[] Long  row  )  [inline]
 

Returns the line at the specified row.

Parameters:
row the row.
Returns:
the vector at the specified row.

Reimplemented from pandore::Img2d< Long >.

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

Returns the related vector of properties.

Returns:
the vector of properties.

Reimplemented from pandore::Imx3d< Long >.

Errc pandore::Reg2d::SaveAttributes FILE *  file  )  const [virtual]
 

Saves the current attribute values.

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

Reimplemented from pandore::Imx2d< Long >.

Errc pandore::Reg2d::SaveData FILE *  file  )  const [virtual]
 

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

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

Reimplemented from pandore::Imx3d< Long >.

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

Returns the region map identifier.

Returns:
the identifier.

Reimplemented from pandore::Img2d< Long >.

Pobject* pandore::Reg2d::UnMask const Pobject *  mask,
const Pobject *  reference
[virtual]
 

Creates a new region map 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:
a new region map.

Reimplemented from pandore::Imx2d< Long >.

ValueType* pandore::Reg2d::Vector  )  const [inline]
 

Returns the region data as a vector.

Returns:
the vector of all data.

Reimplemented from pandore::Img2d< Long >.


Member Data Documentation

Ulong pandore::Reg2d::nlabels
 

The maximum label value: could be different from the number of labels if some labels are unused.


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