bioprocessing 6.0.4
bio::CoustyWatershed< T, L > Class Template Reference

Watershed implementation as described in Cousty et al - Watershed cuts: minimum spanning forests and the drop of water principle (2007) The computation is done in linear time. More...

#include <bioprocessing/watershed/coustywatershed.h>

Collaboration diagram for bio::CoustyWatershed< T, L >:

Public Types

typedef Point4dl Point
 Point type.
 
typedef VolumeGraphRef< T, PointGraph
 Graph type.
 
typedef Graph::Vertex Vertex
 Vertex type.
 
typedef Graph::Edge Edge
 Edge type.
 
typedef CoustyStreamRef< VertexStream
 Stream type (a set of vertices)
 
typedef CoustyFlowMapRef< Vertex, L > FlowMap
 FlowMap type (the labelled image)
 

Public Member Functions

 CoustyWatershed ()
 
 ~CoustyWatershed ()
 
void setVerbose (int verbose=1)
 
void setQuiet ()
 
void set3D ()
 When 3D mode is active, a 3D connectivity is used (6XYZ)
 
void set2D ()
 When 2D mode is active, a 2D connectivity is used (4XY)
 
carto::VolumeRef< L > execute (carto::VolumeRef< T > in)
 Allocate and return the watershed segmentation of the input image.
 
void execute (carto::VolumeRef< T > in, carto::VolumeRef< L > out)
 Return the watershed segmentation of the input image into an already allocated volume.
 
carto::VolumeRef< L > getMinima ()
 

Protected Member Functions

void computeWatershed ()
 Iterates on the vertices of the image, and for each one follows a descent stream until it encounters a labelled vertex or a local minima.
 
computeStream (Vertex x)
 Follows the descent stream from vertex v.
 
bool findEdge (Vertex y, Vertex &z)
 Finds an edge of minimum altitude for y.
 
void setLabel (L lab)
 Sets the label lab for all vertices in the stream _s.
 

Protected Attributes

Graph _g
 
Stream _s
 
FlowMap _psi
 
int _verbose
 
bool _3d
 

Detailed Description

template<typename T, typename L>
class bio::CoustyWatershed< T, L >

Watershed implementation as described in Cousty et al - Watershed cuts: minimum spanning forests and the drop of water principle (2007) The computation is done in linear time.

In order to save memory, this implementations uses a volume and not a classic graph.

Definition at line 39 of file coustywatershed.h.

Member Typedef Documentation

◆ Edge

template<typename T, typename L>
typedef Graph::Edge bio::CoustyWatershed< T, L >::Edge

Edge type.

Definition at line 46 of file coustywatershed.h.

◆ FlowMap

template<typename T, typename L>
typedef CoustyFlowMapRef<Vertex,L> bio::CoustyWatershed< T, L >::FlowMap

FlowMap type (the labelled image)

Definition at line 48 of file coustywatershed.h.

◆ Graph

template<typename T, typename L>
typedef VolumeGraphRef<T,Point> bio::CoustyWatershed< T, L >::Graph

Graph type.

Definition at line 44 of file coustywatershed.h.

◆ Point

template<typename T, typename L>
typedef Point4dl bio::CoustyWatershed< T, L >::Point

Point type.

Definition at line 43 of file coustywatershed.h.

◆ Stream

template<typename T, typename L>
typedef CoustyStreamRef<Vertex> bio::CoustyWatershed< T, L >::Stream

Stream type (a set of vertices)

Definition at line 47 of file coustywatershed.h.

◆ Vertex

template<typename T, typename L>
typedef Graph::Vertex bio::CoustyWatershed< T, L >::Vertex

Vertex type.

Definition at line 45 of file coustywatershed.h.

Constructor & Destructor Documentation

◆ CoustyWatershed()

template<typename T, typename L>
bio::CoustyWatershed< T, L >::CoustyWatershed ( )
inline

Definition at line 52 of file coustywatershed.h.

References _3d, _g, _psi, _s, and _verbose.

◆ ~CoustyWatershed()

