Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/GlobalStates/GlobalStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface Coord {

type StoreState = {
dataShape: number[];
axisShape: number[];
shape: THREE.Vector3;
valueScales: { maxVal: number; minVal: number };
colormap: THREE.DataTexture;
Expand All @@ -27,6 +28,11 @@ type StoreState = {
dimArrays: number[][];
dimNames: string[];
dimUnits: string[];
axisDimArrays: number[][];
axisDimNames: string[];
axisDimUnits: string[];
axisOrder: number[]; // Order of original axes for adjusting after transformation
axisFlipped: boolean[];
dimCoords: Record<string, DimCoords>;
plotDim: number;
flipY:boolean;
Expand All @@ -50,6 +56,7 @@ type StoreState = {

// setters
setDataShape: (dataShape: number[]) => void;
setAxisShape: (axisShape: number[]) => void;
setShape: (shape: THREE.Vector3) => void;
setValueScales: (valueScales: { maxVal: number; minVal: number }) => void;
setColormap: (colormap: THREE.DataTexture) => void;
Expand All @@ -61,6 +68,11 @@ type StoreState = {
setDimArrays: (dimArrays: number[][]) => void;
setDimNames: (dimNames: string[]) => void;
setDimUnits: (dimUnits: string[]) => void;
setAxisDimArrays: (axisDimArrays: number[][]) => void;
setAxisDimNames: (axisDimNames: string[]) => void;
setAxisDimUnits: (axisDimUnits: string[]) => void;
setAxisOrder: (axisOrder: number[]) => void;
setAxisFlipped: (axisFlipped: boolean[]) => void;
setDimCoords: (dimCoords?: Record<string, DimCoords>) => void;
updateDimCoords: (newDims: Record<string, DimCoords>) => void;
setPlotDim: (plotDim: number) => void;
Expand All @@ -86,6 +98,7 @@ type StoreState = {

export const useGlobalStore = create<StoreState>((set, get) => ({
dataShape: [1, 1, 1],
axisShape: [1, 1, 1],
shape: new THREE.Vector3(2, 2, 2),
valueScales: { maxVal: 1, minVal: -1 },
colormap: GetColorMapTexture(),
Expand All @@ -96,6 +109,11 @@ export const useGlobalStore = create<StoreState>((set, get) => ({
dimArrays: [[0], [0], [0]],
dimNames: ["Default"],
dimUnits: ["Default"],
axisDimArrays: [[0], [0], [0]],
axisDimNames: ["Default"],
axisDimUnits: ["Default"],
axisOrder: [0,1,2],
axisFlipped: [false, false, false],
dimCoords: {},
plotDim: 0,
flipY: false,
Expand All @@ -119,6 +137,7 @@ export const useGlobalStore = create<StoreState>((set, get) => ({
// setters

setDataShape: (dataShape) => set({ dataShape }),
setAxisShape: (axisShape) => set({ axisShape }),
setShape: (shape) => set({ shape }),
setValueScales: (valueScales) => set({ valueScales }),
setColormap: (colormap) => set({ colormap }),
Expand All @@ -140,6 +159,11 @@ export const useGlobalStore = create<StoreState>((set, get) => ({
setDimArrays: (dimArrays) => set({ dimArrays }),
setDimNames: (dimNames) => set({ dimNames }),
setDimUnits: (dimUnits) => set({ dimUnits }),
setAxisDimArrays: (axisDimArrays) => set({ axisDimArrays }),
setAxisDimNames: (axisDimNames) => set({ axisDimNames }),
setAxisDimUnits: (axisDimUnits) => set({ axisDimUnits }),
setAxisOrder: (axisOrder) => set({ axisOrder }),
setAxisFlipped: (axisFlipped) => set({ axisFlipped }),
setDimCoords: (dimCoords) => set({ dimCoords }),
updateDimCoords: (newDims) => {
const merged = { ...newDims,...get().dimCoords };
Expand Down
9 changes: 4 additions & 5 deletions src/GlobalStates/PlotStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ type PlotState ={
maskValue: number;
cameraPosition: THREE.Vector3;
disablePointScale: boolean;
camera: THREE.Camera | undefined;
permute: number[] | undefined;
showTransformAxis: boolean;

setQuality: (quality: number) => void;
setTimeScale: (timeScale : number) =>void;
Expand Down Expand Up @@ -120,10 +121,8 @@ type PlotState ={
setUseOrtho: (useOrtho: boolean) => void;
setFillValue: (fillValue: number | undefined) => void;
setCameraPosition: (cameraPosition: THREE.Vector3) => void;

}


export const usePlotStore = create<PlotState>((set, get) => ({
plotType: "volume",
pointSize: 5,
Expand Down Expand Up @@ -188,7 +187,8 @@ export const usePlotStore = create<PlotState>((set, get) => ({
borderWidth: 0.05,
cameraPosition: new THREE.Vector3(0, 0, 5),
disablePointScale: false,
camera: undefined,
permute: undefined,
showTransformAxis: false,

setVTransferRange: (vTransferRange) => set({ vTransferRange }),
setVTransferScale: (vTransferScale) => set({ vTransferScale }),
Expand Down Expand Up @@ -246,5 +246,4 @@ export const usePlotStore = create<PlotState>((set, get) => ({
setUseOrtho: (useOrtho) => set({ useOrtho }),
setFillValue: (fillValue) => set({ fillValue }),
setCameraPosition: (cameraPosition) => set({ cameraPosition }),

}))
25 changes: 25 additions & 0 deletions src/GlobalStates/PlotTransformStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { create } from "zustand";

type PlotTransformState = {
rotateZ: number;
rotateX: number;
mirrorVertical: boolean;
mirrorHorizontal: boolean;

setRotateZ: (rotateZ: number) => void;
setRotateX: (rotateX: number) => void;
setMirrorVertical: (mirrorVertical: boolean) => void;
setMirrorHorizontal: (mirrorHorizontal: boolean) => void;
}

export const usePlotTransformStore = create<PlotTransformState>((set) => ({
rotateZ: 0,
rotateX: 0,
mirrorVertical: false,
mirrorHorizontal: false,

setRotateZ: (rotateZ) => set({ rotateZ }),
setRotateX: (rotateX) => set({ rotateX }),
setMirrorVertical: (mirrorVertical) => set({ mirrorVertical }),
setMirrorHorizontal: (mirrorHorizontal) => set({ mirrorHorizontal }),
}));
2 changes: 0 additions & 2 deletions src/GlobalStates/ZarrStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type ZarrState = {
fetchOptions: FetchStoreOptions | null;
abortController: AbortController | null;
fetchKey: number;
blobKey: string | undefined; // The key for the stored File blob for a local NC

setZSlice: (zSlice: [number , number | null]) => void;
setYSlice: (ySlice: [number , number | null]) => void;
Expand Down Expand Up @@ -64,7 +63,6 @@ export const useZarrStore = create<ZarrState>((set, get) => ({
fetchOptions: null,
abortController: null,
fetchKey: 0,
blobKey: undefined,

setZSlice: (zSlice) => set({ zSlice }),
setYSlice: (ySlice) => set({ ySlice }),
Expand Down
File renamed without changes
128 changes: 0 additions & 128 deletions src/assets/catalogs/IcechunkCatalog.ts

This file was deleted.

92 changes: 0 additions & 92 deletions src/assets/catalogs/ZarrCatalog.ts

This file was deleted.

Loading
Loading