File tree Expand file tree Collapse file tree
monailabel/datastore/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 332332# Distinct, non-background colors used to give segments without a known anatomy
333333# name (and without an explicit color) different colors instead of all defaulting
334334# to red. See issue #1751.
335- _FALLBACK_COLORS = [color for name , color in GENERIC_ANATOMY_COLORS .items () if name != _BACKGROUND_KEY ]
335+ _FALLBACK_COLORS = list (
336+ dict .fromkeys (color for name , color in GENERIC_ANATOMY_COLORS .items () if name != _BACKGROUND_KEY )
337+ )
336338
337339
338340def get_segment_color (name , info = None , index = 0 ):
Original file line number Diff line number Diff line change 1313
1414from monailabel .datastore .utils .colors import GENERIC_ANATOMY_COLORS , get_segment_color
1515
16- # Number of unnamed segments used to check that fallback colors are distinct.
17- _UNNAMED_SEGMENTS = 5
16+ # Number of unnamed segments needed to cover the fallback palette's first
17+ # duplicate RGB value, which previously appeared at indices 4 and 16.
18+ _UNNAMED_SEGMENTS = 17
1819# The color every unnamed segment used to collapse to before the fix (issue #1751).
1920_LEGACY_RED = [255 , 0 , 0 ]
2021# Black background color that must never be assigned to a segment.
You can’t perform that action at this time.
0 commit comments