binary label map layers

Operating system: windows 10
Slicer version: 4.11.20200930
Expected behavior: keep every segment in different layer when saving after annotation
Actual behavior: all segments merged in one layer



Operating system: windows10
Slicer version: 4.11.20200930
Expected behavior: every segment in different layers after saving
Actual behavior: all segments are automatically collapse 1 layer after saving.
how can i solve it?

A few years ago we did not collapse layers and it led to lots of complaints an inefficiencies. Therefore, I would recommend to keep using the collapsed format and use these code snippets to retrieve metadata and pixel data of segments: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_information_from_segmentation_nrrd_file_header

If this does not work for you then you can submit a feature request to issues.slicer.org asking for adding a flag to the storage node that can disable automatic collapsing on save.

thank you for your reply, i try your suggestion but can not solve my problem. if all segments are in one layer, and my question is when the segments in different layers, I can get the volume information of every segment by exporting the binary labelmap for every segment, and the volume information of each segement is correct, but now, all segments in one layer, when i export the binary labelmap, the volume of each segment is same as each other, and the volume information actually is the volume of the combination of all segments, this is incorrect for me. how can i get the volume information of each segment correctly?

You can use Segment Statistics module to get volume of each segment (and many other metrics, such as surface, bounding box, mean intensity, sphericity, principal axes, …).

If you prefer to compute these yourself then you can extract a single labelmap from a numpy array by indexing, for example you can get segment with label value 5 from mylabelmap numpy array like this segment5 = mylabelmap[mylabelmap==5].