-
Notifications
You must be signed in to change notification settings - Fork 24
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
Enable merger mode in skeleton and hybrid tracings #3619
Enable merger mode in skeleton and hybrid tracings #3619
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job 👍 Thanks for integrating and cleaning up the merger mode script. I left some comments and also have one other thought:
I know that the overall structure of the script wasn't created by you, but I think we can still improve it. At the moment, the implementation mixes function declarations and high-level calls, which makes the structure a bit hard to grasp in my opinion. My suggestion would be to make use of a structure like this:
// Note that mergerModeState is passed in here, which enables the definition to be
// outside of enableMergerMode
function mapSegmentColorToTree(mergerModeState, segId, treeId) {
...
}
...
function getAllNodesWithTreeId() {
...
}
async function createNodeOverwrite(...) { ... }
export function enableMergerMode() {
const unregisterKeyHandlers = [];
const mergerModeState = {
mergerModeState: ...,
segmentationOn: false,
...
};
unregisterKeyHandlers.push(
api.utils.registerKeyHandler("9", () => {
changeOpacity(mergerModeState);
}),
);
// ...
}
export function disableMergerMode() {...}
That way, the enable function would be more concise.
Also, it would be really cool if you could add flow typing to the module :)
app/assets/javascripts/oxalis/model/helpers/overwrite_action_middleware.js
Outdated
Show resolved
Hide resolved
@philippotto What do you think about improving the UX?
Btw. this PR is ready for another review 🙂 |
Nice, thanks for the refactoring!
For simplicity, I'd always assume that the user wants the initial processing (that was the previous behavior, too).
Yes, that's a good idea. I'd suggest to show a modal when checking the checkbox which says: "You just enabled the merger mode. This mode allows to merge segmentation cells by creating trees and nodes. Each tree maps the marked segments (the ones where nodes were created in) to one new segment." As long as the initial processing is not done, the "Ok" button of the modal should be disabled. Below the explanation text there could be something like "At the moment, the existing trees are used to merge segments. This dialog can be closed after the initial processing has been completed". |
… node; added info modal that is displayed when enableing merger mode
@philippotto I added a modal that opens up when the merger mode is enabled. It shortly explains the merger mode and is only closeable when the preprocessing of already existing trees finished. I also parallelized the initial processing instead of using the recursive variant |
app/assets/javascripts/oxalis/view/settings/user_settings_view.js
Outdated
Show resolved
Hide resolved
app/assets/javascripts/oxalis/view/settings/merger_mode_modal_view.js
Outdated
Show resolved
Hide resolved
…ble-merger-mode-in-hybrid-tracings
Sorry for letting this slip through the cracks and thanks for nagging me! I noticed two things during testing:
|
…ble-merger-mode-in-hybrid-tracings
…alableminds/webknossos into enable-merger-mode-in-hybrid-tracings
I fixed this by creating a new variable in the temporary configuration of the store. The option refresh is caused because the settings view is recreated each time it is reopened. So persisting it via state is not possible so I choose the store to do this 🙂
This is weird, I tried it out and starting without any node and then enabling the merger mode in hybrid tracings works fine. But having nodes seems to break the preprocessing. I will investigate this. |
@@ -254,7 +254,7 @@ class TracingApi { | |||
* api.tracing.setActiveTree(3); | |||
*/ | |||
setActiveTree(treeId: number) { | |||
const tracing = Store.getState().tracing; | |||
const { tracing } = Store.getState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes were created when I saved this file. I think this is just an optimization made by the eslint/prettier. In all cases, it should not change the functionality of the methods.
@@ -665,11 +665,12 @@ class DataApi { | |||
* | |||
* @example | |||
* const position = [123, 123, 123]; | |||
* const segmentId = await api.data.getDataValue("segmentation", position); | |||
* const segmentationLayerName = "segmentation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philippotto I slightly changed the example as I misunderstood it by only giving it a quick look. In my opinion, the newer version makes it more clear, that the name of the segmentation layer is not always "segmentation".
}; | ||
const nodesMappedPromises = nodes.map(node => setSegementationOfNode(node)); | ||
await Promise.all(nodesMappedPromises); | ||
api.data.setMapping(segmentationLayerName, colorMapping); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here was the original mistake: I used "segmentation"
instead of segmentationLayerName
which cause the merger mode not to work in hybrid tracing when having at least one node for the preprocessing
I fixed that now. It was just a small mistake caused by sloppiness. I left a comment at the specific line 🙂 |
@philippotto I still need your review on the newest changes / approval for this PR. |
TODO @MichaelBuessemeyer
|
Also, one last minor point before I'll approve :P
|
…ble-merger-mode-in-hybrid-tracings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Happy to see this deployed very soon :)
(Don't forget to address my last nitpick :))
…ble-merger-mode-in-hybrid-tracings
…rger-mode-in-hybrid-tracings' of github.com:scalableminds/webknossos into enable-merger-mode-in-hybrid-tracings
…ture-highlight * 'master' of github.com:scalableminds/webknossos: Hide unreported datasets (#3883) Update puppeteer and refresh screenshots (#3914) only show team names of own organization (#3928) Enable merger mode in skeleton and hybrid tracings (#3619) allow uploading nml for public dataset of different orga (#3929) Always make wheel listeners not passive to allow preventDefault (#3939) Enhance tree search functionallity (#3878) add webknossos-connect to setup (#3913) Update README.md (#3923) Add shortcut to maximize golden layout panes (#3927) Perform bucket picking in web workers and other performance optimizations (#3902) remove alt text for abstract brain loading image (#3930) updated documentation front page (#3917)
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
[ ] Updated migration guide if applicable[ ] Needs datastore update after deployment