From c8d5a8a505fb960a85008c2b01bc4e8e9677eec3 Mon Sep 17 00:00:00 2001 From: Xiao Gui Date: Thu, 7 Nov 2024 13:32:52 +0100 Subject: [PATCH] fixed zarr rotation --- frontend/src/const.ts | 2 +- frontend/src/state/inputs/selectors.ts | 4 ++-- frontend/src/state/outputs/effects.ts | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/const.ts b/frontend/src/const.ts index 136fba0d..50d94b50 100644 --- a/frontend/src/const.ts +++ b/frontend/src/const.ts @@ -429,7 +429,7 @@ export type ZarrAttrs = { axes: { name: "x" | "y" | "z" | string type: "space" | string - units: "micrometer" | string + unit: "micrometer" | string }[] datasets: { coordinateTransformations: { diff --git a/frontend/src/state/inputs/selectors.ts b/frontend/src/state/inputs/selectors.ts index 044e48fb..a4a2c506 100644 --- a/frontend/src/state/inputs/selectors.ts +++ b/frontend/src/state/inputs/selectors.ts @@ -98,7 +98,7 @@ const incInfoPipe = pipe( if (axes.length !== 3) { return throwError(() => new Error(`Can only deal with axes with length 3`)) } - for (const { type, units } of axes){ + for (const { type } of axes){ if (type !== "space") { return throwError(() => new Error(`Can only deal with space axes`)) } @@ -175,7 +175,7 @@ export const incVoxelSize = pipe( const dataset = datasets[0] const { scale, shape } = dataset return (scale as number[]).map((v, idx: number) => { - const unit = axes[idx].units + const unit = axes[idx].unit if (!(unit in cvtToNm)) { console.warn(`${unit} cannot be converted. Using 1 as default`) return 1 diff --git a/frontend/src/state/outputs/effects.ts b/frontend/src/state/outputs/effects.ts index 3272843e..435e5a95 100644 --- a/frontend/src/state/outputs/effects.ts +++ b/frontend/src/state/outputs/effects.ts @@ -31,6 +31,8 @@ export class Effects { const { mat4, vec3, quat } = export_nehuba; const { processQuatInput } = consts; + + const rotQuat = processQuatInput(input) const axis = vec3.fromValues(1, 0, 0) @@ -43,7 +45,7 @@ export class Effects { const centralizeMatrix = mat4.fromTranslation(mat4.create(), centerVoxel.map(v => v * -1)) const decentralizeMatrix = mat4.fromTranslation(mat4.create(), centerVoxel) - + console.log(centerVoxel, centralizeMatrix, decentralizeMatrix) mat4.mul(xformMat, centralizeMatrix, xformMat) mat4.mul(