Skip to content

feat: enable historyMemo action grouping - #2160

Merged
wayfarer3130 merged 5 commits into
cornerstonejs:mainfrom
pedrokohler:feat-enable-redo-undo-grouping
Jul 10, 2025
Merged

feat: enable historyMemo action grouping#2160
wayfarer3130 merged 5 commits into
cornerstonejs:mainfrom
pedrokohler:feat-enable-redo-undo-grouping

Conversation

@pedrokohler

Copy link
Copy Markdown
Contributor

Context

Currently, if you have a batch of actions, such as clearing multiple annotations at once, cornerstone is not capable of track that and undo/redo these batched actions.

This PR introduces an api of start/end recording, which will enable consumer apps to group actions that are related.

Changes & Results

Example of Before/After with OHIF
Before:

Screenshare.-.2025-06-26.9_06_40.AM.mp4

After:

Screenshare.-.2025-06-26.9_04_40.AM.mp4

Testing

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

@sedghi
sedghi requested a review from wayfarer3130 June 27, 2025 12:26
@wayfarer3130

Copy link
Copy Markdown
Collaborator

Is there one of the CS3D examples that can demonstrate this? I'd prefer to test/display directly within CS3D

@wayfarer3130

Copy link
Copy Markdown
Collaborator

@sedghi - I'm off next week, but the changes look ok, I just want to see an example in CS3D so that I can play with it/test it as a combined set.

@pedrokohler

Copy link
Copy Markdown
Contributor Author

@wayfarer3130 done. Added a new example so that you can play with it.

@wayfarer3130

Copy link
Copy Markdown
Collaborator

@pedrokohler - I found a bug in this related to the preview mode:

  • Do a segmentation annotation, accept it
  • Start group recording
  • Do a segmentation annotation, accept that
  • Do another segmentation annotation, accept that
  • End group recording
  • Undo twice

The first undo marks the segmentations as in preview mode, while the second one marks the original segmentation as in preview mode additionally, but doesn't remove the segmentations after the group recording.

Compaer with/without the group recording.

Comment thread packages/core/src/utilities/historyMemo/index.ts Outdated
Comment thread packages/core/src/utilities/historyMemo/index.ts Outdated

@wayfarer3130 wayfarer3130 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you fix the one bug I found and address the asArray issue - the asArray can go in cs3d core utilities since that type of code gets executed all over the place.

@pedrokohler
pedrokohler requested a review from wayfarer3130 July 9, 2025 12:19
@wayfarer3130
wayfarer3130 merged commit 963a35f into cornerstonejs:main Jul 10, 2025
9 checks passed
@sedghi sedghi mentioned this pull request Aug 25, 2025
pedrokohler added a commit to pedrokohler/cornerstone3D that referenced this pull request Sep 17, 2025
* feat: enable historyMemo action grouping

* feat: add tool history grouping example

* feat: add asArray function

* fix: preview bug

* chore: add jsdocs to asArray
pedrokohler added a commit to pedrokohler/cornerstone3D that referenced this pull request Sep 17, 2025
…redo

CEN-15883 - enable historyMemo action grouping (cornerstonejs#2160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants