diff --git a/2_difspot/gtSegmentationDoubleThreshold.m b/2_difspot/gtSegmentationDoubleThreshold.m
index 7ae8817a5415ab10101a940f7c88048601a73f9f..3c9b9f6dd249a04e744f96143f7c342259a9e7ca 100644
--- a/2_difspot/gtSegmentationDoubleThreshold.m
+++ b/2_difspot/gtSegmentationDoubleThreshold.m
@@ -163,10 +163,14 @@ else
     stack.totproj = parameters.acq.nproj;
 end
 
+% don't take more than we need
+parameters.seg.segmentation_stack_size = ...
+    min((parameters.acq.nproj+parameters.seg.maxblobsize(3))*2,...
+    parameters.seg.segmentation_stack_size)
+
 % read in the volume to work on
 % check that the size makes sense
 stack.pad = parameters.seg.maxblobsize(3);
-
 stack.sizeZ = parameters.seg.segmentation_stack_size;
 fprintf('Using %d images in memory (from parameters.seg)\n\n', stack.sizeZ)