Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dicom seg shows all labels as color red #1751

Open
AHarouni opened this issue Oct 11, 2024 · 2 comments
Open

Dicom seg shows all labels as color red #1751

AHarouni opened this issue Oct 11, 2024 · 2 comments

Comments

@AHarouni
Copy link
Contributor

AHarouni commented Oct 11, 2024

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 
@SachidanandAlle
Copy link
Collaborator

SachidanandAlle commented Oct 11, 2024

In case of missing, better to pick a (uniform) random color. Is your proposal the same?

I see it's based on the index. Make sure it's lesser than the total array size

@AHarouni
Copy link
Contributor Author

AHarouni commented Oct 11, 2024

I basically am suggesting getting different colors. Having a uniform color would alert the user that the label names are not in the standard list. This is ok only if we provide a way to load his own list with colors.

For simplicity I was proposing just pick random colors. And you are correct, I edited the code by adding a mod for the len of the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants