Skip to content

Commit

Permalink
rename in volumetracing accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
knollengewaechs committed Oct 10, 2024
1 parent 8064687 commit 5e2ff76
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions frontend/javascripts/oxalis/model/accessors/tool_accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { OxalisState } from "oxalis/store";
import {
type AgglomerateState,
getActiveSegmentationTracing,
getRenderableResolutionForSegmentationTracing,
getRenderableMagForSegmentationTracing,
hasAgglomerateMapping,
isVolumeAnnotationDisallowedForZoom,
} from "oxalis/model/accessors/volumetracing_accessor";
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -191,7 +193,7 @@ function _getResolutionInfoOfActiveSegmentationTracingLayer(state: OxalisState):
}

const getResolutionInfoOfActiveSegmentationTracingLayer = memoizeOne(
_getResolutionInfoOfActiveSegmentationTracingLayer,
_getMagnificationInfoOfActiveSegmentationTracingLayer,
);
export function getServerVolumeTracings(
tracings: Array<ServerTracing> | null | undefined,
Expand Down Expand Up @@ -537,23 +539,23 @@ 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;
}
| 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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
enforceActiveVolumeTracing,
getActiveSegmentationTracing,
getMaximumBrushSize,
getRenderableResolutionForSegmentationTracing,
getRenderableMagForSegmentationTracing,
getRequestedOrVisibleSegmentationLayer,
getSegmentsForLayer,
isVolumeAnnotationDisallowedForZoom,
Expand Down Expand Up @@ -213,7 +213,7 @@ export function* editVolumeLayerAsync(): Saga<any> {
}

const maybeLabeledResolutionWithZoomStep = yield* select((state) =>
getRenderableResolutionForSegmentationTracing(state, volumeTracing),
getRenderableMagForSegmentationTracing(state, volumeTracing),
);

if (!maybeLabeledResolutionWithZoomStep) {
Expand Down
6 changes: 2 additions & 4 deletions frontend/javascripts/oxalis/view/action-bar/toolbar_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
getActiveSegmentationTracing,
getMappingInfoForVolumeTracing,
getMaximumBrushSize,
getRenderableResolutionForActiveSegmentationTracing,
getRenderableMagForActiveSegmentationTracing,
getSegmentColorAsRGBA,
hasAgglomerateMapping,
hasEditableMapping,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5e2ff76

Please sign in to comment.