From 48bd317a3e452122a1eecabb35cfeff5da03d19e Mon Sep 17 00:00:00 2001 From: Philipp Otto Date: Tue, 12 Oct 2021 12:43:19 +0200 Subject: [PATCH] 3D Flood fill, more robust volume editing and fix several volume bugs (#5728 + #5733) * remove dead and unnecessary code * comment out uncalled push function * add more volume-related tests and fix two bugs * add console.error if async task queue fails * fix tests, add comments and add crash-provoking test * make dynamc overwriting of MAXIMUM_BUCKET_COUNT_PER_LAYER work in spec * fix test.sh * reference issue for bug/todo * update changelog * fix linting * fix tests * fix --timeout param for test.sh * use snapshot tests in volume tracing tests and clean up test.sh * Update tools/test.sh Co-authored-by: Daniel * fix race condition in unsetting dirty flag * WIP: implement first version of flood fill (resampling is still broken) * fix z index * refactor flood fill code and fix some bugs * fix flow * fix more xyz/uvw bugs * simplify code which increments dirtyCount * limit 3d flood fill to certain bounding box, inform user whether the limit was reached, show progress for filling and further fixes for 3d flood fill * build a test which crashes undo because getData() was called on a gc-ed bucket * fix crashing undo if bucket was collected in meantime (see #5729) and add progress indicator to undo/redo * fix incorrectly mocked bucket data, properly await undo/redo and clean up * use redux channels to avoid missing critical actions, such as undo or volume-related actions, when being busy; also make undo/redo buttons AsyncClickable * clean up * fix flow * fix building docker image in CI * add more comments to applyAndGetRevertingVolumeBatch * rename action channels * rename VoxelNeighborStack3D to VoxelNeighborQueue3D * run all volume saga integration specs * clean up tests * allow to switch between 2D and 3D for fill tool * fix failing mesh loading for hybrid tracings * implement smart bbox growing for flood fill and create bbox for flood fill limit if it was reached * fix volumetracing_saga.spec * fix abort criterium in flood fill; add warning if bucket was given too small array buffer; fix off-by-one in covered floodfill bbox * fix test for bucket garbage collection * mark UI as busy when undo/redo/floodfill are computing * fix tests by clearing stale push and pull queues properly when reinitializing the model * update snapshot * fix flow * incorporate PR feedback (1/x) * incorporate more feedback * don't show progress handling if undo stack is empty and refactor corresponding code * inform user if floodfill bbox was added and show that message for 10s * update progress UI in-place, also write source_id into bbox name, don't add to undo stack if floodfill is no-op, fix flow and clean up * only show undo/redo progress message for volume actions * minor tweaks * add a comment for USE_FLOODFILL_VOXEL_THRESHOLD * intersect floodfill bbox with datasets bounding box and add snapshot test * decrease snapshot size * fix style of disabled undo/redo buttons * improve comments * make floodfill bbox message closable and deduplicate debug info code * adapt antd typing according to webknossos/pull/5738 Co-authored-by: Daniel --- .eslintrc.json | 2 +- CHANGELOG.unreleased.md | 3 +- flow-typed/npm/antd_vx.x.x.js | 24 +- .../components/async_clickables.js | 9 +- frontend/javascripts/libs/async_task_queue.js | 1 + frontend/javascripts/libs/error_handling.js | 3 + .../javascripts/libs/progress_callback.js | 35 +- frontend/javascripts/libs/window.js | 3 + frontend/javascripts/oxalis/api/api_latest.js | 9 +- frontend/javascripts/oxalis/api/api_v2.js | 1 - frontend/javascripts/oxalis/constants.js | 18 +- .../viewmodes/arbitrary_controller.js | 22 - frontend/javascripts/oxalis/default_state.js | 5 + frontend/javascripts/oxalis/model.js | 3 + .../model/accessors/dataset_accessor.js | 4 + .../oxalis/model/actions/save_actions.js | 27 +- .../oxalis/model/actions/ui_actions.js | 22 +- .../model/actions/volumetracing_actions.js | 27 +- .../model/bucket_data_handling/bucket.js | 104 +- .../model/bucket_data_handling/data_cube.js | 236 +- .../data_rendering_logic.js | 8 +- .../model/bucket_data_handling/pullqueue.js | 2 +- .../model/bucket_data_handling/pushqueue.js | 25 +- .../bucket_data_handling/wkstore_adapter.js | 1 + .../javascripts/oxalis/model/data_layer.js | 5 + .../oxalis/model/reducers/ui_reducer.js | 4 + .../model/sagas/automatic_brush_saga.js | 4 +- .../oxalis/model/sagas/effect-generators.js | 2 + .../model/sagas/effect-generators.js.flow | 9 +- .../oxalis/model/sagas/root_saga.js | 15 +- .../oxalis/model/sagas/save_saga.js | 263 +- .../oxalis/model/sagas/volumetracing_saga.js | 215 +- .../volume_annotation_sampling.js | 2 +- .../oxalis/model/volumetracing/volumelayer.js | 45 +- .../oxalis/model_initialization.js | 4 +- frontend/javascripts/oxalis/store.js | 8 + .../oxalis/view/action-bar/toolbar_view.js | 68 +- .../view/action-bar/tracing_actions_view.js | 38 +- .../javascripts/oxalis/view/input_catcher.js | 8 +- .../view/layouting/flex_layout_wrapper.js | 29 +- .../right-border-tabs/meshes_view_helper.js | 4 +- .../test/api/api_skeleton_latest.spec.js | 2 +- frontend/javascripts/test/api/api_v2.spec.js | 2 +- .../test/fixtures/dataset_server_object.js | 4 +- .../fixtures/volumetracing_server_objects.js | 10 +- .../javascripts/test/helpers/apiHelpers.js | 27 +- .../test/model/binary/cube.spec.js | 21 +- .../binary/layers/wkstore_adapter.spec.js | 6 +- .../binary/temporal_bucket_manager.spec.js | 8 +- frontend/javascripts/test/model/model.spec.js | 1 + .../test/model/texture_bucket_manager.spec.js | 2 +- .../reducers/volumetracing_reducer.spec.js | 10 +- .../test/sagas/saga_integration.mock.js | 8 + .../test/sagas/volumetracing_saga.spec.js | 17 +- .../volumetracing_saga_integration.spec.js | 562 +- .../volumetracing_saga_integration.spec.js.md | 16429 ++++++++++++++++ ...olumetracing_saga_integration.spec.js.snap | Bin 0 -> 1488 bytes .../types/schemas/user_settings.schema.js | 6 +- .../stylesheets/trace_view/_tracing_view.less | 7 + package.json | 5 +- tools/test.sh | 7 +- 61 files changed, 18052 insertions(+), 399 deletions(-) create mode 100644 frontend/javascripts/test/snapshots/public/test-bundle/test/sagas/volumetracing_saga_integration.spec.js.md create mode 100644 frontend/javascripts/test/snapshots/public/test-bundle/test/sagas/volumetracing_saga_integration.spec.js.snap diff --git a/.eslintrc.json b/.eslintrc.json index d329468569a..9515cd499d4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -72,7 +72,7 @@ "no-use-before-define": ["error", { "functions": false, "classes": false }], "one-var": ["error", "never"], "operator-assignment": "warn", - "prefer-destructuring": "warn", + "prefer-destructuring": "off", "quote-props": ["error", "as-needed", { "numbers": true }], "quotes": ["error", "double", { "avoidEscape": true }], "radix": "off", diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 47d40264741..6edd238196b 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -11,12 +11,13 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released [Commits](https://github.com/scalableminds/webknossos/compare/21.09.0...HEAD) ### Added -- +- Enhanced the volume fill tool to so that it operates beyond the dimensions of the current viewport. Additionally, the fill tool can also be changed to perform in 3D instead of 2D. [#5733](https://github.com/scalableminds/webknossos/pull/5733) ### Changed - ### Fixed +- Fixed two volume tracing related bugs which could occur when using undo with a slow internet connection or when volume-annotating more than 5000 buckets (32**3 vx) in one session. [#5728](https://github.com/scalableminds/webknossos/pull/5728) - Jobs status is no longer polled if jobs are not enabled, avoiding backend logging spam [#5761](https://github.com/scalableminds/webknossos/pull/5761) - Fixed a bug that windows user could not open the context menu as it instantly closed after opening. [#5756](https://github.com/scalableminds/webknossos/pull/5756). - Fixed a bug where the health check of public datasets failed if no cookie/token was supplied. [#5768](https://github.com/scalableminds/webknossos/pull/5768). diff --git a/flow-typed/npm/antd_vx.x.x.js b/flow-typed/npm/antd_vx.x.x.js index 68e67bb3fd3..c2724869a06 100644 --- a/flow-typed/npm/antd_vx.x.x.js +++ b/flow-typed/npm/antd_vx.x.x.js @@ -1,3 +1,13 @@ +// @flow + +type MessageConfig = { + content?: string | React$Node, + key?: string, + duration?: number, + onClose?: Function, +}; +type MessageContent = string | React$Node | MessageConfig; + declare module "antd" { declare export class Alert

extends React$Component

{} declare export class AutoComplete

extends React$Component

{ @@ -72,13 +82,15 @@ declare module "antd" { static ItemGroup: typeof MenuItemGroup; static SubMenu: typeof MenuSubMenu; } + declare export var message: { - success(content: string | React$Node, duration?: number, onClose?: Function): Function, - error(content: string | React$Node, duration?: number, onClose?: Function): Function, - info(content: string | React$Node, duration?: number, onClose?: Function): Function, - warning(content: string | React$Node, duration?: number, onClose?: Function): Function, - warn(content: string | React$Node, duration?: number, onClose?: Function): Function, - loading(content: string | React$Node, duration?: number, onClose?: Function): Function, + success(content: MessageContent, duration?: number, onClose?: Function): Function, + error(content: MessageContent, duration?: number, onClose?: Function): Function, + info(content: MessageContent, duration?: number, onClose?: Function): Function, + warning(content: MessageContent, duration?: number, onClose?: Function): Function, + warn(content: MessageContent, duration?: number, onClose?: Function): Function, + loading(content: MessageContent, duration?: number, onClose?: Function): Function, + destroy(key: string): Function, }; declare export class Modal

extends React$Component

{ static confirm: Function; diff --git a/frontend/javascripts/components/async_clickables.js b/frontend/javascripts/components/async_clickables.js index 32313d62bbb..c54105f20cc 100644 --- a/frontend/javascripts/components/async_clickables.js +++ b/frontend/javascripts/components/async_clickables.js @@ -6,6 +6,8 @@ const { useState, useEffect, useRef } = React; type Props = { onClick: (SyntheticInputEvent<>) => Promise, + hideContentWhenLoading?: boolean, + children?: React.Node, }; function useLoadingClickHandler(originalOnClick: (SyntheticInputEvent<>) => Promise) { @@ -38,7 +40,10 @@ function useLoadingClickHandler(originalOnClick: (SyntheticInputEvent<>) => Prom export function AsyncButton(props: Props) { const [isLoading, onClick] = useLoadingClickHandler(props.onClick); - return