From 5e2ff768f577a41ff4445051ac02d87007fa7b9d Mon Sep 17 00:00:00 2001 From: Charlie Meister Date: Thu, 10 Oct 2024 09:23:33 +0200 Subject: [PATCH] rename in volumetracing accessor --- .../oxalis/model/accessors/tool_accessor.ts | 4 ++-- .../model/accessors/volumetracing_accessor.ts | 22 ++++++++++--------- .../oxalis/model/sagas/volumetracing_saga.tsx | 4 ++-- .../oxalis/view/action-bar/toolbar_view.tsx | 6 ++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/javascripts/oxalis/model/accessors/tool_accessor.ts b/frontend/javascripts/oxalis/model/accessors/tool_accessor.ts index 7ebd8943adb..78dd3f14965 100644 --- a/frontend/javascripts/oxalis/model/accessors/tool_accessor.ts +++ b/frontend/javascripts/oxalis/model/accessors/tool_accessor.ts @@ -5,7 +5,7 @@ import type { OxalisState } from "oxalis/store"; import { type AgglomerateState, getActiveSegmentationTracing, - getRenderableResolutionForSegmentationTracing, + getRenderableMagForSegmentationTracing, hasAgglomerateMapping, isVolumeAnnotationDisallowedForZoom, } from "oxalis/model/accessors/volumetracing_accessor"; @@ -274,7 +274,7 @@ function getDisabledVolumeInfo(state: OxalisState) { const hasVolume = state.tracing.volumes.length > 0; const hasSkeleton = state.tracing.skeleton != null; const segmentationTracingLayer = getActiveSegmentationTracing(state); - const labeledResolution = getRenderableResolutionForSegmentationTracing( + const labeledResolution = getRenderableMagForSegmentationTracing( state, segmentationTracingLayer, )?.resolution; diff --git a/frontend/javascripts/oxalis/model/accessors/volumetracing_accessor.ts b/frontend/javascripts/oxalis/model/accessors/volumetracing_accessor.ts index 6cc4032263f..640ab2a374c 100644 --- a/frontend/javascripts/oxalis/model/accessors/volumetracing_accessor.ts +++ b/frontend/javascripts/oxalis/model/accessors/volumetracing_accessor.ts @@ -179,7 +179,9 @@ export function getSegmentationLayerForTracing( return getSegmentationLayerByName(state.dataset, volumeTracing.tracingId); } -function _getResolutionInfoOfActiveSegmentationTracingLayer(state: OxalisState): MagnificationInfo { +function _getMagnificationInfoOfActiveSegmentationTracingLayer( + state: OxalisState, +): MagnificationInfo { const volumeTracing = getActiveSegmentationTracing(state); if (!volumeTracing) { @@ -191,7 +193,7 @@ function _getResolutionInfoOfActiveSegmentationTracingLayer(state: OxalisState): } const getResolutionInfoOfActiveSegmentationTracingLayer = memoizeOne( - _getResolutionInfoOfActiveSegmentationTracingLayer, + _getMagnificationInfoOfActiveSegmentationTracingLayer, ); export function getServerVolumeTracings( tracings: Array | null | undefined, @@ -537,11 +539,11 @@ function _getRenderableResolutionForSegmentationTracing( return null; } -export const getRenderableResolutionForSegmentationTracing = reuseInstanceOnEquality( +export const getRenderableMagForSegmentationTracing = reuseInstanceOnEquality( _getRenderableResolutionForSegmentationTracing, ); -function _getRenderableResolutionForActiveSegmentationTracing(state: OxalisState): +function _getRenderableMagForActiveSegmentationTracing(state: OxalisState): | { resolution: Vector3; zoomStep: number; @@ -549,11 +551,11 @@ function _getRenderableResolutionForActiveSegmentationTracing(state: OxalisState | null | undefined { const activeSegmentationTracing = getActiveSegmentationTracing(state); - return getRenderableResolutionForSegmentationTracing(state, activeSegmentationTracing); + return getRenderableMagForSegmentationTracing(state, activeSegmentationTracing); } -export const getRenderableResolutionForActiveSegmentationTracing = reuseInstanceOnEquality( - _getRenderableResolutionForActiveSegmentationTracing, +export const getRenderableMagForActiveSegmentationTracing = reuseInstanceOnEquality( + _getRenderableMagForActiveSegmentationTracing, ); export function getMappingInfoForVolumeTracing( @@ -641,13 +643,13 @@ export function getLastLabelAction(volumeTracing: VolumeTracing): LabelAction | export function getLabelActionFromPreviousSlice( state: OxalisState, volumeTracing: VolumeTracing, - resolution: Vector3, + mag: Vector3, dim: 0 | 1 | 2, ): LabelAction | undefined { // Gets the last label action which was performed on a different slice. // Note that in coarser mags (e.g., 8-8-2), the comparison of the coordinates - // is done while respecting how the coordinates are clipped due to that resolution. - const adapt = (vec: Vector3) => V3.roundElementToMag(vec, resolution, dim); + // is done while respecting how the coordinates are clipped due to that magnification. + const adapt = (vec: Vector3) => V3.roundElementToMag(vec, mag, dim); const position = adapt(getFlooredPosition(state.flycam)); return volumeTracing.lastLabelActions.find( diff --git a/frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx b/frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx index 94fd670553a..d12082edf61 100644 --- a/frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx +++ b/frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx @@ -46,7 +46,7 @@ import { enforceActiveVolumeTracing, getActiveSegmentationTracing, getMaximumBrushSize, - getRenderableResolutionForSegmentationTracing, + getRenderableMagForSegmentationTracing, getRequestedOrVisibleSegmentationLayer, getSegmentsForLayer, isVolumeAnnotationDisallowedForZoom, @@ -213,7 +213,7 @@ export function* editVolumeLayerAsync(): Saga { } const maybeLabeledResolutionWithZoomStep = yield* select((state) => - getRenderableResolutionForSegmentationTracing(state, volumeTracing), + getRenderableMagForSegmentationTracing(state, volumeTracing), ); if (!maybeLabeledResolutionWithZoomStep) { diff --git a/frontend/javascripts/oxalis/view/action-bar/toolbar_view.tsx b/frontend/javascripts/oxalis/view/action-bar/toolbar_view.tsx index c5b0237d690..835f364cbf0 100644 --- a/frontend/javascripts/oxalis/view/action-bar/toolbar_view.tsx +++ b/frontend/javascripts/oxalis/view/action-bar/toolbar_view.tsx @@ -38,7 +38,7 @@ import { getActiveSegmentationTracing, getMappingInfoForVolumeTracing, getMaximumBrushSize, - getRenderableResolutionForActiveSegmentationTracing, + getRenderableMagForActiveSegmentationTracing, getSegmentColorAsRGBA, hasAgglomerateMapping, hasEditableMapping, @@ -864,9 +864,7 @@ export default function ToolbarView() { (state: OxalisState) => state.userConfiguration.useLegacyBindings, ); const activeTool = useSelector((state: OxalisState) => state.uiInformation.activeTool); - const maybeResolutionWithZoomStep = useSelector( - getRenderableResolutionForActiveSegmentationTracing, - ); + const maybeResolutionWithZoomStep = useSelector(getRenderableMagForActiveSegmentationTracing); const labeledResolution = maybeResolutionWithZoomStep != null ? maybeResolutionWithZoomStep.resolution : null;