HomePhabricator
Diffusion MITK df9e230d48f2

BREAKING: Exterior label and setter/getter was removed from LabelSetImage.

Description

BREAKING: Exterior label and setter/getter was removed from LabelSetImage.
Also labelsets do not contain an exterior label (pixel value 0) anymore
(so far each labelset had its own exterior label instance in addition to
the “official” one of the image).

Reason: The structure made it overly complicated to ensure valid states
(correct observer handling, outdated external pointers to exterior labels,
problems that you can get different instances for exterior depending on if
you query at labelset or image level). Also it suggests that you can have
different properties for exterior on different layers/groups, which is not
the case and makes no sense. Also the old naming and structure was
semantically flawed, because it mixes the property of “being the
background” with the property of “being unlabeled”. Often both fall
together, but there are scenarios, where it is important to distinct those
things.

What changed: the exterior label (label instance with label value 0) was
removed everywhere (and is ignored in IO from now on). An constant
UnlabeledLabelValue (==0) was introduced and a dedicated lock state for
such pixels. To query the lockstate for unlabeled or labeled pixel values
a function IsLabelLocked(…) was introduced.

Migration:

  1. if you need to query the lock state, use IsLabelLocked(…)
  2. if you use GetLabel(…) or ExistLabel(…) and the pixel value could == UnlabeledLabelValue, you have to check for that before calling the function, as GetLabel would throw an exception now and ExistLabel now returns false for UnlabeledLabelValue.

Details

Provenance
flocaAuthored on Mar 24 2023, 10:42 AM
flocaPushed on Apr 26 2023, 6:09 PM
Differential Revision
Restricted Differential Revision
Parents
rMITK5e0c4a833afb: fixed bug in rename label shortcut
Branches
Unknown
Tags
Unknown