Previous topic

medpy.graphcut.graph.Graph.__init__

Next topic

medpy.graphcut.graph.Graph.get_edges

This Page

medpy.graphcut.graph.Graph.add_tweights

Graph.add_tweights(tweights)[source]

Adds t-weights to the current collection of t-weights, overwriting already existing ones.

Parameters:

tweights : dict

A dictionary with node_ids as keys and (weight-to-source, weight-to-sink) tuples as values.

Notes

The weights for nodes directly connected to either the source or the sink are best set using set_source_nodes or set_sink_nodes to ensure consistency of their maximum values.