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
mappingcan be any kind of subscriptable object. The respective region id is used to access the new value from themapping. Thekeykeyword parameter can be used to supply another access function. Thekeyfunction 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
mappingobject.
- Returns:
- relabel_mapndarray
A label map with new region ids.
- Raises:
- ArgumentError
If a region id is missing in the supplied mapping