bioprocessing  5.1.2
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. More...
 
typedef VolumeGraphRef< T, PointGraph
 Graph type. More...
 
typedef Graph::Vertex Vertex
 Vertex type. More...
 
typedef Graph::Edge Edge
 Edge type. More...
 
typedef CoustyStreamRef< VertexStream
 Stream type (a set of vertices) More...
 
typedef CoustyFlowMapRef< Vertex, L > FlowMap
 FlowMap type (the labelled image) More...
 

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) More...
 
void set2D ()
 When 2D mode is active, a 2D connectivity is used (4XY) More...
 
carto::VolumeRef< L > execute (carto::VolumeRef< T > in)
 Allocate and return the watershed segmentation of the input image. More...
 
void execute (carto::VolumeRef< T > in, carto::VolumeRef< L > out)
 Return the watershed segmentation of the input image into an already allocated volume. More...
 
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. More...
 
computeStream (Vertex x)
 Follows the descent stream from vertex v. More...
 
bool findEdge (Vertex y, Vertex &z)
 Finds an edge of minimum altitude for y. More...
 
void setLabel (L lab)
 Sets the label lab for all vertices in the stream _s. More...
 

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.

◆ ~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.

◆ 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.

Referenced by 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.

◆ 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.

◆ getMinima()

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

Definition at line 71 of file coustywatershed.h.

References bio::CoustyWatershed< T, L >::_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 bio::CoustyWatershed< T, L >::_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 bio::CoustyWatershed< T, L >::_3d.

◆ setLabel()

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

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

Definition at line 157 of file coustywatershed.h.

◆ setQuiet()

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

Definition at line 58 of file coustywatershed.h.

References bio::CoustyWatershed< T, L >::setVerbose().

◆ setVerbose()

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

Member Data Documentation

◆ _3d

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

◆ _g

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

Definition at line 89 of file coustywatershed.h.

◆ _psi

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

Definition at line 91 of file coustywatershed.h.

Referenced by bio::CoustyWatershed< T, L >::getMinima().

◆ _s

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

Definition at line 90 of file coustywatershed.h.

◆ _verbose

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

Definition at line 92 of file coustywatershed.h.

Referenced by bio::CoustyWatershed< T, L >::setVerbose().


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