GenericAnatomyColors restart will cause black segment

When we create new segment it is taking segment color from GenericAnatomyColors lookup table. Please correct me if I am wrong.

When we are reaching at the end of segment color list it will start from the beginning, but here is one catch once it restart it will take “0 background 0 0 0 0” as a segment color
which is not ideal instead it should start from “1 tissue 128 174 128 255”

This is how 0th indexed 3D segment looks like.
image

One more thing what is use of 0 background 0 0 0 0 color?
When I removed this line it throwed me this error
image

Can you please elaborate how we can solve this issue.

:pray: Thank you very much

Generic anatomy color table contains over 300 colors, so if you exhausted all those then something is wrong. How did you end up going through all the colors?

You cannot remove the color index 0, as the color table starts from 0 and goes until the largest color index.

Can you please elaborate how we can solve this issue.

Using black as segment color is not a mistake, but I agree that a black segment does not look good, so I’ve updated the color selection implementation to skip the background when the restarting the color allocation.

To make it easier to set custom segment coloring schemes, I’ve added a method to set a custom color table node for default segment colors:

displayNode = getNode('Segmentation').GetDisplayNode()
displayNode.SetSegmentColorGeneratorSourceColorNodeID('vtkMRMLColorTableNodeFileDarkBrightChartColors.txt')
1 Like

I was just testing by shorting the length of table and observing what happens if user add over 300 colors, maybe this happens when pigs fly.

Thank you very much sir.