Project-MONAI / Project-MONAI/MONAILabel

Dicom seg shows all labels as color red

Open
#1,751 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
891
Forks
269
Avg merge
15h 41m
Merged PRs (30d)
1

Description

Describe the bug
When creating a dicom seg object all segments show up as red unless labels are in the
https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/datastore/utils/colors.py

Expected behavior
Each segment should have different color

Proposed fix
https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/datastore/utils/convert.py#L98
change to

out side the loop do 
GENERIC_ANATOMY_COLORS_list = list(GENERIC_ANATOMY_COLORS.values())

        if name in GENERIC_ANATOMY_COLORS:
            rgb = list(info.get("color", GENERIC_ANATOMY_COLORS.get(name, (255, 0, 0))))[0:3]
        else:
            rgb = GENERIC_ANATOMY_COLORS_list[(i%len(GENERIC_ANATOMY_COLORS_list))+1] # picks index from list skipping the background 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in monailabel/datastore/utils/convert.py around line 98 and inspect the color definitions in monailabel/datastore/utils/colors.py. Reproduce DICOM SEG conversion with labels outside the predefined anatomy colors and verify that each segment receives a different color instead of red.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.