SegmentationSlice.replace#

SegmentationSlice.replace(current, new, value=None)[source]#

Create a copy of slice with current segment replaced with new.

Parameters:
  • current (str) – Name of segments.

  • new (str) – Name of segments.

  • value (int | None) – Value to set for new segment, if not provided uses value of current segment. Value of current segment isn’t always valid for new segment.

Raises:

ValueError – If new segment is already in the slice or current segment isn’t.

Return type:

SegmentationSlice