Segment Editor undo queue length

How much memory is used up when the state is saved for Undo in Segment Editor? Sometimes when working with really large datasets (>10GB) in Segment Editor I will tweak SegmentEditorWidget.setup() to set self.editor.setMaximumNumberOfUndoStates(10) to something like 1 or even zero.

This seems to help but I have not done any quantitative comparisons. If it actually does use less memory, would it be useful to have a configurable “Number of undo steps” setting in Segment Editor?

(I’m happy to look into doing this if it would be useful.)

A copy of each modified segmentation layer (3D volume containing non-overlapping segments) is stored in each undo state. You can check the process memory usage to see if it makes a significant difference for you.

Number of undo states could be exposed somewhere on the GUI (maybe in application settings / segmentations), but this adds a little bit of complication and room for user error (user changing this setting to 0 at some point for testing something and then forget about it and not understanding why undo does not work). So, I would only add this if there is a strong, confirmed need for it.

Yeah, I only do it for big datasets with complicated segmentations. I think I’ll just continue with tweaking the source when necessary. I can definitely see where someone might change this in a configuration and forget about it, or inherit a config file and get confused.


1 Like

You don’t need to tweak the source - you can change the number of undo states by a one-line command.

DOH! Yes, this is now painfully obvious. (Insert embarrassed emoji here.)