Converting labelmapvolume node with only one label to segmentation node does not use colour table

Hi all,

I have a labelmap volume node with only 1 label and I am using a custom LUT for it. When I convert the labelmap volume node to a segmentation node, the segment inside does not respect the colour table name for that label, but rather, it names it after the node name.

If the labelmap volume node has 2 labels or more, and a custom LUT is loaded, converting to a segmentation node will create segments that respect the colour table name for those labels.

I think this behaviour should be changed! What do you guys think?

Screenshot 2020-10-02 152441

Vince

1 Like

Thanks for reporting! Iā€™ll take a look at it.

4 Likes

Hi,
I am facing similar issue when I try to ExportSegmentsToLabelmapNode or ImportLabelmapToSegmentationNode with only one segment programmatically. The labelmap node ignores the provided color table and when doing ā€œImportLabelmapToSegmentationNodeā€ makes a default segmentID with name labelmapvolume (this is after I ImportLabelmapToSegmentationNode). The workaround I do for this issue so far is to

  1. Make new segment
  2. Deepcopy new segment by newSegment->DeepCopy()
  3. Remove old segment, name new segment as per the required segment ID and add to segmentation node

This workaround is working so far but would like to know if there is any fix for this issue. Thanks

Iā€™ve just checked and this works well in latest Slicer Preview Release. If the latest preview release does not work as you expect then please describe the exact steps you perform. What do you mean by ā€œthe labelmap node ignores the provided color tableā€? What did you do, what did you expect to happen, and what happened instead?

1 Like

Hi @lassoan, the issue is exactly as shown in screenshot by the thread creator. It is like the segment ID does not matches the color table color name when there is only one segment even when I try to set the colortable node to the display node from SetAndObserveColorNodeID. I tried manually setting the name of segment but it only changes the name tag but does not change segment ID. I hope this makes it more clear. I will try with latest preview release and let you know.

@sogo

Yes, this fix was apparently made here:
BUG: Set segment name from color table when the labelmap has one label Ā· Slicer/Slicer@ca7d090 Ā· GitHub.

1 Like

@lassoan @kpopuri Thank you, tested it and the issue is fixed.

2 Likes

Thanks @Sunderlandkyl and @lassoan !

2 Likes