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

Allow to disable automatic reloading of meshes during proofreading #7076

Merged
merged 9 commits into from
May 22, 2023
Merged
1 change: 1 addition & 0 deletions frontend/javascripts/oxalis/default_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const defaultState: OxalisState = {
datasetConfiguration: defaultDatasetViewConfigurationWithoutNull,
userConfiguration: {
autoSaveLayouts: true,
autoRenderMeshInProofreading: false,
knollengewaechs marked this conversation as resolved.
Show resolved Hide resolved
brushSize: 50,
clippingDistance: 50,
clippingDistanceArbitrary: 64,
Expand Down
2 changes: 2 additions & 0 deletions frontend/javascripts/oxalis/model/sagas/proofread_saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ function proofreadUsingMeshes(): boolean {
let coarselyLoadedSegmentIds: number[] = [];

function* loadCoarseMesh(layerName: string, segmentId: number, position: Vector3): Saga<void> {
if ((yield* select((state) => state.userConfiguration.autoRenderMeshInProofreading)) === false)
return;
const currentMeshFile = yield* select(
(state) => state.localSegmentationData[layerName].currentMeshFile,
);
Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/oxalis/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export type QuickSelectConfig = {

export type UserConfiguration = {
readonly autoSaveLayouts: boolean;
readonly autoRenderMeshInProofreading: boolean;
readonly brushSize: number;
readonly clippingDistance: number;
readonly clippingDistanceArbitrary: number;
Expand Down
43 changes: 33 additions & 10 deletions frontend/javascripts/oxalis/view/action-bar/toolbar_view.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { Radio, Tooltip, Badge, Space, Popover, RadioChangeEvent, Dropdown, MenuProps } from "antd";
import {
Radio,
Tooltip,
Badge,
Space,
Popover,
RadioChangeEvent,
Dropdown,
MenuProps,
Switch,
} from "antd";
import { ClearOutlined, DownOutlined, ExportOutlined, SettingOutlined } from "@ant-design/icons";
import { useSelector, useDispatch } from "react-redux";
import React, { useEffect, useCallback, useState } from "react";
Expand Down Expand Up @@ -115,6 +125,10 @@ const handleUpdateBrushSize = (value: number) => {
Store.dispatch(updateUserSettingAction("brushSize", value));
};

const handleToggleAutomaticMeshRendering = (value: boolean) => {
Store.dispatch(updateUserSettingAction("autoRenderMeshInProofreading", value));
};

const handleSetTool = (event: RadioChangeEvent) => {
const value = event.target.value as AnnotationTool;
Store.dispatch(setToolAction(value));
Expand Down Expand Up @@ -911,7 +925,9 @@ function ToolSpecificSettings({
adaptedActiveTool === AnnotationToolEnum.ERASE_BRUSH);
const dispatch = useDispatch();
const handleClearProofreading = () => dispatch(clearProofreadingByProducts());

const autoRenderMeshes = useSelector(
(state: OxalisState) => state.userConfiguration.autoRenderMeshInProofreading,
);
return (
<>
{showCreateTreeButton ? (
Expand Down Expand Up @@ -967,14 +983,21 @@ function ToolSpecificSettings({
{adaptedActiveTool === AnnotationToolEnum.FILL_CELL ? <FillModeSwitch /> : null}

{adaptedActiveTool === AnnotationToolEnum.PROOFREAD ? (
<ButtonComponent
title="Clear auxiliary skeletons and meshes that were loaded while proofreading segments. Use this if you are done with correcting mergers or splits in a segment pair."
onClick={handleClearProofreading}
className="narrow"
style={{ marginLeft: 12 }}
>
<ClearOutlined />
</ButtonComponent>
<>
<ButtonComponent
title="Clear auxiliary skeletons and meshes that were loaded while proofreading segments. Use this if you are done with correcting mergers or splits in a segment pair."
onClick={handleClearProofreading}
className="narrow"
style={{ marginInline: 12 }}
>
<ClearOutlined />
</ButtonComponent>
<Switch
title={`${autoRenderMeshes ? "Disable" : "Enable"} automatic loading of meshes`}
checked={autoRenderMeshes}
onChange={() => handleToggleAutomaticMeshRendering(!autoRenderMeshes)}
/>
</>
) : null}
</>
);
Expand Down
3 changes: 3 additions & 0 deletions frontend/javascripts/types/schemas/user_settings.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ export const userSettings = {
autoSaveLayouts: {
type: "boolean",
},
autoRenderMeshInProofreading: {
type: "boolean",
},
gpuMemoryFactor: {
type: "number",
},
Expand Down