Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add volume undo/redo support #4771

Merged
merged 28 commits into from
Aug 25, 2020
Merged

Add volume undo/redo support #4771

merged 28 commits into from
Aug 25, 2020

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Aug 18, 2020

This PR adds support for Undo / Redo of volume annotations, while still supporting skeleton undo in e.g. hybrid tracings.

URL of deployed dev instance (used for testing):

Steps to test:

  • Open a hybrid tracing
  • randomly draw around and create some node/trees
  • Use undo/redo as you wish. Undo should redo your last skeleton action or your last brush stroke.
  • Then save the tracing and reload it. Everything should look the same after reloading.

Issues:


@MichaelBuessemeyer
Copy link
Contributor Author

@daniel-wer I just fixed the flow error and added a better type annotation for the join function from redux-saga. => This PR is ready to receive your awesome feedback 🕺

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is extremely cool! You did a very good job implementing this feature and structuring the code, kudos 🚀

I added some suggestions and asked for a couple of clarifications. I'll test next and will report back afterwards.

I also think that we should carefully measure the performance and memory impact of this. A good way would probably be to actually volume trace for 20 slices (as that is the current undo stack size), and undo/redo a couple of times in between and in the end. I would be interested in the memory overhead (using the dev console memory profiler) and whether undoing/redoing feels relatively smooth.

Very excited for this feature to land! ✨

frontend/javascripts/oxalis/model/sagas/save_saga.js Outdated Show resolved Hide resolved
frontend/javascripts/oxalis/model/sagas/save_saga.js Outdated Show resolved Hide resolved
frontend/javascripts/oxalis/model/sagas/save_saga.js Outdated Show resolved Hide resolved
@daniel-wer
Copy link
Member

daniel-wer commented Aug 20, 2020

Testing went mostly really well, I was pleasantly surprised by the performance, really cool! :)

These are the issues I encountered:

  • When clicking with the brush, the change is not recognized and the undo stack is not populated. Only after "stroking" (mouse-dragging) with the brush, all the changes are pushed to the undo stack at once.
  • When undoing a volume change, the resulting change is not saved. The save button doesn't indicate a changed tracing and the tracing can simply be reloaded without a warning of unsaved changes. After reloading the undone change is in fact not undone.
  • With this PR it'll be possible to change the segmentation (via undo) when the merger mode is active. This is otherwise not allowed as the volume annotation buttons are disabled if merger mode is active. I don't have a clever idea how to prevent this, and I don't think it's that important to fix it in this PR, but could you create an issue for this?

@MichaelBuessemeyer
Copy link
Contributor Author

With this PR it'll be possible to change the segmentation (via undo) when the merger mode is active. This is otherwise not allowed as the volume annotation buttons are disabled if merger mode is active. I don't have a clever idea how to prevent this, and I don't think it's that important to fix it in this PR, but could you create an issue for this?

I have two ideas for this:

  1. Before undoing a volume annotation step, check whether the merger mode is activated. If that's the case, show an info toast and do not update the volume data.
  2. When the merger mode gets activated, erase all undo volume states from the undo queue. This way it is impossible to edit the volume with undo.

Both are pretty simple solutions but have disadvantages.

  1. The first option makes it impossible to undo any skeleton actions that were done before the merger mode was activated.
    1. edit skeleton
    2. edit volume
    3. activate merger mode
    4. step 1 cannot be undone
  2. The second option makes it impossible to undo any volume action, after deactivating the merger mode again: e.g.:
    1. edit volume
    2. activate merge mode
    3. deactivate merger mode
    4. first step cannot be undone

Let me know what you think @daniel-wer. I just implemented the first option.

@daniel-wer
Copy link
Member

Let me know what you think @daniel-wer. I just implemented the first option.

Awesome, the first option sounds very good to me 👍

 - notice every brush step as an undo step
 - undo triggers pushqueue
 - prevent undoing volume in merger mode
@MichaelBuessemeyer
Copy link
Contributor Author

@daniel-wer I just fixed everything (CI, your feedback, etc.)

Could you please check the newest changes?

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for thoroughly applying the feedback, I added a couple more comments, nothing major :)

@daniel-wer
Copy link
Member

I tested again and can confirm that the undo of brush-clicking and the saving now works correctly 🎉
The merger mode fix does seem to have a little problem, though, at least it doesn't work as I expected. Undoing a volume change is prevented and the toast is shown, but the change seems to be permanently popped off the undo stack, because if I keep pressing undo, earlier skeleton changes from before the volume change are undone. I would've expected the stack to just stay the same. Undoing further would then only be allowed when turning off the merger mode.

@MichaelBuessemeyer
Copy link
Contributor Author

I just found another bug, that (i guess) was already existing:
How to produce (not very accurate) :

  • open a skeleton tracing
  • create some nodes
  • undo all actions -> this will cause that there is no active node left and the node radius will be reset to 0. This triggers an action that will clear the redo stack.
  • trying redoing the last actions will fail

-> I fixed this by caching the node radius in the settings component, thus preventing a reset to 0 and therefore avoiding the update action.

@MichaelBuessemeyer
Copy link
Contributor Author

MichaelBuessemeyer commented Aug 21, 2020

I tested again and can confirm that the undo of brush-clicking and the saving now works correctly tada
The merger mode fix does seem to have a little problem, though, at least it doesn't work as I expected. Undoing a volume change is prevented and the toast is shown, but the change seems to be permanently popped off the undo stack because if I keep pressing undo, earlier skeleton changes from before the volume change are undone. I would've expected the stack to just stay the same. Undoing further would then only be allowed when turning off the merger mode.

I simple mistake from my side. I just fixed that.

Could you please check the newest version 🤓 📖 @daniel-wer ?

@MichaelBuessemeyer
Copy link
Contributor Author

@daniel-wer I just noticed I forgot to push the code. ^ Here is the fix

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything worked beautifully during my testing 🎉 Great work!

@daniel-wer
Copy link
Member

@MichaelBuessemeyer Please add a changelog entry for this cool new feature :)

@MichaelBuessemeyer MichaelBuessemeyer merged commit 49b1c05 into master Aug 25, 2020
@philippotto philippotto deleted the add-volume-undo branch June 14, 2022 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add undo for volume annotations
2 participants