A group index is positional (list-like) -> IndexError; a label value is a sparse key (dict-like) -> KeyError. Both subclass Python's LookupError, so callers can catch any miss uniformly.
| 217 | // sparse key (dict-like) -> KeyError. Both subclass Python's LookupError, so |
| 218 | // callers can catch any miss uniformly. |
| 219 | void RequireGroup(const MultiLabelSegmentation& seg, MultiLabelSegmentation::GroupIndexType index) |
| 220 | { |
| 221 | if (!seg.ExistGroup(index)) |
| 222 | throw py::index_error("Group index " + std::to_string(index) + " does not exist"); |
| 223 | } |
| 224 | |
| 225 | void RequireLabel(const MultiLabelSegmentation& seg, Label::PixelType value) |
| 226 | { |
no test coverage detected