-
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
Disable proofreading actions for mapped meshes #8091
Merged
dieknolle3333
merged 8 commits into
master
from
disable-proofreading-actions-for-mapping-meshfiles
Sep 25, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a8678be
disable proofreading actions for meshfiles that were created for a ma…
dieknolle3333 c6cdd1b
add changelog
dieknolle3333 9e4f706
Merge branch 'master' into disable-proofreading-actions-for-mapping-m…
dieknolle3333 89790bd
address review
dieknolle3333 1f1977b
format code
dieknolle3333 5ff33cf
merge master
dieknolle3333 1bfd0a9
Merge branch 'master' into disable-proofreading-actions-for-mapping-m…
fm3 fc99424
Merge branch 'master' into disable-proofreading-actions-for-mapping-m…
dieknolle3333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -394,6 +394,7 @@ function getMeshItems( | |
maybeUnmappedSegmentId: number | null | undefined, | ||
visibleSegmentationLayer: APIDataLayer | null | undefined, | ||
voxelSizeFactor: Vector3, | ||
meshFileMappingName: string | null | undefined, | ||
): MenuItemType[] { | ||
if ( | ||
clickedMeshId == null || | ||
|
@@ -414,15 +415,29 @@ function getMeshItems( | |
// by looking the segment id up the segments list and checking against null. | ||
const activeSegmentMissing = segments.getNullable(activeCellId) == null; | ||
|
||
const getTooltip = (actionVerb: "merge" | "split", actionNeedsActiveSegment: boolean) => { | ||
return !isProofreadingActive | ||
? `Cannot ${actionVerb} because the proofreading tool is not active.` | ||
: maybeUnmappedSegmentId == null | ||
? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." | ||
: meshFileMappingName != null | ||
? "This mesh was created for a mapping. Please use a meshfile that is based on unmapped oversegmentation data." | ||
: actionNeedsActiveSegment && activeSegmentMissing | ||
? "Select a segment first." | ||
: null; | ||
}; | ||
|
||
const shouldAgglomerateSkeletonActionsBeDisabled = | ||
!isProofreadingActive || | ||
activeSegmentMissing || | ||
maybeUnmappedSegmentId == null || | ||
meshFileMappingName != null; | ||
Comment on lines
+430
to
+434
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👯 |
||
|
||
const maybeProofreadingItems: MenuItemType[] = isProofreadingActive | ||
? [ | ||
{ | ||
key: "merge-agglomerate-skeleton", | ||
disabled: | ||
!isProofreadingActive || | ||
activeSegmentMissing || | ||
clickedMeshId === activeCellId || | ||
maybeUnmappedSegmentId == null, | ||
disabled: shouldAgglomerateSkeletonActionsBeDisabled || clickedMeshId === activeCellId, | ||
onClick: () => { | ||
if (maybeUnmappedSegmentId == null) { | ||
// Should not happen due to the disabled property. | ||
|
@@ -431,28 +446,14 @@ function getMeshItems( | |
return Store.dispatch(proofreadMerge(null, maybeUnmappedSegmentId, clickedMeshId)); | ||
}, | ||
label: ( | ||
<FastTooltip | ||
title={ | ||
!isProofreadingActive | ||
? "Cannot merge because the proofreading tool is not active." | ||
: maybeUnmappedSegmentId == null | ||
? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." | ||
: activeSegmentMissing | ||
? "Select a segment first." | ||
: null | ||
} | ||
> | ||
Merge with active segment | ||
</FastTooltip> | ||
<FastTooltip title={getTooltip("merge", true)}>Merge with active segment</FastTooltip> | ||
), | ||
}, | ||
{ | ||
key: "min-cut-agglomerate-at-position", | ||
disabled: | ||
!isProofreadingActive || | ||
activeSegmentMissing || | ||
shouldAgglomerateSkeletonActionsBeDisabled || | ||
clickedMeshId !== activeCellId || | ||
maybeUnmappedSegmentId == null || | ||
activeUnmappedSegmentId == null || | ||
maybeUnmappedSegmentId === activeUnmappedSegmentId, | ||
onClick: () => { | ||
|
@@ -465,24 +466,12 @@ function getMeshItems( | |
); | ||
}, | ||
label: ( | ||
<FastTooltip | ||
title={ | ||
!isProofreadingActive | ||
? "Cannot split because the proofreading tool is not active." | ||
: maybeUnmappedSegmentId == null | ||
? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." | ||
: activeSegmentMissing | ||
? "Select a segment first." | ||
: null | ||
} | ||
> | ||
Split from active segment | ||
</FastTooltip> | ||
<FastTooltip title={getTooltip("split", true)}>Split from active segment</FastTooltip> | ||
), | ||
}, | ||
{ | ||
key: "split-from-all-neighbors", | ||
disabled: maybeUnmappedSegmentId == null, | ||
disabled: maybeUnmappedSegmentId == null || meshFileMappingName != null, | ||
onClick: () => { | ||
if (maybeUnmappedSegmentId == null) { | ||
// Should not happen due to the disabled property. | ||
|
@@ -493,15 +482,7 @@ function getMeshItems( | |
); | ||
}, | ||
label: ( | ||
<FastTooltip | ||
title={ | ||
!isProofreadingActive | ||
? "Cannot split because the proofreading tool is not active." | ||
: maybeUnmappedSegmentId == null | ||
? "The mesh wasn't loaded in proofreading mode. Please reload the mesh." | ||
: null | ||
} | ||
> | ||
<FastTooltip title={getTooltip("split", false)}> | ||
Split from all neighboring segments | ||
</FastTooltip> | ||
), | ||
|
@@ -576,6 +557,7 @@ function getNodeContextMenuOptions({ | |
volumeTracing, | ||
infoRows, | ||
allowUpdate, | ||
currentMeshFile, | ||
}: NodeContextMenuOptionsProps): ItemType[] { | ||
const state = Store.getState(); | ||
const isProofreadingActive = state.uiInformation.activeTool === AnnotationToolEnum.PROOFREAD; | ||
|
@@ -617,6 +599,7 @@ function getNodeContextMenuOptions({ | |
maybeUnmappedSegmentId, | ||
visibleSegmentationLayer, | ||
voxelSize.factor, | ||
currentMeshFile?.mappingName, | ||
); | ||
|
||
const menuItems: ItemType[] = [ | ||
|
@@ -1251,6 +1234,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[] | |
maybeUnmappedSegmentId, | ||
visibleSegmentationLayer, | ||
voxelSize.factor, | ||
currentMeshFile?.mappingName, | ||
); | ||
|
||
if (isSkeletonToolActive) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Très bien! 🎉