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

In proofreading, split a segment from all its neighbors #7611

Merged
merged 31 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f69f6a2
WIP: In proofreading, split a segment from all its neighbors
fm3 Feb 7, 2024
eb0ebe9
find the actual neighbors
fm3 Feb 7, 2024
01b40b9
implement cut-from-neighbors (without using skeletons) proofreading a…
philippotto Feb 14, 2024
8113929
use useDispatch instead of mapDispatchToProps
philippotto Feb 14, 2024
3dec9b7
fix bug in cut-neighbors when there is no active segment by using tak…
philippotto Feb 16, 2024
0819fb1
rename some functions
philippotto Feb 16, 2024
14e6628
call new cut-neighbors saga and simplify createGetUnmappedDataValueFn
philippotto Feb 16, 2024
f0aaec9
simplify prepareSplitOrMerge
philippotto Feb 16, 2024
3f2f108
add delete-incident-edges node (no-op yet)
philippotto Feb 16, 2024
f16b097
do more work in prepareSplitOrMerge
philippotto Feb 16, 2024
fcd3aca
inline volume tracing ID for layer name
philippotto Feb 16, 2024
9fa8aae
unify volumeTracing and volumeTracingWithEditableMapping
philippotto Feb 16, 2024
0788061
don't return getUnmappedDataValue since it was unused
philippotto Feb 16, 2024
edf9134
remove unused import
philippotto Feb 16, 2024
d6d0724
fix that segments view rerendered on every store update
philippotto Feb 16, 2024
7fd0b47
rename currentlyPerformingMinCut
philippotto Feb 16, 2024
846ae22
replace currentlyPerformingMultiCut with action.initiator logic
philippotto Feb 16, 2024
17fa4ae
also support cutting neighbors when selecting a skeleton node
philippotto Feb 16, 2024
4c295bc
fix useDispatch in non-hooks
philippotto Feb 16, 2024
92cb0bb
remove obsolete delete-incident-edge feature
philippotto Feb 16, 2024
df18e01
clean up
philippotto Feb 19, 2024
cd79b46
replace fork with spawn and add it were it was missing
philippotto Feb 19, 2024
b533b3f
update changelog
philippotto Feb 19, 2024
50cb4fd
remove obsolete import
philippotto Feb 19, 2024
8a9fbb4
use name of editable mapping as mappingName after creating a new edit…
philippotto Mar 4, 2024
64bd0fe
rename comment
philippotto Mar 4, 2024
c954c11
don't check active cell id when splitting from all neighbors
philippotto Mar 4, 2024
38dc591
Merge branch 'master' into split-from-all
fm3 Mar 4, 2024
bf9eaa5
do not rely on passed agglomerate id if there is more than one update…
fm3 Mar 4, 2024
e603273
Merge branch 'master' of github.com:scalableminds/webknossos into spl…
philippotto Mar 5, 2024
50d1a8a
show toast when no neighbors were found
philippotto Mar 5, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Segment statistics are now available for ND datasets. [#7411](https://github.com/scalableminds/webknossos/pull/7411)
- Added support for uploading N5 and Neuroglancer Precomputed datasets. [#7578](https://github.com/scalableminds/webknossos/pull/7578)
- Webknossos can now open ND Zarr datasets with arbitrary axis orders (not limited to `**xyz` anymore). [#7592](https://github.com/scalableminds/webknossos/pull/7592)
- Added a new "Split from all neighboring segments" feature for the proofreading mode. [#7611](https://github.com/scalableminds/webknossos/pull/7611)

### Changed
- Datasets stored in WKW format are no longer loaded with memory mapping, reducing memory demands. [#7528](https://github.com/scalableminds/webknossos/pull/7528)
Expand Down
33 changes: 32 additions & 1 deletion frontend/javascripts/admin/admin_rest_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2445,7 +2445,13 @@ type MinCutTargetEdge = {
export async function getEdgesForAgglomerateMinCut(
tracingStoreUrl: string,
tracingId: string,
segmentsInfo: Object,
segmentsInfo: {
segmentPosition1: Vector3;
segmentPosition2: Vector3;
mag: Vector3;
agglomerateId: number;
editableMappingId: string;
},
): Promise<Array<MinCutTargetEdge>> {
return doWithToken((token) =>
Request.sendJSONReceiveJSON(
Expand All @@ -2457,6 +2463,31 @@ export async function getEdgesForAgglomerateMinCut(
);
}

export type NeighborInfo = {
segmentId: number;
neighbors: Array<{ segmentId: number; position: Vector3 }>;
};

export async function getNeighborsForAgglomerateNode(
tracingStoreUrl: string,
tracingId: string,
segmentInfo: {
segmentPosition: Vector3;
mag: Vector3;
agglomerateId: number;
editableMappingId: string;
},
): Promise<NeighborInfo> {
return doWithToken((token) =>
Request.sendJSONReceiveJSON(
`${tracingStoreUrl}/tracings/volume/${tracingId}/agglomerateGraphNeighbors?token=${token}`,
{
data: segmentInfo,
},
),
);
}

// ### Smart Select

export async function getSamEmbedding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export function getVisibleSegments(state: OxalisState): {
// a callback function that updates the selectedIds in store if segments are stored
// there that are not visible in the segments view tab.
// The returned segment and group ids are all visible in the segments view tab.
export function getSelectedIds(state: OxalisState): [
function _getSelectedIds(state: OxalisState): [
{
segments: number[];
group: number | null;
Expand Down Expand Up @@ -421,6 +421,8 @@ export function getSelectedIds(state: OxalisState): [
return [selectedIds, maybeSetSelectedSegmentsOrGroupsAction];
}

export const getSelectedIds = reuseInstanceOnEquality(_getSelectedIds);

export function getActiveSegmentPosition(state: OxalisState): Vector3 | null | undefined {
const layer = getVisibleSegmentationLayer(state);
if (layer == null) return null;
Expand Down
19 changes: 18 additions & 1 deletion frontend/javascripts/oxalis/model/actions/proofread_actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Vector3 } from "oxalis/constants";
import { type AdditionalCoordinate } from "types/api_flow_types";
import type { Tree } from "oxalis/store";

export type ProofreadAtPositionAction = ReturnType<typeof proofreadAtPosition>;
export type ClearProofreadingByProductsAction = ReturnType<typeof clearProofreadingByProducts>;
Expand All @@ -8,8 +9,17 @@ export type MinCutAgglomerateAction = ReturnType<typeof minCutAgglomerateAction>
export type MinCutAgglomerateWithPositionAction = ReturnType<
typeof minCutAgglomerateWithPositionAction
>;
export type CutAgglomerateFromNeighborsAction = ReturnType<
typeof cutAgglomerateFromNeighborsAction
>;

export type ProofreadAction = ProofreadAtPositionAction | ClearProofreadingByProductsAction;
export type ProofreadAction =
| ProofreadAtPositionAction
| ClearProofreadingByProductsAction
| ProofreadMergeAction
| MinCutAgglomerateAction
| MinCutAgglomerateWithPositionAction
| CutAgglomerateFromNeighborsAction;

export const proofreadAtPosition = (
position: Vector3,
Expand Down Expand Up @@ -44,3 +54,10 @@ export const minCutAgglomerateWithPositionAction = (position: Vector3) =>
type: "MIN_CUT_AGGLOMERATE_WITH_POSITION",
position,
} as const);

export const cutAgglomerateFromNeighborsAction = (position: Vector3, tree?: Tree) =>
({
type: "CUT_AGGLOMERATE_FROM_NEIGHBORS",
position,
tree,
} as const);
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,14 @@ export const deleteEdgeAction = (
sourceNodeId: number,
targetNodeId: number,
timestamp: number = Date.now(),
initiator: "PROOFREADING" | "UNKNOWN" = "UNKNOWN",
) =>
({
type: "DELETE_EDGE",
sourceNodeId,
targetNodeId,
timestamp,
initiator,
} as const);

export const setActiveNodeAction = (
Expand Down
Loading