Skip to content

Commit 99d9de5

Browse files
MichaelBuessemeyerMichael Büßemeyer
and
Michael Büßemeyer
authored
Fix volume annotation tool availability on datasets with rotation transforms (#8432)
* make volume annotation tools properly available for datasets with rotation transforms where the dataset rotation is turned off but not the active volume layer is the selected "nativelyRenderedLayerName" * add changelog entry * ensure reference to identity transform is also returned when transform for skeleton layer is calculated * rename function --------- Co-authored-by: Michael Büßemeyer <frameworklinux+MichaelBuessemeyer@users.noreply.github.com>
1 parent 914b020 commit 99d9de5

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
2020
### Fixed
2121
- Fixed a bug that would lock a non-existing mapping to an empty segmentation layer under certain conditions. [#8401](https://github.com/scalableminds/webknossos/pull/8401)
2222
- Fixed the alignment of the button that allows restricting floodfill operations to a bounding box. [#8388](https://github.com/scalableminds/webknossos/pull/8388)
23+
- Fixed a bug for rotated dataset where volume tools were disabled although the dataset was rendered untransformed. [#8432](https://github.com/scalableminds/webknossos/pull/8432)
2324
- Fixed rare bug where saving got stuck. [#8409](https://github.com/scalableminds/webknossos/pull/8409)
2425
- Fixed a bug where reverting annotations could get stuck if some of its layers had been deleted in the meantime. [#8405](https://github.com/scalableminds/webknossos/pull/8405)
2526
- Fixed a bug where newly added remote datasets would always appear in root folder, regardless of actual selected folder. [#8425](https://github.com/scalableminds/webknossos/pull/8425)

frontend/javascripts/oxalis/model/accessors/dataset_layer_transformation_accessor.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ export function isLayerWithoutTransformationConfigSupport(layer: APIDataLayer |
191191
);
192192
}
193193

194+
function toIdentityTransformMaybe(transform: Transform | null): Transform {
195+
return transform && !equalsIdentityTransform(transform) ? transform : IdentityTransform;
196+
}
197+
194198
function _getTransformsForLayerOrNull(
195199
dataset: APIDataset,
196200
layer: APIDataLayer | APISkeletonLayer,
@@ -210,7 +214,7 @@ function _getTransformsForLayerOrNull(
210214
const layerTransforms = getOriginalTransformsForLayerOrNull(dataset, layer as APIDataLayer);
211215
if (nativelyRenderedLayerName == null) {
212216
// No layer is requested to be rendered natively. -> We can use the layer's transforms as is.
213-
return layerTransforms;
217+
return toIdentityTransformMaybe(layerTransforms);
214218
}
215219

216220
// Apply the inverse of the layer that should be rendered natively
@@ -221,11 +225,11 @@ function _getTransformsForLayerOrNull(
221225
if (transformsOfNativeLayer == null) {
222226
// The inverse of no transforms, are no transforms. Leave the layer
223227
// transforms untouched.
224-
return layerTransforms;
228+
return toIdentityTransformMaybe(layerTransforms);
225229
}
226230

227231
const inverseNativeTransforms = invertTransform(transformsOfNativeLayer);
228-
return chainTransforms(layerTransforms, inverseNativeTransforms);
232+
return toIdentityTransformMaybe(chainTransforms(layerTransforms, inverseNativeTransforms));
229233
}
230234

231235
export const getTransformsForLayerOrNull = memoizeWithThreeKeys(_getTransformsForLayerOrNull);
@@ -239,7 +243,7 @@ export function getTransformsForLayer(
239243
);
240244
}
241245

242-
export function isIdentityTransform(transform: Transform) {
246+
function equalsIdentityTransform(transform: Transform) {
243247
return transform.type === "affine" && _.isEqual(transform.affineMatrix, Identity4x4);
244248
}
245249

@@ -266,7 +270,7 @@ function _getTransformsForLayerThatDoesNotSupportTransformationConfigOrNull(
266270
const someLayersTransformsMaybe = usableReferenceLayer
267271
? getTransformsForLayerOrNull(dataset, usableReferenceLayer, nativelyRenderedLayerName)
268272
: null;
269-
return someLayersTransformsMaybe;
273+
return toIdentityTransformMaybe(someLayersTransformsMaybe);
270274
} else if (nativelyRenderedLayerName != null && allLayersSameRotation) {
271275
// If all layers have the same transformations and at least one is rendered natively, this means that all layer should be rendered natively.
272276
return null;
@@ -281,7 +285,7 @@ function _getTransformsForLayerThatDoesNotSupportTransformationConfigOrNull(
281285
return null;
282286
}
283287

284-
return invertTransform(transformsOfNativeLayer);
288+
return toIdentityTransformMaybe(invertTransform(transformsOfNativeLayer));
285289
}
286290

287291
export const getTransformsForLayerThatDoesNotSupportTransformationConfigOrNull = memoizeOne(

frontend/javascripts/oxalis/view/left-border-tabs/layer_settings_tab.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
settingsTooltips,
4141
} from "messages";
4242
import type { Vector3 } from "oxalis/constants";
43-
import Constants, { ControlModeEnum, MappingStatusEnum } from "oxalis/constants";
43+
import Constants, { ControlModeEnum, IdentityTransform, MappingStatusEnum } from "oxalis/constants";
4444
import defaultState from "oxalis/default_state";
4545
import {
4646
getDefaultValueRangeOfLayer,
@@ -55,7 +55,6 @@ import {
5555
getTransformsForLayer,
5656
getTransformsForLayerOrNull,
5757
hasDatasetTransforms,
58-
isIdentityTransform,
5958
isLayerWithoutTransformationConfigSupport,
6059
} from "oxalis/model/accessors/dataset_layer_transformation_accessor";
6160
import {
@@ -208,7 +207,7 @@ function TransformationIcon({ layer }: { layer: APIDataLayer | APISkeletonLayer
208207
if (!showIcon) {
209208
return null;
210209
}
211-
const isRenderedNatively = transform == null || isIdentityTransform(transform);
210+
const isRenderedNatively = transform == null || transform === IdentityTransform;
212211

213212
const typeToLabel = {
214213
affine: "an affine",

0 commit comments

Comments
 (0)