medpy.filter.label.relabel_map#
- medpy.filter.label.relabel_map(label_image, mapping, key=<function <lambda>>)[source]#
Relabel an image using the supplied mapping.
The
mapping
can be any kind of subscriptable object. The respective region id is used to access the new value from themapping
. Thekey
keyword parameter can be used to supply another access function. Thekey
function must have the signature key(mapping, region-id) and return the new region-id to assign.- Parameters:
- label_imagearray_like
A nD label map.
- mappingdictionary or subscriptable object
A mapping object.
- keyfunction
Can be used to defined the key-access to the
mapping
object.
- Returns:
- relabel_mapndarray
A label map with new region ids.
- Raises:
- ArgumentError
If a region id is missing in the supplied mapping