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

Disable proofreading actions for mapped meshes #8091

Merged
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Updated frontend package management to yarn version 4. [8061](https://github.com/scalableminds/webknossos/pull/8061)
- Updated React to version 18. Updated many peer dependencies inlcuding Redux, React-Router, antd, and FlexLayout. [#8048](https://github.com/scalableminds/webknossos/pull/8048)
- Improved the performance of context menus in the bounding box tab. [#8059](https://github.com/scalableminds/webknossos/pull/8059)
- Some mesh-related actions were disabled in proofreading-mode when using meshfiles that were created for a mapping rather than an oversegmentation. [#8091](https://github.com/scalableminds/webknossos/pull/8091)

### Fixed
- The JS API v2 has been removed as it was deprecated by v3 in 2018. Please upgrade to v3 in case your scripts still use v2. [#8076](https://github.com/scalableminds/webknossos/pull/8076)
Expand Down
32 changes: 22 additions & 10 deletions frontend/javascripts/oxalis/view/context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ function getMeshItems(
maybeUnmappedSegmentId: number | null | undefined,
visibleSegmentationLayer: APIDataLayer | null | undefined,
voxelSizeFactor: Vector3,
meshFileMapping: string | null | undefined,
knollengewaechs marked this conversation as resolved.
Show resolved Hide resolved
): MenuItemType[] {
if (
clickedMeshId == null ||
Expand Down Expand Up @@ -422,7 +423,8 @@ function getMeshItems(
!isProofreadingActive ||
activeSegmentMissing ||
clickedMeshId === activeCellId ||
maybeUnmappedSegmentId == null,
maybeUnmappedSegmentId == null ||
meshFileMapping != null,
knollengewaechs marked this conversation as resolved.
Show resolved Hide resolved
onClick: () => {
if (maybeUnmappedSegmentId == null) {
// Should not happen due to the disabled property.
Expand All @@ -437,9 +439,11 @@ function getMeshItems(
? "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
: meshFileMapping != null
? "This mesh was created for a mapping. Please use a meshfile that is based on an oversegmentation."
fm3 marked this conversation as resolved.
Show resolved Hide resolved
: activeSegmentMissing
? "Select a segment first."
: null
}
>
Merge with active segment
Expand All @@ -454,7 +458,8 @@ function getMeshItems(
clickedMeshId !== activeCellId ||
maybeUnmappedSegmentId == null ||
activeUnmappedSegmentId == null ||
maybeUnmappedSegmentId === activeUnmappedSegmentId,
maybeUnmappedSegmentId === activeUnmappedSegmentId ||
meshFileMapping != null,
onClick: () => {
if (maybeUnmappedSegmentId == null) {
// Should not happen due to the disabled property.
Expand All @@ -471,9 +476,11 @@ function getMeshItems(
? "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
: meshFileMapping != null
? "This mesh was created for a mapping. Please use a meshfile that is based on an oversegmentation."
: activeSegmentMissing
? "Select a segment first."
: null
}
>
Split from active segment
Expand All @@ -482,7 +489,7 @@ function getMeshItems(
},
{
key: "split-from-all-neighbors",
disabled: maybeUnmappedSegmentId == null,
disabled: maybeUnmappedSegmentId == null || meshFileMapping != null,
onClick: () => {
if (maybeUnmappedSegmentId == null) {
// Should not happen due to the disabled property.
Expand All @@ -499,7 +506,9 @@ function getMeshItems(
? "Cannot split because the proofreading tool is not active."
: maybeUnmappedSegmentId == null
? "The mesh wasn't loaded in proofreading mode. Please reload the mesh."
: null
: meshFileMapping != null
? "This mesh was created for a mapping. Please use a meshfile that is based on an oversegmentation."
: null
}
>
Split from all neighboring segments
Expand Down Expand Up @@ -576,6 +585,7 @@ function getNodeContextMenuOptions({
volumeTracing,
infoRows,
allowUpdate,
currentMeshFile,
}: NodeContextMenuOptionsProps): ItemType[] {
const state = Store.getState();
const isProofreadingActive = state.uiInformation.activeTool === AnnotationToolEnum.PROOFREAD;
Expand Down Expand Up @@ -617,6 +627,7 @@ function getNodeContextMenuOptions({
maybeUnmappedSegmentId,
visibleSegmentationLayer,
voxelSize.factor,
currentMeshFile?.mappingName,
);

const menuItems: ItemType[] = [
Expand Down Expand Up @@ -1251,6 +1262,7 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[]
maybeUnmappedSegmentId,
visibleSegmentationLayer,
voxelSize.factor,
currentMeshFile?.mappingName,
);

if (isSkeletonToolActive) {
Expand Down