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

Isosurface List #4917

Merged
merged 45 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
fbd6c7b
add isolist, update action and reducer
grittaweisheit Oct 16, 2020
3c3df31
change update to add and reduce remove
grittaweisheit Oct 16, 2020
b868b46
icorporate isosurfaces list actions
grittaweisheit Oct 16, 2020
7e14630
list isosurfaces
grittaweisheit Oct 16, 2020
4b71efe
Merge remote-tracking branch 'origin/master' into isosurface-loading
grittaweisheit Oct 20, 2020
58d034d
prototype circle and actions in list
grittaweisheit Oct 20, 2020
cb39e21
table
grittaweisheit Oct 21, 2020
6211d49
redo list
grittaweisheit Oct 21, 2020
092a0b6
integrate download in list
grittaweisheit Oct 21, 2020
93d5b55
remove refresh
grittaweisheit Nov 3, 2020
84636f7
Merge branch 'master' into isosurface-loading
grittaweisheit Nov 6, 2020
58f9270
refactor to isosurfaces as object
grittaweisheit Nov 13, 2020
a4b650e
add delete and center on click
grittaweisheit Nov 13, 2020
f597453
refresh button per isosurface
grittaweisheit Nov 20, 2020
83064d7
Merge branch 'master' into isosurface-loading
grittaweisheit Nov 20, 2020
b7b0f93
Merge branch 'master' into isosurface-loading
grittaweisheit Nov 24, 2020
a45d506
Merge branch 'master' into isosurface-loading
grittaweisheit Nov 25, 2020
171b033
Merge branch 'master' into isosurface-loading
grittaweisheit Nov 26, 2020
e2a6ef9
move functionality to fix flow
grittaweisheit Nov 27, 2020
bb7b2e1
Merge branch 'master' into isosurface-loading
grittaweisheit Nov 27, 2020
3dbb960
move setting, refactor, make prettier
grittaweisheit Dec 2, 2020
a4ea943
Merge branch 'master' into isosurface-loading
grittaweisheit Dec 2, 2020
3b35924
Merge branch 'master' into isosurface-loading
grittaweisheit Dec 4, 2020
323b4bd
change highlight color
grittaweisheit Dec 4, 2020
7c4ab07
add headers
grittaweisheit Dec 17, 2020
e117086
Merge branch 'master' into isosurface-loading
grittaweisheit Dec 17, 2020
4addf82
Merge branch 'isosurface-loading' of github.com:scalableminds/webknos…
grittaweisheit Dec 17, 2020
c8eaf3c
extract isosurface loading by id
grittaweisheit Dec 17, 2020
1c2c31c
add load isosurface buttons
grittaweisheit Dec 17, 2020
770d25d
fix everything except uploaded isos
grittaweisheit Dec 17, 2020
3406575
fix small hickups
grittaweisheit Dec 18, 2020
22a4068
Merge branch 'master' into isosurface-loading
grittaweisheit Dec 18, 2020
b117792
Merge branch 'master' into isosurface-loading
grittaweisheit Dec 22, 2020
1246788
better lists, remove load active button
grittaweisheit Jan 7, 2021
702c1a6
Merge branch 'isosurface-loading' of github.com:scalableminds/webknos…
grittaweisheit Jan 7, 2021
83e5dfc
Merge branch 'master' into isosurface-loading
grittaweisheit Jan 8, 2021
66fdc99
Merge branch 'master' into isosurface-loading
grittaweisheit Jan 14, 2021
28c7a16
remove renderIsosurface
grittaweisheit Jan 14, 2021
ef3b300
remove iso shortcut in volume tracings
grittaweisheit Jan 14, 2021
48c45c8
remove iso loading shortcut
grittaweisheit Jan 14, 2021
30dce14
remove iso loading shortcut from view mode
grittaweisheit Jan 14, 2021
8b70841
Merge branch 'master' into isosurface-loading
grittaweisheit Jan 14, 2021
e86bf52
apply some finishing touches to the isosurfaces UI (margins, tooltip …
philippotto Jan 20, 2021
3260152
Merge branch 'master' into isosurface-loading
philippotto Jan 20, 2021
c1f5835
Merge branch 'master' into isosurface-loading
grittaweisheit Jan 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,12 @@ export function isosurfaceLeftClick(pos: Point2, plane: OrthoView, event: MouseE

let cellId = 0;
const position = calculateGlobalPos(pos);
const volumeTracingMaybe = Store.getState().tracing.volume;
if (volumeTracingMaybe) {
cellId = volumeTracingMaybe.activeCellId;
} else {
const segmentation = Model.getSegmentationLayer();
if (!segmentation) {
return;
}
cellId = segmentation.cube.getMappedDataValue(
position,
getRequestLogZoomStep(Store.getState()),
);
const segmentation = Model.getSegmentationLayer();
if (!segmentation) {
return;
}
cellId = segmentation.cube.getMappedDataValue(position, getRequestLogZoomStep(Store.getState()));

if (cellId > 0) {
Store.dispatch(changeActiveIsosurfaceCellAction(cellId, position));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ import type { Edge, Tree, Node } from "oxalis/store";
import api from "oxalis/api/internal_api";
import getSceneController from "oxalis/controller/scene_controller_provider";
import { renderToTexture } from "oxalis/view/rendering_utils";
import {
isosurfaceLeftClick,
agglomerateSkeletonMiddleClick,
} from "oxalis/controller/combinations/segmentation_plane_controller";
import { agglomerateSkeletonMiddleClick } from "oxalis/controller/combinations/segmentation_plane_controller";
import { getBaseVoxelFactors } from "oxalis/model/scaleinfo";
import Dimensions from "oxalis/model/dimensions";

Expand Down Expand Up @@ -348,8 +345,6 @@ function onClick(
} else {
Store.dispatch(setActiveNodeAction(nodeId));
}
} else if (shiftPressed && event != null) {
isosurfaceLeftClick(position, plane, event);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { movePlaneFlycamOrthoAction, setPositionAction } from "oxalis/model/acti
import Model from "oxalis/model";
import Store from "oxalis/store";
import * as Utils from "libs/utils";
import { isosurfaceLeftClick } from "oxalis/controller/combinations/segmentation_plane_controller";

// TODO: Build proper UI for this
window.isAutomaticBrushEnabled = false;
Expand Down Expand Up @@ -170,7 +169,6 @@ export function getPlaneMouseControls(_planeId: OrthoView): * {
);
if (cellId > 0) {
Store.dispatch(setActiveCellAction(cellId));
isosurfaceLeftClick(pos, plane, event);
}
} else if (shouldFillCell) {
Store.dispatch(floodFillAction(calculateGlobalPos(pos), plane));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import getSceneController from "oxalis/controller/scene_controller_provider";
import * as skeletonController from "oxalis/controller/combinations/skeletontracing_plane_controller";
import * as volumeController from "oxalis/controller/combinations/volumetracing_plane_controller";
import { downloadScreenshot } from "oxalis/view/rendering_utils";
import { isosurfaceLeftClick } from "oxalis/controller/combinations/segmentation_plane_controller";

const MAX_BRUSH_CHANGE_VALUE = 5;
const BRUSH_CHANGING_CONSTANT = 0.02;
Expand Down Expand Up @@ -198,12 +197,7 @@ class PlaneController extends React.PureComponent<Props> {
...skeletonControls,
// $FlowIssue[exponential-spread] See https://github.com/facebook/flow/issues/8299
...volumeControls,
leftClick: this.createToolDependentHandler(
maybeSkeletonLeftClick,
maybeVolumeLeftClick,
// The isosurfaceLeftClick handler should only be used in view mode.
isosurfaceLeftClick,
),
leftClick: this.createToolDependentHandler(maybeSkeletonLeftClick, maybeVolumeLeftClick),
leftDownMove: this.createToolDependentHandler(
maybeSkeletonLeftDownMove,
maybeVolumeLeftDownMove,
Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/oxalis/default_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const defaultState: OxalisState = {
loadingStrategy: "PROGRESSIVE_QUALITY",
highlightHoveredCellId: true,
segmentationPatternOpacity: 40,
renderIsosurfaces: false,
renderMissingDataBlack: true,
},
userConfiguration: {
Expand Down Expand Up @@ -205,6 +204,7 @@ const defaultState: OxalisState = {
hasOrganizations: false,
isRefreshingIsosurfaces: false,
},
isosurfaces: {},
};

export default defaultState;
68 changes: 66 additions & 2 deletions frontend/javascripts/oxalis/model/actions/annotation_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
RemoteMeshMetaData,
APIAnnotationVisibility,
} from "types/api_flow_types";
import type { Vector3 } from "oxalis/constants";
import type { UserBoundingBox } from "oxalis/store";

type InitializeAnnotationAction = {
Expand Down Expand Up @@ -71,8 +72,13 @@ export type CreateMeshFromBufferAction = {
name: string,
};

export type TriggerActiveIsosurfaceDownloadAction = {
type: "TRIGGER_ACTIVE_ISOSURFACE_DOWNLOAD",
};

export type TriggerIsosurfaceDownloadAction = {
type: "TRIGGER_ISOSURFACE_DOWNLOAD",
cellId: number,
};

export type RefreshIsosurfacesAction = {
Expand All @@ -82,6 +88,18 @@ export type RefreshIsosurfacesAction = {
export type FinishedRefreshingIsosurfacesAction = {
type: "FINISHED_REFRESHING_ISOSURFACES",
};
export type RefreshIsosurfaceAction = {
type: "REFRESH_ISOSURFACE",
cellId: number,
};
export type StartRefreshingIsosurfaceAction = {
type: "START_REFRESHING_ISOSURFACE",
cellId: number,
};
export type FinishedRefreshingIsosurfaceAction = {
type: "FINISHED_REFRESHING_ISOSURFACE",
cellId: number,
};

export type ImportIsosurfaceFromStlAction = {
type: "IMPORT_ISOSURFACE_FROM_STL",
Expand All @@ -93,6 +111,12 @@ export type RemoveIsosurfaceAction = {
cellId: number,
};

export type AddIsosurfaceAction = {
type: "ADD_ISOSURFACE",
cellId: number,
seedPosition: Vector3,
};

export type AnnotationActionTypes =
| InitializeAnnotationAction
| SetAnnotationNameAction
Expand All @@ -106,11 +130,16 @@ export type AnnotationActionTypes =
| DeleteMeshAction
| CreateMeshFromBufferAction
| UpdateLocalMeshMetaDataAction
| TriggerActiveIsosurfaceDownloadAction
| TriggerIsosurfaceDownloadAction
| RefreshIsosurfacesAction
| FinishedRefreshingIsosurfacesAction
| RefreshIsosurfaceAction
| StartRefreshingIsosurfaceAction
| FinishedRefreshingIsosurfaceAction
| ImportIsosurfaceFromStlAction
| RemoveIsosurfaceAction;
| RemoveIsosurfaceAction
| AddIsosurfaceAction;

export const initializeAnnotationAction = (
annotation: APIAnnotation,
Expand Down Expand Up @@ -198,8 +227,15 @@ export const createMeshFromBufferAction = (
name,
});

export const triggerIsosurfaceDownloadAction = (): TriggerIsosurfaceDownloadAction => ({
export const triggerActiveIsosurfaceDownloadAction = (): TriggerActiveIsosurfaceDownloadAction => ({
type: "TRIGGER_ACTIVE_ISOSURFACE_DOWNLOAD",
});

export const triggerIsosurfaceDownloadAction = (
cellId: number,
): TriggerIsosurfaceDownloadAction => ({
type: "TRIGGER_ISOSURFACE_DOWNLOAD",
cellId,
});

export const refreshIsosurfacesAction = (): RefreshIsosurfacesAction => ({
Expand All @@ -210,6 +246,25 @@ export const finishedRefreshingIsosurfacesAction = (): FinishedRefreshingIsosurf
type: "FINISHED_REFRESHING_ISOSURFACES",
});

export const refreshIsosurfaceAction = (cellId: number): RefreshIsosurfaceAction => ({
type: "REFRESH_ISOSURFACE",
cellId,
});

export const startRefreshingIsosurfaceAction = (
cellId: number,
): StartRefreshingIsosurfaceAction => ({
type: "START_REFRESHING_ISOSURFACE",
cellId,
});

export const finishedRefreshingIsosurfaceAction = (
cellId: number,
): FinishedRefreshingIsosurfaceAction => ({
type: "FINISHED_REFRESHING_ISOSURFACE",
cellId,
});

export const importIsosurfaceFromStlAction = (
buffer: ArrayBuffer,
): ImportIsosurfaceFromStlAction => ({
Expand All @@ -221,3 +276,12 @@ export const removeIsosurfaceAction = (cellId: number): RemoveIsosurfaceAction =
type: "REMOVE_ISOSURFACE",
cellId,
});

export const addIsosurfaceAction = (
cellId: number,
seedPosition: Vector3,
): AddIsosurfaceAction => ({
type: "ADD_ISOSURFACE",
cellId,
seedPosition,
});
29 changes: 29 additions & 0 deletions frontend/javascripts/oxalis/model/reducers/annotation_reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,35 @@ function AnnotationReducer(state: OxalisState, action: Action): OxalisState {
return updateKey(state, "tracing", { meshes: newMeshes });
}

case "REMOVE_ISOSURFACE": {
const { cellId } = action;
return update(state, {
isosurfaces: { $unset: [cellId] },
});
}

case "ADD_ISOSURFACE": {
const { cellId, seedPosition } = action;
return updateKey2(state, "isosurfaces", cellId.toString(), {
segmentId: cellId,
seedPosition,
});
}

case "START_REFRESHING_ISOSURFACE": {
const { cellId } = action;
return updateKey2(state, "isosurfaces", cellId.toString(), {
isLoading: true,
});
}

case "FINISHED_REFRESHING_ISOSURFACE": {
const { cellId } = action;
return updateKey2(state, "isosurfaces", cellId.toString(), {
isLoading: false,
});
}

default:
return state;
}
Expand Down
Loading