SegmentationSlice#
- class caf.base.data_structures.SegmentationSlice(slice_params, naming_order=None)[source]#
Bases:
objectSingle slice of a segmentation.
A slice is defined as a single value for each segment in the segmentations.
- Parameters:
slice_params (dict[str, int]) – Parameters for the slice, where keys are segment names and values are the segment values for this slice e.g. {“p”: 1, “m”: 3}.
naming_order (collections.abc.Sequence[str] | None, optional) – Optional naming order of the segments in this slice. If not provided the order of the keys in slice_params will be used.
Attributes
Return the data of the slice as a dict.
Return the naming order of the segments in this slice.
Methods
__init__(slice_params[, naming_order])Initialize a SegmentationSlice object from parameters dict.
add(segment, value)Create a copy of slice with new segment added.
as_tuple()Generate segment tuple from parameters.
from_tuple(slice_tuple, naming_order)Convert a segmentation slice tuple into parameters.
generate_name([segments])Generate name for a slice of the segmentation from parameters.
get(item[, default])Get value of segment for slice with default.
remove(segment)Create a copy of slice with segment removed.
replace(current, new[, value])Create a copy of slice with current segment replaced with new.
Attributes Documentation
- data#
Return the data of the slice as a dict.
- naming_order#
Return the naming order of the segments in this slice.