template<typename T, typename L>
bio::CoustyWatershed< T, L >::~CoustyWatershed ( )
inline

Definition at line 53 of file coustywatershed.h.

Member Function Documentation

◆ computeStream()

template<typename T, typename L>
L bio::CoustyWatershed< T, L >::computeStream ( Vertex x)
protected

◆ computeWatershed()

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::computeWatershed ( )
protected

Iterates on the vertices of the image, and for each one follows a descent stream until it encounters a labelled vertex or a local minima.

This label (or new label if it's a new local minima) is set to all the vertices of the stream.

Definition at line 125 of file coustywatershed.h.

References _psi, _verbose, computeStream(), and setLabel().

Referenced by execute().

◆ execute() [1/2]

template<typename T, typename L>
carto::VolumeRef< L > bio::CoustyWatershed< T, L >::execute ( carto::VolumeRef< T > in)

Allocate and return the watershed segmentation of the input image.

Definition at line 101 of file coustywatershed.h.

References execute().

Referenced by execute(), and bio::Watershed< T, L >::execute().

◆ execute() [2/2]

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::execute ( carto::VolumeRef< T > in,
carto::VolumeRef< L > out )

Return the watershed segmentation of the input image into an already allocated volume.

Definition at line 111 of file coustywatershed.h.

References _3d, _g, _psi, _s, and computeWatershed().

◆ findEdge()

template<typename T, typename L>
bool bio::CoustyWatershed< T, L >::findEdge ( Vertex y,
Vertex & z )
protected

Finds an edge of minimum altitude for y.

Definition at line 203 of file coustywatershed.h.

References _g, and _s.

Referenced by computeStream().

◆ getMinima()

template<typename T, typename L>
carto::VolumeRef< L > bio::CoustyWatershed< T, L >::getMinima ( )
inline

Definition at line 71 of file coustywatershed.h.

References _psi.

Referenced by bio::Watershed< T, L >::execute().

◆ set2D()

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::set2D ( )
inline

When 2D mode is active, a 2D connectivity is used (4XY)

Definition at line 62 of file coustywatershed.h.

References _3d.

Referenced by bio::Watershed< T, L >::execute().

◆ set3D()

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::set3D ( )
inline

When 3D mode is active, a 3D connectivity is used (6XYZ)

Definition at line 60 of file coustywatershed.h.

References _3d.

◆ setLabel()

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::setLabel ( L lab)
protected

Sets the label lab for all vertices in the stream _s.

Definition at line 157 of file coustywatershed.h.

References _psi, and _s.

Referenced by computeWatershed().

◆ setQuiet()

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::setQuiet ( )
inline

Definition at line 58 of file coustywatershed.h.

References setVerbose().

◆ setVerbose()

template<typename T, typename L>
void bio::CoustyWatershed< T, L >::setVerbose ( int verbose = 1)
inline

Definition at line 57 of file coustywatershed.h.

References _verbose.

Referenced by bio::Watershed< T, L >::execute(), and setQuiet().

Member Data Documentation

◆ _3d

template<typename T, typename L>
bool bio::CoustyWatershed< T, L >::_3d
protected

Definition at line 93 of file coustywatershed.h.

Referenced by CoustyWatershed(), execute(), set2D(), and set3D().

◆ _g

template<typename T, typename L>
Graph bio::CoustyWatershed< T, L >::_g
protected

Definition at line 89 of file coustywatershed.h.

Referenced by computeStream(), CoustyWatershed(), execute(), and findEdge().

◆ _psi

template<typename T, typename L>
FlowMap bio::CoustyWatershed< T, L >::_psi
protected

◆ _s

template<typename T, typename L>
Stream bio::CoustyWatershed< T, L >::_s
protected

Definition at line 90 of file coustywatershed.h.

Referenced by computeStream(), CoustyWatershed(), execute(), findEdge(), and setLabel().

◆ _verbose

template<typename T, typename L>
int bio::CoustyWatershed< T, L >::_verbose
protected

Definition at line 92 of file coustywatershed.h.

Referenced by computeWatershed(), CoustyWatershed(), and setVerbose().


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