Bad allocation exception

Operating system:windows
Slicer version:4.11 2020-6-15
Expected behavior:The segment operation can be done successfully.
Actual behavior: bad allocation exception popped up.
I add a CT image volume which contains 2748 images. and then i use “Threshold” to segment first, and then I clicked “Islands” and choose “Remove small islands” to remove the islands which voxel number is smaller than 500. And then the exception popped up. The cpu memory occupied by Slicer app is up to almost 8 GB. see the screenshot below.

CPU-MEMORY

That’s not really a bug, you just ran out of memory. Options are to get more memory, allocate more virtual memory, crop the volume, or choose different segmentation methods. For example, you might try a denoising filter on the images first, so you have fewer islands.

I see, thanks a lot.

Is it possible to catch these bad allocation errors and display a proper out of memory error with out standard suggestion of either increasing the physical memory, virtual memory or downsample the image.
@pieper @lassoan @jcfr

I was thinking the same thing - bad allocation may not be clear to non-programmers, and it is misleading in this case, since it says it’s a Slicer error, which implies bug. bad allocation is still a pretty non-specific error because it could be models or algorithms throwing the error so users will still need to come up with their own strategy to fix it. Most of the message is correct though, since we don’t know where the error occurred it’s not recoverable in general and the user should save and restart the application.

I added [an issue]. Here’s the code in case anyone wants to take a shot at it.

1 Like

Good idea, I’ve added an issue to not forget about it: https://github.com/Slicer/Slicer/issues/5011

1 Like