Loading seg.nrrd files very slow or failing

Hello everyone,
Still very new to Slicer so apologies if this is an obvious question/answer.
I’m working on the linux version of slicer on a cluster in interactive mode.
We have finished segmenting a volume of ~10GB and ended up with seg.nrrd files containing about 20 segments. The segmentation file is a few dozens of MB. The volume file (nifti format) opens up fast and well. But the seg.nrrd file will no longer open and slicer displays the following error message:
the application has run out of memory, increasing swap size in system settings or asking more ram may dix this issue

the message detail is
exception thrown in event: std::bad_array_new_length

Thanks to you all
best

It sounds like you are just out of memory on that machine. Perhaps you can add swap space or if not reduce the size of the volumes/segmentations with cropping or downsampling.

Thanks pieper,
Apparently, both MEM and GPU showed very little beeing used by slicer if I tried to open just the seg.nrrd file (which crashed after loading only 2 percent) and I work on slicer using a cluster that has not trouble opening a 10GB file in less than a coupe of secs so I don’t understand. It seems more related to the way slicer is handling seg.nrrd in our configuration it seems.
If we change the hierarchy of the segments into individual segmentation files (all segments were originally saved under the same segmentation file if that makes sense), then we don’t seem to have a problem.
So new questions: When should we create segments with one segmentation (I guess for example when you want to use “grow from seeds” which was our case) ?
Instead of creating segments in many segmentation files ?
Thanks again
S

A single segmentation file should not have more overhead than individual files. Perhaps there’s an implementation issue to be optimized. Let us know if you can narrow this down to a reproducible example.

Maybe you have saved the segmentation with the closed surface representation enabled. In this case the closed surface representation is regenerated from the binary labelmap representation, which can be very time consuming for large segmentations. You can see the list of representations in the .seg.nrrd file header.

Thanks Lassoan,
Whilst we “fixed” the issue by saving segments in different seg.nrrd files, I would still like to understand where I would find the list of representations and figure out if we saved with closed surface representation.
Here are the first few lines of the seg file we have troubles oppening:

NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned char
dimension: 3
space: left-posterior-superior
sizes: 1169 866 1426
space directions: (-0.0067510627968645764,-0.00083291358304330766,9.4715033884586736e-05) (2.3634721868794243e-05,-0.00095757281621430216,-0.0067361641356531339) (0.00083788387205647715,-0.0066829832240598236,0.00095295284412112572)
kinds: domain domain domain
encoding: gzip
space origin: (-0.0014730307956838818,-0.0021191801785636769,-0.00142300218551248)
Segment0_Color:=0.854902 1 1
Segment0_ColorAutoGenerated:=1
Segment0_Extent:=0 1168 0 865 0 1425
Segment0_ID:=Segment_1
Segment0_LabelValue:=1
Segment0_Layer:=0
Segment0_Name:=TBV
Segment0_NameAutoGenerated:=0
Segment0_Tags:=Segmentation.Status:notstarted|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy

Kind regards and thank you all

Could you please copy here the content of the Segmentation_MasterRepresentation line? (it is a bit further below in the file header)

You can prevent creating closed surface representation on load if you set that line to:

Segmentation_MasterRepresentation:=Binary labelmap

Hi lassoan,
I found the segmentation_masterrepresentation and it is set to Binary labelmap
Segmentation_MasterRepresentation:=Binary labelmap

But in case you may be able to find something else, here is the full header for the 17 segments
I noticed this for example:
Segmentation_ContainedRepresentationNames:=Binary labelmap|Closed surface|

NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned char
dimension: 3
space: left-posterior-superior
sizes: 1169 866 1426
space directions: (-0.0067510627968645764,-0.00083291358304330766,9.4715033884586736e-05) (2.3634721868794243e-05,-0.00095757281621430216,-0.0067361641356531339) (0.00083788387205647715,-0.0066829832240598236,0.00095295284412112572)
kinds: domain domain domain
encoding: gzip
space origin: (-0.0014730307956838818,-0.0021191801785636769,-0.00142300218551248)
Segment0_Color:=0.854902 1 1
Segment0_ColorAutoGenerated:=1
Segment0_Extent:=0 1168 0 865 0 1425
Segment0_ID:=Segment_1
Segment0_LabelValue:=1
Segment0_Layer:=0
Segment0_Name:=TBV
Segment0_NameAutoGenerated:=0
Segment0_Tags:=Segmentation.Status:notstarted|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^91720002^Body Substance~SCT^74947009^Gas~^^~Anatomic codes - DICOM master list~^^~^^|
Segment10_Color:=0.435294 0.772549 0.513725
Segment10_ColorAutoGenerated:=1
Segment10_Extent:=0 1168 0 865 0 1425
Segment10_ID:=Segment_7
Segment10_LabelValue:=7
Segment10_Layer:=0
Segment10_Name:=HP-rest
Segment10_NameAutoGenerated:=0
Segment10_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^85756007^Tissue~SCT^83555006^Lymphatic vessel~^^~Anatomic codes - DICOM master list~^^~^^|
Segment11_Color:=0.564706 0.933333 0.564706
Segment11_ColorAutoGenerated:=1
Segment11_Extent:=0 1168 0 865 0 1425
Segment11_ID:=Segment_8
Segment11_LabelValue:=8
Segment11_Layer:=0
Segment11_Name:=RHP
Segment11_NameAutoGenerated:=0
Segment11_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^49755003^Morphologically Altered Structure~SCT^4147007^Mass~^^~Anatomic codes - DICOM master list~^^~^^|
Segment12_Color:=1 0.901961 0.541176
Segment12_ColorAutoGenerated:=1
Segment12_Extent:=0 1168 0 865 0 1425
Segment12_ID:=Segment_11
Segment12_LabelValue:=11
Segment12_Layer:=0
Segment12_Name:=midbrain
Segment12_NameAutoGenerated:=0
Segment12_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^123037004^Anatomical Structure~SCT^31640002^Occipital bone~^^~Anatomic codes - DICOM master list~^^~^^|
Segment13_Color:=0.901961 0.862745 0.27451
Segment13_ColorAutoGenerated:=1
Segment13_Extent:=0 1168 0 865 0 1425
Segment13_ID:=Segment_12
Segment13_LabelValue:=12
Segment13_Layer:=0
Segment13_Name:=pont
Segment13_NameAutoGenerated:=0
Segment13_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^123037004^Anatomical Structure~SCT^87759004^Female internal genitalia~^^~Anatomic codes - DICOM master list~^^~^^|
Segment14_Color:=0.498039 0.498039 0.498039
Segment14_ColorAutoGenerated:=1
Segment14_Extent:=0 1168 0 865 0 1425
Segment14_ID:=Segment_17
Segment14_LabelValue:=17
Segment14_Layer:=0
Segment14_Name:=medulla
Segment14_NameAutoGenerated:=0
Segment14_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^123037004^Anatomical Structure~SCT^74872008^Frontal bone~^^~Anatomic codes - DICOM master list~^^~^^|
Segment15_Color:=0.784314 0.784314 0.921569
Segment15_ColorAutoGenerated:=1
Segment15_Extent:=0 1168 0 865 0 1425
Segment15_ID:=Segment_13
Segment15_LabelValue:=13
Segment15_Layer:=0
Segment15_Name:=cervelet_molecular layer (gris)
Segment15_NameAutoGenerated:=0
Segment15_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^123037004^Anatomical Structure~SCT^87759004^Female internal genitalia~^^~Anatomic codes - DICOM master list~^^~^^|
Segment16_Color:=0.980392 0.980392 0.823529
Segment16_ColorAutoGenerated:=1
Segment16_Extent:=0 1168 0 865 0 1425
Segment16_ID:=Segment_14
Segment16_LabelValue:=14
Segment16_Layer:=0
Segment16_Name:=cervelet_granular layer (noir)
Segment16_NameAutoGenerated:=0
Segment16_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^123037004^Anatomical Structure~SCT^87759004^Female internal genitalia~^^~Anatomic codes - DICOM master list~^^~^^|
Segment17_Color:=0.956863 0.839216 0.192157
Segment17_ColorAutoGenerated:=1
Segment17_Extent:=0 1168 0 865 0 1425
Segment17_ID:=Segment_15
Segment17_LabelValue:=15
Segment17_Layer:=0
Segment17_Name:=cervelet_arbor vitae
Segment17_NameAutoGenerated:=0
Segment17_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^123037004^Anatomical Structure~SCT^87759004^Female internal genitalia~^^~Anatomic codes - DICOM master list~^^~^^|
Segment1_Color:=0.501961 0.682353 0.501961
Segment1_ColorAutoGenerated:=1
Segment1_Extent:=0 1168 0 865 0 1425
Segment1_ID:=Segment_2
Segment1_LabelValue:=2
Segment1_Layer:=0
Segment1_Name:=Cortex
Segment1_NameAutoGenerated:=0

Many thanks for your help again
kind regards