Bad_alloc error while using margin effect in Segment editor module

Hello Everyone,

I’ve a 3D volume like this.
For the suggestions offered here, I’m trying to use Scissors option in Segment Editor to extract a subvolume.

I used the circular option in “Scissors” tab to cut the segment. After obtaining the circular volume, I used the “islands” effect to retain the largest island. Using “Islands” effect on the whole volume worked fine, but I am not sure why memory issues (“bad_alloc”) occurs for this small volume.

image

Unable to allocate 705421132 elements of size 4 bytes.

Second try:

QXcbConnection: XCB error: 8 (BadMatch), sequence: 24430, resource id: 2622306, major code: 42 (SetInputFocus), minor code: 0
10 islands created (566 ignored)
Unable to allocate 705421132 elements of size 1 bytes.
Traceback (most recent call last):
  File "/folder/Slicer-4.11.0-2020-05-19-linux-amd64/lib/Slicer-4.11/qt-scripted-modules/SegmentEditorEffects/SegmentEditorIslandsEffect.py", line 115, in onApply
    self.splitSegments(minimumSize = minimumSize, maxNumberOfSegments = 1)
  File "/folder/Slicer-4.11.0-2020-05-19-linux-amd64/lib/Slicer-4.11/qt-scripted-modules/SegmentEditorEffects/SegmentEditorIslandsEffect.py", line 223, in splitSe
    self.scriptedEffect.modifySegmentByLabelmap(segmentationNode, segmentID, modifierImage, modificationMode)
MemoryError: std::bad_alloc: std::bad_alloc

I’d like to ask for inputs on what can be done to overcome this error

Scissors effect just blanks out voxels, does not crop the volume. If you cannot add a few 10GB physical RAM and you find that configuring more virtual memory (swap space) results in too slow computation then you can reduce your image size before you start segmentation by cropping and/or resampling your input volume using “Crop volume” module.