medpy.graphcut.energy_label.boundary_stawiaski_directed#

medpy.graphcut.energy_label.boundary_stawiaski_directed(graph, label_image, xxx_todo_changeme)[source]#

Boundary term based on the sum of border voxel pairs differences, directed version.

An implementation of the boundary term in [1], suitable to be used with the graph_from_labels function.

The basic definition of this term is the same as for boundary_stawiaski, but the edges of the created graph will be directed.

This boundary_function works as an edge indicator in the original image. In simpler words the weight (and therefore the energy) is obtained by summing the local contrast along the boundaries between two regions.

When the directedness parameter is set to zero, the resulting graph will be undirected and the behaviour equals boundary_stawiaski. When it is set to a positive value, light-to-dark transitions are favored i.e. voxels with a lower intensity (darker) than the objects tend to be assigned to the object. The boundary term is thus changed to:

\[\begin{split}g_{ltd}(x) = \left\{ \begin{array}{l l} g(x) + \beta & \quad \textrm{if $I_i > I_j$}\\ g(x) & \quad \textrm{if $I_i \leq I_j$}\\ \end{array} \right.\end{split}\]

With a negative value for directedness, the opposite effect can be achieved i.e. voxels with a higher intensity (lighter) than the objects tend to be assigned to the object. The boundary term is thus changed to

\[\begin{split}g_{dtl} = \left\{ \begin{array}{l l} g(x) & \quad \textrm{if $I_i > I_j$}\\ g(x) + \beta & \quad \textrm{if $I_i \leq I_j$}\\ \end{array} \right.\end{split}\]

Subsequently the \(g(x)\) in the computation of \(w_{i,j}\) is substituted by \(g_{ltd}\) resp. \(g_{dtl}\). The value \(\beta\) determines the power of the directedness and corresponds to the absolute value of the supplied directedness parameter. Experiments showed values between 0.0001 and 0.0003 to be good candidates.

Parameters:
graphGCGraph

The graph to add the weights to.

label_imagendarray

The label image. Must contain consecutively labelled regions starting from index 1.

gradient_imagendarray

The gradient image.

directednessinteger

The weight of the directedness, a positive number to favour light-to-dark and a negative to dark-to-light transitions. See function description for more details.

Notes

This function requires the gradient magnitude image of the original image to be passed along. That means that graph_from_labels has to be called with boundary_term_args set to the gradient image. This can be obtained e.g. with generic_gradient_magnitude and prewitt from scipy.ndimage.

This function is tested on 2D and 3D images and theoretically works for all dimensionalities.

References

[1]

Stawiaski J., Decenciere E., Bidlaut F. “Interactive Liver Tumor Segmentation Using Graph-cuts and watershed” MICCAI 2008 participation