arrayview 0.56.0__tar.gz → 0.56.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {arrayview-0.56.0 → arrayview-0.56.1}/PKG-INFO +1 -1
- {arrayview-0.56.0 → arrayview-0.56.1}/pyproject.toml +1 -1
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_overlays.py +7 -4
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_render.py +48 -14
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_preload.py +5 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_rendering.py +7 -10
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_websocket.py +5 -2
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_session.py +4 -3
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_viewer.html +972 -128
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/conftest.py +17 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_api.py +21 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_browser.py +158 -18
- arrayview-0.56.1/tests/test_diff_readahead.py +65 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_glides.py +22 -17
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_pane_names.py +7 -7
- {arrayview-0.56.0 → arrayview-0.56.1}/.gitignore +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/LICENSE +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/README.md +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/ARCHITECTURE.md +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/__init__.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/__main__.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_analysis.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_app.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_bootstrap_app.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_config.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_diagnostics.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_dicom.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_diff.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_extra_ports.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_icon.png +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_imaging.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_instance_registry.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_io.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_launch_plan.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_launch_trace.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_launcher.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_lifecycle.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_platform.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_analysis.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_drop.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_export.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_loading.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_persistence.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_preferences.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_query.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_segmentation.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_state.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_routes_vectorfield.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_segmentation.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_server.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_session_spec.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_shell.html +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_source_safety.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_synthetic_mri.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_torch.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_tutorial.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_vectorfield.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_view_memory.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_vscode.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_vscode_browser.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_vscode_extension.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_vscode_signal.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/_watch.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/arrayview-opener.vsix +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/gsap.min.js +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/src/arrayview/todo.md +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/capture_patient_loading.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/capture_v_animation.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/make_vectorfield_test_arrays.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_1d_arrays.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_backend_shared.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_cli.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_config.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_dicom.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_drop_import.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_first_slice_warmup.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_instance_registry.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_io.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_large_arrays.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_launch_blackbox.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_mode_roundtrip.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_nifti_meta.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_nifti_series.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_rgb_pixel_art.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_safe_server_stop.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_source_safety.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_torch.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_tutorial.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_view_memory.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_viewer_port.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/test_vsix_bundle.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/ui_audit.py +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/v_anim_frames/.gitkeep +0 -0
- {arrayview-0.56.0 → arrayview-0.56.1}/tests/visual_smoke.py +0 -0
|
@@ -7,6 +7,8 @@ import numpy as np
|
|
|
7
7
|
from arrayview._render import (
|
|
8
8
|
_build_mosaic_grid,
|
|
9
9
|
_composite_overlay_mask,
|
|
10
|
+
mosaic_grid_cols,
|
|
11
|
+
mosaic_tile_indices,
|
|
10
12
|
_extract_overlay_mask,
|
|
11
13
|
_overlay_is_label_map,
|
|
12
14
|
)
|
|
@@ -111,6 +113,7 @@ def _composite_mosaic_overlays(
|
|
|
111
113
|
idx_tuple: tuple[int, ...],
|
|
112
114
|
base_shape: tuple[int, ...],
|
|
113
115
|
mosaic_cols: int | None = None,
|
|
116
|
+
dim_z2: int = -1,
|
|
114
117
|
) -> np.ndarray:
|
|
115
118
|
"""Composite each overlay as a mosaic using the base mosaic's frame indices.
|
|
116
119
|
|
|
@@ -132,7 +135,9 @@ def _composite_mosaic_overlays(
|
|
|
132
135
|
else []
|
|
133
136
|
)
|
|
134
137
|
tile_shape = (int(base_shape[dim_y]), int(base_shape[dim_x]))
|
|
135
|
-
|
|
138
|
+
tiles = mosaic_tile_indices(base_shape, dim_z, dim_z2, idx_tuple)
|
|
139
|
+
n_frames = len(tiles)
|
|
140
|
+
mosaic_cols = mosaic_grid_cols(base_shape, dim_z, dim_z2, mosaic_cols)
|
|
136
141
|
|
|
137
142
|
for i, sid in enumerate(sids):
|
|
138
143
|
color, hidden = (
|
|
@@ -147,9 +152,7 @@ def _composite_mosaic_overlays(
|
|
|
147
152
|
alpha = max(0.0, min(1.0, alpha))
|
|
148
153
|
|
|
149
154
|
frames = []
|
|
150
|
-
for
|
|
151
|
-
frame_idx = list(idx_tuple)
|
|
152
|
-
frame_idx[dim_z] = frame
|
|
155
|
+
for frame_idx in tiles:
|
|
153
156
|
ov_raw = _extract_overlay_mask(
|
|
154
157
|
sid,
|
|
155
158
|
dim_x,
|
|
@@ -169,10 +169,34 @@ def mosaic_shape(batch):
|
|
|
169
169
|
return tuple(mshape)
|
|
170
170
|
|
|
171
171
|
|
|
172
|
+
def mosaic_tile_indices(shape, dim_z, dim_z2, idx):
|
|
173
|
+
"""Index list of every mosaic tile, row by row.
|
|
174
|
+
|
|
175
|
+
*dim_z* runs across the grid; *dim_z2* (``-1`` for none) runs down it,
|
|
176
|
+
so tile ``k`` is ``dim_z = k % shape[dim_z]``, ``dim_z2 = k // shape[dim_z]``.
|
|
177
|
+
"""
|
|
178
|
+
base = list(idx)
|
|
179
|
+
rows = range(shape[dim_z2]) if dim_z2 >= 0 else (None,)
|
|
180
|
+
tiles = []
|
|
181
|
+
for r in rows:
|
|
182
|
+
for c in range(shape[dim_z]):
|
|
183
|
+
t = list(base)
|
|
184
|
+
t[dim_z] = c
|
|
185
|
+
if r is not None:
|
|
186
|
+
t[dim_z2] = r
|
|
187
|
+
tiles.append(t)
|
|
188
|
+
return tiles
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def mosaic_grid_cols(shape, dim_z, dim_z2, mosaic_cols=None):
|
|
192
|
+
"""Column count a mosaic is laid out with (None = near-square)."""
|
|
193
|
+
return int(shape[dim_z]) if dim_z2 >= 0 else mosaic_cols
|
|
194
|
+
|
|
195
|
+
|
|
172
196
|
def _build_mosaic_grid(all_data, n, gap=2, cols=None):
|
|
173
197
|
"""Place n frames into a NaN-padded mosaic grid. Returns (grid, rows, cols)."""
|
|
174
198
|
if cols is not None:
|
|
175
|
-
rows =
|
|
199
|
+
rows = -(-n // cols)
|
|
176
200
|
else:
|
|
177
201
|
rows, cols = mosaic_shape(n)
|
|
178
202
|
H, W = all_data[0].shape
|
|
@@ -899,8 +923,9 @@ def render_mosaic(
|
|
|
899
923
|
vmax_override=None,
|
|
900
924
|
progress=None,
|
|
901
925
|
fit=None,
|
|
926
|
+
dim_z2=-1,
|
|
902
927
|
):
|
|
903
|
-
"""Render the mosaic grid of every slice along *dim_z
|
|
928
|
+
"""Render the mosaic grid of every slice along *dim_z* (and *dim_z2*, down).
|
|
904
929
|
|
|
905
930
|
``fit=(w, h)`` returns the grid already shrunk to the viewer's canvas
|
|
906
931
|
(as the live socket would before sending) and caches it that way, so a
|
|
@@ -909,12 +934,15 @@ def render_mosaic(
|
|
|
909
934
|
"""
|
|
910
935
|
idx_norm = list(idx_tuple)
|
|
911
936
|
idx_norm[dim_z] = 0
|
|
912
|
-
|
|
937
|
+
if dim_z2 >= 0:
|
|
938
|
+
idx_norm[dim_z2] = 0
|
|
939
|
+
key = (dim_x, dim_y, dim_z, tuple(idx_norm), colormap, dr, complex_mode, log_scale, mosaic_cols, vmin_override, vmax_override, dim_z2)
|
|
913
940
|
|
|
914
941
|
def build_full():
|
|
915
942
|
return _build_mosaic_rgba(
|
|
916
943
|
session, dim_x, dim_y, dim_z, idx_tuple, colormap, dr, complex_mode,
|
|
917
944
|
log_scale, mosaic_cols, vmin_override, vmax_override, progress,
|
|
945
|
+
dim_z2=dim_z2,
|
|
918
946
|
)
|
|
919
947
|
|
|
920
948
|
full = lambda: _mosaic_once(session, key, build_full)
|
|
@@ -993,8 +1021,11 @@ def fit_rgba(rgba, canvas_w, canvas_h):
|
|
|
993
1021
|
def _build_mosaic_rgba(
|
|
994
1022
|
session, dim_x, dim_y, dim_z, idx_tuple, colormap, dr, complex_mode,
|
|
995
1023
|
log_scale, mosaic_cols, vmin_override, vmax_override, progress,
|
|
1024
|
+
dim_z2=-1,
|
|
996
1025
|
):
|
|
997
|
-
|
|
1026
|
+
tiles = mosaic_tile_indices(session.shape, dim_z, dim_z2, idx_tuple)
|
|
1027
|
+
n = len(tiles)
|
|
1028
|
+
mosaic_cols = mosaic_grid_cols(session.shape, dim_z, dim_z2, mosaic_cols)
|
|
998
1029
|
# Reported per slice rather than estimated: each slice faults in roughly the
|
|
999
1030
|
# same number of pages, so slice i of n is an honest fraction of the wait.
|
|
1000
1031
|
# On an array whose display axes are the outer ones this loop is the whole
|
|
@@ -1002,15 +1033,8 @@ def _build_mosaic_rgba(
|
|
|
1002
1033
|
# every 4 bytes wanted costs a 4096-byte page and the slices between them
|
|
1003
1034
|
# cover the entire file.
|
|
1004
1035
|
frames_raw = []
|
|
1005
|
-
for i in
|
|
1006
|
-
frames_raw.append(
|
|
1007
|
-
extract_slice(
|
|
1008
|
-
session,
|
|
1009
|
-
dim_x,
|
|
1010
|
-
dim_y,
|
|
1011
|
-
[i if j == dim_z else idx_tuple[j] for j in range(len(session.shape))],
|
|
1012
|
-
)
|
|
1013
|
-
)
|
|
1036
|
+
for i, tile in enumerate(tiles):
|
|
1037
|
+
frames_raw.append(extract_slice(session, dim_x, dim_y, tile))
|
|
1014
1038
|
if progress is not None:
|
|
1015
1039
|
progress(i + 1, n)
|
|
1016
1040
|
frames = [apply_complex_mode(f, complex_mode) for f in frames_raw]
|
|
@@ -1067,6 +1091,8 @@ def _run_preload(
|
|
|
1067
1091
|
dim_z=-1,
|
|
1068
1092
|
complex_mode=0,
|
|
1069
1093
|
log_scale=False,
|
|
1094
|
+
dim_z2=-1,
|
|
1095
|
+
mosaic_cols=None,
|
|
1070
1096
|
):
|
|
1071
1097
|
shape = session.spatial_shape if session.rgb_axis is not None else session.shape
|
|
1072
1098
|
n = shape[slice_dim]
|
|
@@ -1074,7 +1100,11 @@ def _run_preload(
|
|
|
1074
1100
|
W = shape[dim_x]
|
|
1075
1101
|
if dim_z >= 0:
|
|
1076
1102
|
nz = shape[dim_z]
|
|
1077
|
-
mrows, mcols =
|
|
1103
|
+
mrows, mcols = (
|
|
1104
|
+
(shape[dim_z2], nz) if dim_z2 >= 0
|
|
1105
|
+
else (-(-nz // mosaic_cols), mosaic_cols) if mosaic_cols
|
|
1106
|
+
else mosaic_shape(nz)
|
|
1107
|
+
)
|
|
1078
1108
|
size_bytes = n * (mrows * H) * (mcols * W) * 4
|
|
1079
1109
|
else:
|
|
1080
1110
|
size_bytes = n * H * W * 4
|
|
@@ -1103,6 +1133,8 @@ def _run_preload(
|
|
|
1103
1133
|
dr,
|
|
1104
1134
|
complex_mode,
|
|
1105
1135
|
log_scale,
|
|
1136
|
+
mosaic_cols=mosaic_cols,
|
|
1137
|
+
dim_z2=dim_z2,
|
|
1106
1138
|
)
|
|
1107
1139
|
else:
|
|
1108
1140
|
if session.rgb_axis is not None:
|
|
@@ -1140,6 +1172,8 @@ __all__ = [
|
|
|
1140
1172
|
"OVERLAY_ALPHA",
|
|
1141
1173
|
# Utility
|
|
1142
1174
|
"mosaic_shape",
|
|
1175
|
+
"mosaic_tile_indices",
|
|
1176
|
+
"mosaic_grid_cols",
|
|
1143
1177
|
# Slice extraction
|
|
1144
1178
|
"_compute_vmin_vmax",
|
|
1145
1179
|
"extract_slice",
|
|
@@ -21,6 +21,9 @@ def register_preload_routes(app) -> None:
|
|
|
21
21
|
dr = int(body.get("dr", 1))
|
|
22
22
|
slice_dim = int(body["slice_dim"])
|
|
23
23
|
dim_z = int(body.get("dim_z", -1))
|
|
24
|
+
dim_z2 = int(body.get("dim_z2", -1)) if dim_z >= 0 else -1
|
|
25
|
+
_mc = body.get("mosaic_cols") if dim_z >= 0 else None
|
|
26
|
+
mosaic_cols = int(_mc) if _mc is not None else None
|
|
24
27
|
complex_mode = int(body.get("complex_mode", 0))
|
|
25
28
|
log_scale = bool(body.get("log_scale", False))
|
|
26
29
|
|
|
@@ -40,6 +43,8 @@ def register_preload_routes(app) -> None:
|
|
|
40
43
|
dim_z,
|
|
41
44
|
complex_mode,
|
|
42
45
|
log_scale,
|
|
46
|
+
dim_z2,
|
|
47
|
+
mosaic_cols,
|
|
43
48
|
),
|
|
44
49
|
daemon=True,
|
|
45
50
|
).start()
|
|
@@ -11,6 +11,7 @@ from arrayview._render import (
|
|
|
11
11
|
lut_rgba,
|
|
12
12
|
LUTS,
|
|
13
13
|
_build_mosaic_grid,
|
|
14
|
+
mosaic_tile_indices,
|
|
14
15
|
_compute_vmin_vmax,
|
|
15
16
|
_ensure_lut,
|
|
16
17
|
_init_luts,
|
|
@@ -85,6 +86,7 @@ def register_rendering_routes(app, *, get_session_or_404) -> None:
|
|
|
85
86
|
dr: int = 1,
|
|
86
87
|
slice_dim: int = -1,
|
|
87
88
|
dim_z: int = -1,
|
|
89
|
+
dim_z2: int = -1,
|
|
88
90
|
complex_mode: int = 0,
|
|
89
91
|
log_scale: bool = False,
|
|
90
92
|
vmin_override: float | None = None,
|
|
@@ -183,26 +185,21 @@ def register_rendering_routes(app, *, get_session_or_404) -> None:
|
|
|
183
185
|
mosaic_cols=mosaic_cols,
|
|
184
186
|
vmin_override=vmin_override,
|
|
185
187
|
vmax_override=vmax_override,
|
|
188
|
+
dim_z2=dim_z2,
|
|
186
189
|
)
|
|
187
190
|
rgba = _composite_mosaic_overlays(
|
|
188
191
|
rgba, overlay_sid, overlay_colors, overlay_alpha, overlay_alphas,
|
|
189
192
|
overlay_outline, dim_x, dim_y, dim_z, idx_tuple, session.shape,
|
|
190
|
-
mosaic_cols,
|
|
193
|
+
mosaic_cols, dim_z2=dim_z2,
|
|
191
194
|
)
|
|
192
195
|
if vmin_override is not None and vmax_override is not None:
|
|
193
196
|
vmin, vmax = float(vmin_override), float(vmax_override)
|
|
194
197
|
else:
|
|
195
198
|
frames_raw = [
|
|
196
|
-
extract_slice(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
dim_y,
|
|
200
|
-
[
|
|
201
|
-
i if j == dim_z else idx_tuple[j]
|
|
202
|
-
for j in range(len(session.shape))
|
|
203
|
-
],
|
|
199
|
+
extract_slice(session, dim_x, dim_y, tile)
|
|
200
|
+
for tile in mosaic_tile_indices(
|
|
201
|
+
session.shape, dim_z, dim_z2, idx_tuple
|
|
204
202
|
)
|
|
205
|
-
for i in range(session.shape[dim_z])
|
|
206
203
|
]
|
|
207
204
|
frames = [apply_complex_mode(frame, complex_mode) for frame in frames_raw]
|
|
208
205
|
if log_scale:
|
|
@@ -632,6 +632,8 @@ def register_websocket_routes(app) -> None:
|
|
|
632
632
|
colormap = str(msg.get("colormap", "gray"))
|
|
633
633
|
dr = int(msg.get("dr", 1))
|
|
634
634
|
dim_z = int(msg.get("dim_z", -1))
|
|
635
|
+
# Second mosaic dim (down the rows); plain mosaic only.
|
|
636
|
+
dim_z2 = int(msg.get("dim_z2", -1)) if dim_z >= 0 else -1
|
|
635
637
|
complex_mode = int(msg.get("complex_mode", 0))
|
|
636
638
|
log_scale = bool(msg.get("log_scale", False))
|
|
637
639
|
_vmin_ov = msg.get("vmin_override")
|
|
@@ -736,13 +738,14 @@ def register_websocket_routes(app) -> None:
|
|
|
736
738
|
vmax_override=vmax_override,
|
|
737
739
|
progress=_render_progress_reporter(loop, ws, label='Building mosaic'),
|
|
738
740
|
fit=mosaic_fit,
|
|
741
|
+
dim_z2=dim_z2,
|
|
739
742
|
),
|
|
740
743
|
)
|
|
741
744
|
rgba = _composite_mosaic_overlays(
|
|
742
745
|
rgba, msg.get("overlay_sid"), msg.get("overlay_colors"),
|
|
743
746
|
float(msg.get("overlay_alpha", 0.45)), msg.get("overlay_alphas"),
|
|
744
747
|
bool(msg.get("overlay_outline", False)), dim_x, dim_y, dim_z,
|
|
745
|
-
idx_tuple, session.shape, mosaic_cols,
|
|
748
|
+
idx_tuple, session.shape, mosaic_cols, dim_z2=dim_z2,
|
|
746
749
|
)
|
|
747
750
|
h, w = rgba.shape[:2]
|
|
748
751
|
raw = extract_slice(session, dim_x, dim_y, list(idx_tuple))
|
|
@@ -952,7 +955,7 @@ def register_websocket_routes(app) -> None:
|
|
|
952
955
|
colormap=colormap, dr=dr, complex_mode=complex_mode,
|
|
953
956
|
log_scale=log_scale, mosaic_cols=mosaic_cols,
|
|
954
957
|
vmin_override=vmin_override, vmax_override=vmax_override,
|
|
955
|
-
fit=mosaic_fit,
|
|
958
|
+
fit=mosaic_fit, dim_z2=dim_z2,
|
|
956
959
|
),
|
|
957
960
|
)
|
|
958
961
|
stack_axes = tuple(getattr(session.data, "_stack_axes", ()))
|
|
@@ -425,15 +425,16 @@ def _schedule_mosaic_prefetch(session, dim_x, dim_y, dim_z, idx_list, slice_dim,
|
|
|
425
425
|
(colormap, dr, complex_mode, log_scale, mosaic_cols, vmin/vmax overrides)
|
|
426
426
|
so the warmed grid hits the same cache key as the real request.
|
|
427
427
|
"""
|
|
428
|
-
|
|
428
|
+
dim_z2 = int(render_args.get("dim_z2", -1))
|
|
429
|
+
if slice_dim < 0 or slice_dim in (dim_z, dim_z2):
|
|
429
430
|
return
|
|
430
431
|
current = idx_list[slice_dim]
|
|
431
|
-
lane = ("mosaic", dim_x, dim_y, dim_z, slice_dim)
|
|
432
|
+
lane = ("mosaic", dim_x, dim_y, dim_z, dim_z2, slice_dim)
|
|
432
433
|
lanes, generation, direction = _prefetch_lane_step(session, lane, current, None)
|
|
433
434
|
target = current + direction
|
|
434
435
|
if not 0 <= target < session.shape[slice_dim]:
|
|
435
436
|
return
|
|
436
|
-
frames = session.shape[dim_z]
|
|
437
|
+
frames = session.shape[dim_z] * (session.shape[dim_z2] if dim_z2 >= 0 else 1)
|
|
437
438
|
grid_bytes = frames * session.shape[dim_x] * session.shape[dim_y] * 4
|
|
438
439
|
# Never let the warmed grid push the one on screen out of the cache.
|
|
439
440
|
if 2 * grid_bytes > getattr(session, "MOSAIC_CACHE_BYTES", 0):
|