arrayview 0.55.1__py3-none-any.whl → 0.56.0__py3-none-any.whl
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/_diff.py +12 -34
- arrayview/_io.py +17 -2
- arrayview/_render.py +7 -0
- arrayview/_routes_rendering.py +0 -7
- arrayview/_viewer.html +316 -130
- {arrayview-0.55.1.dist-info → arrayview-0.56.0.dist-info}/METADATA +1 -1
- {arrayview-0.55.1.dist-info → arrayview-0.56.0.dist-info}/RECORD +10 -10
- {arrayview-0.55.1.dist-info → arrayview-0.56.0.dist-info}/WHEEL +0 -0
- {arrayview-0.55.1.dist-info → arrayview-0.56.0.dist-info}/entry_points.txt +0 -0
- {arrayview-0.55.1.dist-info → arrayview-0.56.0.dist-info}/licenses/LICENSE +0 -0
arrayview/_diff.py
CHANGED
|
@@ -135,13 +135,8 @@ def _compute_diff(
|
|
|
135
135
|
diff_mode,
|
|
136
136
|
indices_a=None,
|
|
137
137
|
indices_b=None,
|
|
138
|
-
stats_out=None,
|
|
139
138
|
):
|
|
140
|
-
"""Return raw diff, display range, colormap, and optional separator mask.
|
|
141
|
-
|
|
142
|
-
When *stats_out* is a dict it is filled with summary numbers for the
|
|
143
|
-
compared view (see `_diff_summary`).
|
|
144
|
-
"""
|
|
139
|
+
"""Return raw diff, display range, colormap, and optional separator mask."""
|
|
145
140
|
def _parse_indices(raw_indices):
|
|
146
141
|
if raw_indices is None:
|
|
147
142
|
return ()
|
|
@@ -175,15 +170,15 @@ def _compute_diff(
|
|
|
175
170
|
a = _render_values(session_a, dim_x, dim_y, idx_a, complex_mode, log_scale)
|
|
176
171
|
b = _render_values(session_b, dim_x, dim_y, idx_b, complex_mode, log_scale)
|
|
177
172
|
b = _resize_values_like(b, a)
|
|
178
|
-
if stats_out is not None:
|
|
179
|
-
stats_out.update(_diff_summary(a, b, nan_mask))
|
|
180
173
|
if diff_mode == 1:
|
|
181
174
|
raw = a - b
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
fg = raw[~((a == 0) & (b == 0))]
|
|
176
|
+
fg = fg if fg.size else raw
|
|
177
|
+
lo = float(np.nanpercentile(fg, 1))
|
|
178
|
+
hi = float(np.nanpercentile(fg, 99))
|
|
184
179
|
vmax = max(abs(lo), abs(hi)) or 1.0
|
|
185
180
|
vmin = -vmax
|
|
186
|
-
colormap = "
|
|
181
|
+
colormap = "RdBu_r"
|
|
187
182
|
elif diff_mode == 2:
|
|
188
183
|
raw = np.abs(a - b)
|
|
189
184
|
vmax = float(np.nanmax(raw)) or 1.0
|
|
@@ -196,32 +191,14 @@ def _compute_diff(
|
|
|
196
191
|
vmin = 0.0
|
|
197
192
|
colormap = "afmhot"
|
|
198
193
|
|
|
194
|
+
# Background (zero in both A and B, e.g. outside a masked head) becomes
|
|
195
|
+
# NaN: drawn black like the source panes instead of the colormap's
|
|
196
|
+
# zero colour (white for RdBu_r), and left out of histogram/hover.
|
|
197
|
+
raw = np.asarray(raw, dtype=np.float32)
|
|
198
|
+
raw[(a == 0) & (b == 0)] = np.nan
|
|
199
199
|
return raw, vmin, vmax, colormap, nan_mask
|
|
200
200
|
|
|
201
201
|
|
|
202
|
-
def _diff_summary(a: np.ndarray, b: np.ndarray, nan_mask: np.ndarray | None) -> dict[str, float]:
|
|
203
|
-
"""RMS of A−B, largest |A−B|, and RMS of A−B relative to the RMS of A.
|
|
204
|
-
|
|
205
|
-
Pixels that are not finite in either array (or are mosaic separators)
|
|
206
|
-
are left out. Empty or all-zero inputs give NaN for what is undefined.
|
|
207
|
-
"""
|
|
208
|
-
a = np.asarray(a, dtype=np.float64)
|
|
209
|
-
b = np.asarray(b, dtype=np.float64)
|
|
210
|
-
valid = np.isfinite(a) & np.isfinite(b)
|
|
211
|
-
if nan_mask is not None and nan_mask.shape == valid.shape:
|
|
212
|
-
valid &= ~nan_mask
|
|
213
|
-
if not valid.any():
|
|
214
|
-
return {"rmse": float("nan"), "max_abs": float("nan"), "rel": float("nan")}
|
|
215
|
-
d = a[valid] - b[valid]
|
|
216
|
-
rmse = float(np.sqrt(np.mean(d * d)))
|
|
217
|
-
rms_a = float(np.sqrt(np.mean(a[valid] ** 2)))
|
|
218
|
-
return {
|
|
219
|
-
"rmse": rmse,
|
|
220
|
-
"max_abs": float(np.max(np.abs(d))),
|
|
221
|
-
"rel": rmse / rms_a if rms_a > 0 else float("nan"),
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
202
|
def _render_diff_rgba(
|
|
226
203
|
raw: np.ndarray,
|
|
227
204
|
vmin: float,
|
|
@@ -237,6 +214,7 @@ def _render_diff_rgba(
|
|
|
237
214
|
_ensure_lut(colormap)
|
|
238
215
|
lut = LUTS.get(colormap, LUTS["gray"])
|
|
239
216
|
rgba = lut_rgba(lut, (normalized * 255).astype(np.uint8))
|
|
217
|
+
rgba[~np.isfinite(raw)] = [0, 0, 0, 255]
|
|
240
218
|
if nan_mask is not None and nan_mask.shape == rgba.shape[:2]:
|
|
241
219
|
rgba[nan_mask] = [22, 22, 22, 255]
|
|
242
220
|
return rgba
|
arrayview/_io.py
CHANGED
|
@@ -205,11 +205,12 @@ def _select_npz_array(npz, filepath):
|
|
|
205
205
|
class _NiftiHeaderOnly:
|
|
206
206
|
"""What a collection scan reads from a NIfTI image, without the image."""
|
|
207
207
|
|
|
208
|
-
__slots__ = ("shape", "affine", "_dtype")
|
|
208
|
+
__slots__ = ("shape", "affine", "header", "_dtype")
|
|
209
209
|
|
|
210
210
|
def __init__(self, header):
|
|
211
211
|
self.shape = tuple(int(v) for v in header.get_data_shape())
|
|
212
212
|
self.affine = header.get_best_affine()
|
|
213
|
+
self.header = header
|
|
213
214
|
self._dtype = header.get_data_dtype()
|
|
214
215
|
|
|
215
216
|
def get_data_dtype(self):
|
|
@@ -246,6 +247,14 @@ def _read_plain_nifti1_header(filepath):
|
|
|
246
247
|
return None
|
|
247
248
|
|
|
248
249
|
|
|
250
|
+
def _header_names_orientation(header):
|
|
251
|
+
"""False only for a NIfTI header with neither sform nor qform set."""
|
|
252
|
+
try:
|
|
253
|
+
return int(header["sform_code"]) > 0 or int(header["qform_code"]) > 0
|
|
254
|
+
except Exception:
|
|
255
|
+
return True
|
|
256
|
+
|
|
257
|
+
|
|
249
258
|
def _nifti_header_with_meta(filepath, *, native=False, header_only=False):
|
|
250
259
|
"""Return a NIfTI image and spatial metadata without reading voxels.
|
|
251
260
|
|
|
@@ -280,7 +289,13 @@ def _nifti_header_with_meta(filepath, *, native=False, header_only=False):
|
|
|
280
289
|
for i in range(3):
|
|
281
290
|
if canonical_voxel_sizes[i] > 0:
|
|
282
291
|
norm_rot[:, i] = canonical_rot[:, i] / canonical_voxel_sizes[i]
|
|
283
|
-
|
|
292
|
+
# Without an sform or qform the affine is nibabel's placeholder; naming
|
|
293
|
+
# anatomy from it would turn views on a guess.
|
|
294
|
+
axis_labels = (
|
|
295
|
+
tuple(str(v) for v in nib.aff2axcodes(data_affine))
|
|
296
|
+
if _header_names_orientation(getattr(img, "header", None))
|
|
297
|
+
else ()
|
|
298
|
+
)
|
|
284
299
|
off_diag_max = max(
|
|
285
300
|
(abs(norm_rot[i, j]) for i in range(3) for j in range(3) if i != j),
|
|
286
301
|
default=0.0,
|
arrayview/_render.py
CHANGED
|
@@ -71,6 +71,11 @@ _ICEFIRE_STOPS = [
|
|
|
71
71
|
]
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
# qMRI maps: the lowest entry (at or below vmin — masked-out background at 0) is
|
|
75
|
+
# pure black instead of the map's own dark navy. Every other entry is untouched.
|
|
76
|
+
_BLACK_AT_VMIN = ("lipari", "navia")
|
|
77
|
+
|
|
78
|
+
|
|
74
79
|
def _init_luts():
|
|
75
80
|
"""Build colourmap LUTs on first use (defers matplotlib + qmricolors import)."""
|
|
76
81
|
global _mpl_colormaps
|
|
@@ -98,6 +103,8 @@ def _init_luts():
|
|
|
98
103
|
],
|
|
99
104
|
axis=1,
|
|
100
105
|
)
|
|
106
|
+
if name in _BLACK_AT_VMIN:
|
|
107
|
+
lut[0, :3] = 0
|
|
101
108
|
LUTS[name] = lut
|
|
102
109
|
for name in COLORMAPS:
|
|
103
110
|
COLORMAP_GRADIENT_STOPS[name] = _lut_to_gradient_stops(LUTS[name])
|
arrayview/_routes_rendering.py
CHANGED
|
@@ -360,7 +360,6 @@ def register_rendering_routes(app, *, get_session_or_404) -> None:
|
|
|
360
360
|
session_b = SESSIONS.get(sid_b)
|
|
361
361
|
if not session_a or not session_b:
|
|
362
362
|
return Response(status_code=404)
|
|
363
|
-
stats: dict[str, float] = {}
|
|
364
363
|
try:
|
|
365
364
|
raw, vmin, vmax, colormap, nan_mask = _compute_diff(
|
|
366
365
|
session_a,
|
|
@@ -375,7 +374,6 @@ def register_rendering_routes(app, *, get_session_or_404) -> None:
|
|
|
375
374
|
diff_mode,
|
|
376
375
|
indices_a=indices_a,
|
|
377
376
|
indices_b=indices_b,
|
|
378
|
-
stats_out=stats,
|
|
379
377
|
)
|
|
380
378
|
except Exception:
|
|
381
379
|
return Response(status_code=422)
|
|
@@ -401,11 +399,6 @@ def register_rendering_routes(app, *, get_session_or_404) -> None:
|
|
|
401
399
|
"X-ArrayView-Vmin": str(vmin),
|
|
402
400
|
"X-ArrayView-Vmax": str(vmax),
|
|
403
401
|
"X-ArrayView-Colormap": colormap,
|
|
404
|
-
# Numbers for the A−B title: RMS difference, largest
|
|
405
|
-
# difference, RMS difference relative to A.
|
|
406
|
-
"X-ArrayView-Diff-Rmse": str(stats.get("rmse", "nan")),
|
|
407
|
-
"X-ArrayView-Diff-Max": str(stats.get("max_abs", "nan")),
|
|
408
|
-
"X-ArrayView-Diff-Rel": str(stats.get("rel", "nan")),
|
|
409
402
|
},
|
|
410
403
|
)
|
|
411
404
|
|
arrayview/_viewer.html
CHANGED
|
@@ -304,11 +304,11 @@
|
|
|
304
304
|
body.rounded-panes #canvas-viewport,
|
|
305
305
|
body.rounded-panes .mv-pane,
|
|
306
306
|
body.rounded-panes .qv-canvas-clip {
|
|
307
|
-
border-radius: 10px;
|
|
307
|
+
border-radius: calc(10px / var(--qz-s)); /* = 10px unless quick-zoomed */
|
|
308
308
|
overflow: hidden;
|
|
309
309
|
}
|
|
310
310
|
body.rounded-panes .compare-canvas-clip {
|
|
311
|
-
border-radius: 10px;
|
|
311
|
+
border-radius: calc(10px / var(--qz-s));
|
|
312
312
|
overflow: hidden;
|
|
313
313
|
}
|
|
314
314
|
/* Orientation cross — hovering the DimBar (or pressing r / t) shows a
|
|
@@ -509,7 +509,7 @@
|
|
|
509
509
|
#slim-cb-labels { display: none; /* vmin/vmax now shown as inline spans in the island */ }
|
|
510
510
|
/* Same face and size as the tick row under the bar, so the ends and
|
|
511
511
|
the values between them read as one scale. */
|
|
512
|
-
.slim-cb-val { font-size: 10px; color: var(--text); opacity: 0.9; font-family: 'SF Mono', ui-monospace, 'Cascadia Code', 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; min-width:
|
|
512
|
+
.slim-cb-val { font-size: 10px; color: var(--text); opacity: 0.9; font-family: 'SF Mono', ui-monospace, 'Cascadia Code', 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; min-width: 5ch; text-align: center; line-height: 1; cursor: pointer; display: inline-block; transition: color 140ms ease, opacity 140ms ease; }
|
|
513
513
|
.slim-cb-val .exp { font-size: 0.7em; opacity: 0.5; vertical-align: baseline; letter-spacing: -0.3px; }
|
|
514
514
|
.cb-expanded .slim-cb-val.is-locked,
|
|
515
515
|
.cb-expanded .slim-cb-val.locked { color: var(--muted); opacity: 0.5; }
|
|
@@ -3931,6 +3931,20 @@
|
|
|
3931
3931
|
scale: calc(1 / var(--qz-s));
|
|
3932
3932
|
transform-origin: 0 0;
|
|
3933
3933
|
}
|
|
3934
|
+
/* Chrome inside the scaled image box keeps its screen size: frame,
|
|
3935
|
+
corner radius, hover readout, crosshair dot, source badge. The
|
|
3936
|
+
frame is a box-shadow ring because sub-pixel outlines snap to 1px
|
|
3937
|
+
before the scale and would still grow. */
|
|
3938
|
+
.av-qz-move.canvas-bordered {
|
|
3939
|
+
outline: none !important;
|
|
3940
|
+
box-shadow: 0 0 0 calc(1px / var(--qz-s)) var(--canvas-border) !important;
|
|
3941
|
+
}
|
|
3942
|
+
.av-qz-move :is(.cv-pixel-info, .cmp-xhair-dot, .compare-source-pane-badge) {
|
|
3943
|
+
scale: calc(1 / var(--qz-s));
|
|
3944
|
+
transform-origin: 0 0;
|
|
3945
|
+
}
|
|
3946
|
+
/* The pill hangs centred from its pane's bottom edge. */
|
|
3947
|
+
.av-qz-move .cv-pixel-info.pane-pixel-pill { transform-origin: 0 100%; }
|
|
3934
3948
|
/* Labels stay on top of the image they now sit on. */
|
|
3935
3949
|
.av-qz-move:is(.compare-title, .qv-label, .pane-name) { z-index: 32 !important; }
|
|
3936
3950
|
body:not(.fullscreen-mode) .av-qz-move:is(.pane-name, .compare-title) {
|
|
@@ -4045,8 +4059,6 @@
|
|
|
4045
4059
|
.av-name-br { display: none; }
|
|
4046
4060
|
/* Chrome breaks at <wbr> even under nowrap: names stay on one line */
|
|
4047
4061
|
.av-name wbr { display: none; }
|
|
4048
|
-
.compare-diff-stats { display: inline-flex; gap: 12px; font-variant-numeric: tabular-nums; cursor: default; }
|
|
4049
|
-
.compare-diff-stats b { font-weight: normal; color: color-mix(in srgb, var(--text) 75%, var(--muted)); text-transform: none; }
|
|
4050
4062
|
.detached-index-hint {
|
|
4051
4063
|
display: inline-flex;
|
|
4052
4064
|
align-items: baseline;
|
|
@@ -4072,8 +4084,16 @@
|
|
|
4072
4084
|
45% { color: var(--active-dim); }
|
|
4073
4085
|
100% { color: var(--muted); }
|
|
4074
4086
|
}
|
|
4075
|
-
/* Hidden
|
|
4087
|
+
/* Hidden; shown only while a [ ] press flashes. They sit just outside the
|
|
4088
|
+
label, taking no room, so the label starts at the pane's corner (where
|
|
4089
|
+
the logo sits in the single view) and a flash never reflows it. */
|
|
4090
|
+
.detached-index-hint { position: relative; }
|
|
4091
|
+
.detached-index-hint .hint-bracket { position: absolute; bottom: 0; }
|
|
4092
|
+
.detached-index-hint .hint-bracket[data-detached-key="["] { right: 100%; }
|
|
4093
|
+
.detached-index-hint .hint-bracket[data-detached-key="]"] { left: 100%; }
|
|
4076
4094
|
.detached-index-hint .hint-bracket:not(.index-hint-glow) { visibility: hidden; }
|
|
4095
|
+
/* "1 · name": monospace spaces are a full letter wide — tighten them. */
|
|
4096
|
+
.detached-index-hint .hint-sep { word-spacing: -0.55ch; }
|
|
4077
4097
|
/* Dims shown all at once by a mode ("s" side by side, "q" qMRI maps). */
|
|
4078
4098
|
#info .dim-spread-set, #info .dim-mode-letter { color: #a78bfa; -webkit-text-fill-color: #a78bfa; }
|
|
4079
4099
|
/* On the image: white like every corner name, brackets a step back. */
|
|
@@ -4919,13 +4939,13 @@
|
|
|
4919
4939
|
/* Touching panes read as one block: only its outer corners stay
|
|
4920
4940
|
rounded (corner classes set by _markBlockCorners). */
|
|
4921
4941
|
body.rounded-panes.qmri-gapless #qmri-view-wrap .qv-canvas-clip.block-tl,
|
|
4922
|
-
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-tl { border-top-left-radius: 10px !important; }
|
|
4942
|
+
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-tl { border-top-left-radius: calc(10px / var(--qz-s)) !important; }
|
|
4923
4943
|
body.rounded-panes.qmri-gapless #qmri-view-wrap .qv-canvas-clip.block-tr,
|
|
4924
|
-
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-tr { border-top-right-radius: 10px !important; }
|
|
4944
|
+
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-tr { border-top-right-radius: calc(10px / var(--qz-s)) !important; }
|
|
4925
4945
|
body.rounded-panes.qmri-gapless #qmri-view-wrap .qv-canvas-clip.block-bl,
|
|
4926
|
-
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-bl { border-bottom-left-radius: 10px !important; }
|
|
4946
|
+
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-bl { border-bottom-left-radius: calc(10px / var(--qz-s)) !important; }
|
|
4927
4947
|
body.rounded-panes.qmri-gapless #qmri-view-wrap .qv-canvas-clip.block-br,
|
|
4928
|
-
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-br { border-bottom-right-radius: 10px !important; }
|
|
4948
|
+
body.rounded-panes #compare-view-wrap.compare-touching .compare-canvas-clip.block-br { border-bottom-right-radius: calc(10px / var(--qz-s)) !important; }
|
|
4929
4949
|
/* Compare panes touching (Preferences): no gaps, rows packed together;
|
|
4930
4950
|
with more than one row the names sit inside the images like the
|
|
4931
4951
|
qMRI map labels, so the rows can touch too. A centre view (A−B,
|
|
@@ -4947,8 +4967,14 @@
|
|
|
4947
4967
|
}
|
|
4948
4968
|
#qmri-view-wrap .qv-cb-island.qv-cb-inset > * { pointer-events: auto; }
|
|
4949
4969
|
:root.light #qmri-view-wrap .qv-cb-island.qv-cb-inset .qv-cb-val { color: #fff; }
|
|
4950
|
-
/*
|
|
4951
|
-
bar's room with
|
|
4970
|
+
/* qMRI panes are narrow and their values short (ms, fractions): the
|
|
4971
|
+
value labels must not take the bar's room with the 10ch floor the
|
|
4972
|
+
single wide strip uses. Only a floor, so no !important: updateLabels
|
|
4973
|
+
sets one inline min-width on both labels (widest value seen), which
|
|
4974
|
+
keeps the bar centred. 7ch holds a sign and four digits, so the
|
|
4975
|
+
bars of all panes match and stay still for the usual ms values. */
|
|
4976
|
+
#qmri-view-wrap .qv-cb-island:not(.qmri-mv-vcb-island):not(.qv-cb-inset) .slim-cb-val { min-width: 7ch; }
|
|
4977
|
+
/* Floating islands are narrower still: each label hugs its own value. */
|
|
4952
4978
|
#qmri-view-wrap .qv-cb-island.qv-cb-inset .slim-cb-val { min-width: 5ch !important; }
|
|
4953
4979
|
/* Colorbars floating on the images have no box: the bar, its values and
|
|
4954
4980
|
ticks are as in the normal view, the text outlined in black. The bar sits low enough that its
|
|
@@ -7477,6 +7503,9 @@
|
|
|
7477
7503
|
let _pendingImmersiveTargetZoom = null; // one-shot override consumed by _buildImmersiveTl()
|
|
7478
7504
|
let _fitZoom = 1.0; // zoom level computed by auto-fit (may be > 1.0)
|
|
7479
7505
|
let _normalFitZoom = 1.0; // zoom floor: fit level in normal (non-immersive) layout
|
|
7506
|
+
// How far zooming out goes outside immersive. Side-by-side and 3-plane panes
|
|
7507
|
+
// fit at zoom 1; a larger fit left over from the single view stopped them short.
|
|
7508
|
+
const _normalZoomFloor = () => (compareActive || multiViewActive) ? Math.min(_normalFitZoom, 1.0) : _normalFitZoom;
|
|
7480
7509
|
let _zoomAdjustedByUser = false;
|
|
7481
7510
|
let _autoFitPending = true; // auto-fit to viewport on first render
|
|
7482
7511
|
let _lastZeroPress = 0; // timestamp of last '0' keypress for double-tap detection
|
|
@@ -7699,11 +7728,12 @@
|
|
|
7699
7728
|
let _diffAutoRangeKey = null;
|
|
7700
7729
|
let _diffCenterColormap = ''; // override colormap for diff/center pane; '' = server default
|
|
7701
7730
|
let _diffCenterColormapStops = null; // gradient stops for center pane colorbar
|
|
7702
|
-
const DIFF_COLORMAPS = ['
|
|
7703
|
-
// A−B default
|
|
7704
|
-
//
|
|
7731
|
+
const DIFF_COLORMAPS = ['RdBu_r', 'icefire', 'coolwarm', 'bwr', 'seismic', 'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdYlBu_r', 'RdYlGn', 'twilight_shifted'];
|
|
7732
|
+
// A−B default is RdBu_r on both themes. Background (zero in A and B)
|
|
7733
|
+
// is drawn black server-side, so the white centre no longer floods
|
|
7734
|
+
// the area outside the object on dark theme.
|
|
7705
7735
|
function _diffDefaultColormap() {
|
|
7706
|
-
return diffMode === 1 ?
|
|
7736
|
+
return diffMode === 1 ? 'RdBu_r' : 'afmhot';
|
|
7707
7737
|
}
|
|
7708
7738
|
const ABS_DIFF_COLORMAPS = ['afmhot', 'hot', 'inferno', 'magma', 'plasma', 'viridis', 'gray', 'cividis'];
|
|
7709
7739
|
let _mouseOverCenterPane = false; // true when mouse hovers diff or wipe pane
|
|
@@ -9234,6 +9264,22 @@
|
|
|
9234
9264
|
: { dims: [...new Set(planes.map(p => p.sliceDir))].sort((a, b) => a - b), sliceDim: plane.sliceDir });
|
|
9235
9265
|
}
|
|
9236
9266
|
|
|
9267
|
+
/** First view of a file with stored orientation: turn it head-up, as
|
|
9268
|
+
* Shift+P lays out that plane. `keepDims` keeps the x/y dims asked
|
|
9269
|
+
* for at launch and only flips them. */
|
|
9270
|
+
function _openPlaneUpright(keepDims) {
|
|
9271
|
+
if (!_hasStoredOrientation() || rgbMode || hasVectorfield) return;
|
|
9272
|
+
const planes = _cyclePlanes();
|
|
9273
|
+
if (!planes) return;
|
|
9274
|
+
const i = _currentPlaneIndex(planes);
|
|
9275
|
+
if (i < 0) return;
|
|
9276
|
+
const p = planes[i];
|
|
9277
|
+
if (!keepDims) { dim_x = p.dimX; dim_y = p.dimY; }
|
|
9278
|
+
const same = p.dimX === dim_x;
|
|
9279
|
+
flip_x = !!(same ? p.flipX : p.flipY);
|
|
9280
|
+
flip_y = !!(same ? p.flipY : p.flipX);
|
|
9281
|
+
}
|
|
9282
|
+
|
|
9237
9283
|
/** Crossfade the whole view across `change`: a still copy of the
|
|
9238
9284
|
* view covers it while `change` runs underneath, then fades away once
|
|
9239
9285
|
* the new frame has landed, so image, colorbar and dimbar settle
|
|
@@ -9283,14 +9329,18 @@
|
|
|
9283
9329
|
|
|
9284
9330
|
/** Quarter turn across `change` (r key). A still copy of each image box
|
|
9285
9331
|
* (fixed, on top, so no pane/wrap overflow clips it) starts turning at
|
|
9286
|
-
* once
|
|
9287
|
-
* turn
|
|
9288
|
-
*
|
|
9332
|
+
* once but barely moves until the new frame lands, then does the rest
|
|
9333
|
+
* of the turn while its size and centre go from the old box to the real
|
|
9334
|
+
* new one; the live box stays hidden until the turn ends, then
|
|
9335
|
+
* replaces the copy (same pixels, turned). Poses
|
|
9289
9336
|
* use the CSS `rotate`/`scale`/`translate` properties, leaving any
|
|
9290
9337
|
* zoom/pan `transform` alone. Mid-turn the box shrinks just enough that
|
|
9291
9338
|
* its corners stay inside a box sliding from the old outline to the new
|
|
9292
|
-
* one (so they never cross the dimbar/colorbar).
|
|
9293
|
-
*
|
|
9339
|
+
* one (so they never cross the dimbar/colorbar). That sliding box is
|
|
9340
|
+
* drawn behind the copy in the pane's vmin colour and clips it, so an
|
|
9341
|
+
* image on a vmin background turns inside a frame that just changes
|
|
9342
|
+
* shape. Pane names do not turn: a floating copy of each glides to
|
|
9343
|
+
* where the name sits afterwards, as the dimbar/colorbars do; chrome that
|
|
9294
9344
|
* only appears in the new layout fades in. A press during a turn
|
|
9295
9345
|
* queues: the running turn hurries to its end, then the queued ones
|
|
9296
9346
|
* play back to back, faster than a lone turn — never a jump to the
|
|
@@ -9307,10 +9357,50 @@
|
|
|
9307
9357
|
if (next) _quarterTurnAround(next[0], next[1], next[2], next[3],
|
|
9308
9358
|
_quarterTurnQueue.length ? _TURN_HURRY : _TURN_CHAIN_SPEED);
|
|
9309
9359
|
}
|
|
9310
|
-
// Pane/map names: never turned
|
|
9311
|
-
|
|
9360
|
+
// Pane/map names: never turned with the image — a floating copy of each
|
|
9361
|
+
// glides from where the name was to where it sits after the turn.
|
|
9362
|
+
const _TURN_LABELS = '.pane-name, .mv-pane-name, .qv-label, .compare-title';
|
|
9363
|
+
// What a name's copy takes from the name itself: part of its look hangs on the pane it sits in.
|
|
9364
|
+
const _TURN_LABEL_LOOK = ['font-size', 'font-weight', 'line-height', 'letter-spacing', 'text-transform', 'color',
|
|
9365
|
+
'-webkit-text-stroke-width', '-webkit-text-stroke-color', 'paint-order', 'text-shadow', 'opacity',
|
|
9366
|
+
'padding', 'background-color', 'border-radius', 'display', 'align-items', 'gap'];
|
|
9367
|
+
function _turnLabelGhost(el) {
|
|
9368
|
+
const cs = getComputedStyle(el);
|
|
9369
|
+
if (cs.visibility === 'hidden' || +cs.opacity < 0.02) return null;
|
|
9370
|
+
// The parts inside a name (index, dot, name) take their colour from the
|
|
9371
|
+
// pane too: copy their look as well, or the copy shows them dimmed.
|
|
9372
|
+
const looks = [el, ...el.querySelectorAll('*')].map((n, i) => { const c = i ? getComputedStyle(n) : cs;
|
|
9373
|
+
return [..._TURN_LABEL_LOOK, 'visibility'].map(k => [k, c.getPropertyValue(k)]); });
|
|
9374
|
+
const g = _orthoLabelGhost(el, true);
|
|
9375
|
+
if (!g) return null;
|
|
9376
|
+
[g, ...g.querySelectorAll('*')].forEach((n, i) =>
|
|
9377
|
+
(looks[i] || []).forEach(([k, v]) => { if (v) n.style.setProperty(k, v); }));
|
|
9378
|
+
g._turnGhost = true;
|
|
9379
|
+
return g;
|
|
9380
|
+
}
|
|
9381
|
+
// Longest a turn waits for a pane's new picture before it goes on without it.
|
|
9382
|
+
const _TURN_WAIT_MS = 5000;
|
|
9383
|
+
// Call before the change; the result tells whether one of the turning `panes`
|
|
9384
|
+
// still waits for the picture the change asked for. The panes of a multi-pane
|
|
9385
|
+
// view each get their own, one after the other, and on a slow link seconds
|
|
9386
|
+
// apart: a pane shown before its own holds the old picture squeezed into the
|
|
9387
|
+
// new box. "Still the picture from before" rather than just "busy", so
|
|
9388
|
+
// playback (always busy) does not keep a turn waiting.
|
|
9389
|
+
function _turnPaneWatch(panes) {
|
|
9390
|
+
const under = c => !!c && panes.some(b => b === c || b.contains(c));
|
|
9391
|
+
const views = [mvViews, qmriViews, compareQmriViews, compareMvViews, qmriMvViews].flat()
|
|
9392
|
+
.filter(v => v && under(v.canvas));
|
|
9393
|
+
const pic0 = new Map(views.map(v => [v, v.lastImageData]));
|
|
9394
|
+
const main = under(canvas), main0 = lastImageData;
|
|
9395
|
+
return () => (compareActive && compareRendering)
|
|
9396
|
+
|| (main && (isRendering || pendingRequest) && lastImageData === main0)
|
|
9397
|
+
|| views.some(v => (v.rendering || v.pending) && v.lastImageData === pic0.get(v));
|
|
9398
|
+
}
|
|
9399
|
+
// The names on screen, without a turn's own copies of them.
|
|
9400
|
+
const _turnLiveNames = () => [...document.querySelectorAll(_TURN_LABELS)]
|
|
9401
|
+
.filter(n => !n._turnGhost && n.getClientRects().length && !n.closest('[data-turn-frame]'));
|
|
9312
9402
|
// Chrome around the image that glides to its new place during a turn.
|
|
9313
|
-
const _TURN_GLIDE_SEL = '#info, #slim-cb-wrap, #dim-active-underline, #case-name-out, .cb-wrap';
|
|
9403
|
+
const _TURN_GLIDE_SEL = '#info, #slim-cb-wrap, #dim-active-underline, #case-name-out, .cb-wrap, #mode-eggs';
|
|
9314
9404
|
const _TURN_MS = 380;
|
|
9315
9405
|
// cubic-bezier(0.4, 0, 0.2, 1), solved for y at x = t.
|
|
9316
9406
|
function _turnEase(t) {
|
|
@@ -9349,6 +9439,18 @@
|
|
|
9349
9439
|
const ax = [c1[2] - c2[1], c2[0] - c0[2], c0[1] - c1[0]], n = Math.hypot(...ax) || 1;
|
|
9350
9440
|
return { axis: ax.map(v => v / n), deg: ang * 180 / Math.PI };
|
|
9351
9441
|
}
|
|
9442
|
+
/** Colour the colormap of pane box `b` gives vmin (the backdrop of a
|
|
9443
|
+
* turn), or null where that is not the image background (diff pane). */
|
|
9444
|
+
function _paneVminColor(b) {
|
|
9445
|
+
if (b.closest('#compare-diff-pane')) return null;
|
|
9446
|
+
if (rgbMode) return '#000';
|
|
9447
|
+
const own = [...qmriViews, ...compareQmriViews, ...qmriMvViews]
|
|
9448
|
+
.find(v => v && v.colormap && v.canvas && (v.canvas === b || b.contains(v.canvas)));
|
|
9449
|
+
const stops = (own && COLORMAP_GRADIENT_STOPS[own.colormap])
|
|
9450
|
+
|| (colormap_idx === -1 ? customGradientStops : COLORMAP_GRADIENT_STOPS[COLORMAPS[colormap_idx]]);
|
|
9451
|
+
const c = stops && stops[0];
|
|
9452
|
+
return c ? `rgb(${c[0]},${c[1]},${c[2]})` : null;
|
|
9453
|
+
}
|
|
9352
9454
|
/* `mode` 'flip' (t, transpose): the copy instead flips like a card
|
|
9353
9455
|
* 180deg about its top-left→bottom-right diagonal (slight perspective);
|
|
9354
9456
|
* its back face lands showing the transposed picture. Same path,
|
|
@@ -9375,6 +9477,8 @@
|
|
|
9375
9477
|
}
|
|
9376
9478
|
const rectOf = r => ({ w: r.width, h: r.height, cx: r.left + r.width / 2, cy: r.top + r.height / 2 });
|
|
9377
9479
|
const old = panes.map(b => rectOf(b.getBoundingClientRect()));
|
|
9480
|
+
// Backdrop colour per pane (null: use the pane's own background).
|
|
9481
|
+
const vminCols = panes.map(b => _paneVminColor(b));
|
|
9378
9482
|
const snap = b => {
|
|
9379
9483
|
const copy = b.cloneNode(true);
|
|
9380
9484
|
copy.removeAttribute('id');
|
|
@@ -9387,10 +9491,28 @@
|
|
|
9387
9491
|
if (!c.width || !c.height || !c.getClientRects().length) return;
|
|
9388
9492
|
try { dst[k].getContext('2d').drawImage(c, 0, 0); } catch (e) { /* WebGL: leave blank */ }
|
|
9389
9493
|
});
|
|
9494
|
+
// The image border stays on the backdrop's box (`edge`), not on the turning copy.
|
|
9495
|
+
copy.style.outline = 'none';
|
|
9496
|
+
dst.forEach(c => { c.style.outline = 'none'; });
|
|
9497
|
+
// Names travel as floating copies of their own (nameGhosts).
|
|
9498
|
+
copy.querySelectorAll(_TURN_LABELS).forEach(n => { n.style.visibility = 'hidden'; });
|
|
9390
9499
|
return copy;
|
|
9391
9500
|
};
|
|
9392
9501
|
// cube: per pane { box, fa, fb, sa, sb } — g is the 3-D stage, box turns, fa/fb are its faces.
|
|
9393
9502
|
const cubes = [];
|
|
9503
|
+
// Backdrop per pane: a viewport-sized layer in the vmin colour, clipped
|
|
9504
|
+
// to the sliding box (setFrame); the copy lives inside it. The pane's
|
|
9505
|
+
// border and shadow ride on that box (`edge`) instead of on the turning
|
|
9506
|
+
// copy, so they neither turn nor blink off for the turn.
|
|
9507
|
+
const frames = [];
|
|
9508
|
+
const vw = document.documentElement.clientWidth, vh = document.documentElement.clientHeight;
|
|
9509
|
+
// Whole pixels: a 1px border between two pixels dims, so it would shimmer as it moves.
|
|
9510
|
+
const setFrame = (i, cx, cy, w, h) => {
|
|
9511
|
+
const l = Math.round(cx - w / 2), t = Math.round(cy - h / 2), e = frames[i].edge;
|
|
9512
|
+
const x1 = Math.round(cx + w / 2), y1 = Math.round(cy + h / 2);
|
|
9513
|
+
frames[i].el.style.clipPath = `inset(${t}px ${vw - x1}px ${vh - y1}px ${l}px${frames[i].round})`;
|
|
9514
|
+
if (e) Object.assign(e.style, { left: l + 'px', top: t + 'px', width: (x1 - l) + 'px', height: (y1 - t) + 'px' });
|
|
9515
|
+
};
|
|
9394
9516
|
const ghosts = panes.map((b, i) => {
|
|
9395
9517
|
const r = b.getBoundingClientRect();
|
|
9396
9518
|
const rad = getComputedStyle(b).borderRadius;
|
|
@@ -9399,14 +9521,32 @@
|
|
|
9399
9521
|
g.inert = true;
|
|
9400
9522
|
g.style.cssText = `position:fixed;left:${r.left}px;top:${r.top}px;width:${r.width}px;height:${r.height}px;z-index:41;pointer-events:none;overflow:hidden;border-radius:${rad};`;
|
|
9401
9523
|
const copy = snap(b);
|
|
9524
|
+
let bg = getComputedStyle(b).backgroundColor;
|
|
9525
|
+
if (!bg || bg === 'transparent' || /rgba\(.*,\s*0\)$/.test(bg)) bg = getComputedStyle(document.body).backgroundColor;
|
|
9526
|
+
const f = document.createElement('div');
|
|
9527
|
+
f.setAttribute('aria-hidden', 'true');
|
|
9528
|
+
f.inert = true;
|
|
9529
|
+
f.dataset.turnFrame = '';
|
|
9530
|
+
f.style.cssText = `position:fixed;inset:0;z-index:41;pointer-events:none;background:${vminCols[i] || bg};`;
|
|
9531
|
+
const bs = getComputedStyle(b);
|
|
9532
|
+
let edge = null;
|
|
9533
|
+
if ((bs.outlineStyle !== 'none' && parseFloat(bs.outlineWidth) > 0) || bs.boxShadow !== 'none') {
|
|
9534
|
+
edge = document.createElement('div');
|
|
9535
|
+
edge.setAttribute('aria-hidden', 'true');
|
|
9536
|
+
edge.dataset.turnEdge = '';
|
|
9537
|
+
edge.style.cssText = `position:fixed;z-index:41;pointer-events:none;border-radius:${rad};`
|
|
9538
|
+
+ `outline:${bs.outlineWidth} ${bs.outlineStyle} ${bs.outlineColor};outline-offset:${bs.outlineOffset};box-shadow:${bs.boxShadow};`;
|
|
9539
|
+
}
|
|
9540
|
+
frames[i] = { el: f, edge, round: rad && !/^0px( 0px)*$/.test(rad) ? ' round ' + rad : '' };
|
|
9541
|
+
setFrame(i, r.left + r.width / 2, r.top + r.height / 2, r.width, r.height);
|
|
9402
9542
|
if (mode === 'cube') {
|
|
9403
|
-
let bg = getComputedStyle(b).backgroundColor;
|
|
9404
|
-
if (!bg || bg === 'transparent' || /rgba\(.*,\s*0\)$/.test(bg)) bg = getComputedStyle(document.body).backgroundColor;
|
|
9405
9543
|
const face = (w, h) => {
|
|
9406
9544
|
const f = document.createElement('div');
|
|
9407
9545
|
f.style.cssText = `position:absolute;left:50%;top:50%;width:${w}px;height:${h}px;margin:${-h / 2}px 0 0 ${-w / 2}px;overflow:hidden;backface-visibility:hidden;border-radius:${rad};background:${bg};`;
|
|
9408
9546
|
const s = document.createElement('div');
|
|
9409
|
-
s
|
|
9547
|
+
// A face turning away fades toward the backdrop's colour, not black: its
|
|
9548
|
+
// vmin background then never shows as a darker block on the backdrop.
|
|
9549
|
+
s.style.cssText = `position:absolute;inset:0;background:${vminCols[i] || '#000'};opacity:0;pointer-events:none;`;
|
|
9410
9550
|
f.appendChild(s);
|
|
9411
9551
|
return [f, s];
|
|
9412
9552
|
};
|
|
@@ -9421,17 +9561,20 @@
|
|
|
9421
9561
|
} else {
|
|
9422
9562
|
g.appendChild(copy);
|
|
9423
9563
|
}
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9564
|
+
f.appendChild(g);
|
|
9565
|
+
document.body.appendChild(f);
|
|
9566
|
+
if (edge) document.body.appendChild(edge);
|
|
9427
9567
|
return g;
|
|
9428
9568
|
});
|
|
9429
9569
|
const glideAll = [...document.querySelectorAll(_TURN_GLIDE_SEL)]
|
|
9430
|
-
.filter(el => el.getClientRects().length && !panes.some(b => b.contains(el)));
|
|
9570
|
+
.filter(el => el.getClientRects().length && el.getBoundingClientRect().width > 0 && !panes.some(b => b.contains(el)));
|
|
9431
9571
|
const glide = glideAll.filter(el => !glideAll.some(o => o !== el && o.contains(el)));
|
|
9432
9572
|
const glideOld = glide.map(el => el.getBoundingClientRect());
|
|
9573
|
+
// { n: name, g: its floating copy, to: the name it lands on (set at landing) }
|
|
9574
|
+
const nameGhosts = _turnLiveNames().map(n => ({ n, g: _turnLabelGhost(n), to: null })).filter(p => p.g);
|
|
9433
9575
|
document.body.classList.add('av-turning');
|
|
9434
9576
|
const seq0 = _frameDisplaySeq, t0 = performance.now();
|
|
9577
|
+
const waiting = _turnPaneWatch(panes);
|
|
9435
9578
|
try { change(); } catch (e) { console.error(e); }
|
|
9436
9579
|
// cube: incoming face's in-plane axes (bx, by) and normal (bn) in box space at the start.
|
|
9437
9580
|
let cube = null;
|
|
@@ -9455,20 +9598,18 @@
|
|
|
9455
9598
|
// Live boxes stay hidden until their frame lands (they may already
|
|
9456
9599
|
// be resized under the copies).
|
|
9457
9600
|
const holds = panes.map(b => b.animate([{ opacity: 0 }, { opacity: 0 }], { duration: 2000, fill: 'forwards' }));
|
|
9458
|
-
//
|
|
9459
|
-
// pane rebuild creates mid-turn are caught
|
|
9601
|
+
// The real names stay hidden until the turn ends (their copies stand
|
|
9602
|
+
// in); names a pane rebuild creates mid-turn are caught each frame.
|
|
9460
9603
|
const labelHolds = new Map();
|
|
9461
|
-
const holdLabels = (
|
|
9462
|
-
if (labelHolds.has(n)
|
|
9463
|
-
labelHolds.set(n, n.animate(fadeOut ? [{ opacity: 1 }, { opacity: 0 }] : [{ opacity: 0 }, { opacity: 0 }],
|
|
9464
|
-
{ duration: fadeOut ? 110 : 3000, easing: 'ease-out', fill: 'forwards' }));
|
|
9604
|
+
const holdLabels = () => _turnLiveNames().forEach(n => {
|
|
9605
|
+
if (!labelHolds.has(n)) labelHolds.set(n, n.animate([{ opacity: 0 }, { opacity: 0 }], { duration: 3000, fill: 'forwards' }));
|
|
9465
9606
|
});
|
|
9466
|
-
holdLabels(
|
|
9607
|
+
holdLabels();
|
|
9467
9608
|
let pins = [], glides = [], fades = [];
|
|
9468
9609
|
// Chrome that only shows up in the new layout: hidden, then faded in.
|
|
9469
9610
|
const newcomers = new Map();
|
|
9470
9611
|
const holdNewcomers = () => document.querySelectorAll(_TURN_GLIDE_SEL).forEach(el => {
|
|
9471
|
-
if (newcomers.has(el) || glideAll.includes(el) || !el.
|
|
9612
|
+
if (newcomers.has(el) || glideAll.includes(el) || !el.getBoundingClientRect().width
|
|
9472
9613
|
|| panes.some(b => b.contains(el))) return;
|
|
9473
9614
|
newcomers.set(el, el.animate([{ opacity: 0 }, { opacity: 0 }], { duration: 3000, fill: 'forwards' }));
|
|
9474
9615
|
});
|
|
@@ -9480,24 +9621,25 @@
|
|
|
9480
9621
|
holdNewcomers();
|
|
9481
9622
|
};
|
|
9482
9623
|
pin();
|
|
9483
|
-
//
|
|
9484
|
-
//
|
|
9485
|
-
//
|
|
9486
|
-
const
|
|
9624
|
+
// The page also resizes the panes in its own frame callbacks, after this
|
|
9625
|
+
// turn's frame has set the pins: re-pin on every resize, before the paint,
|
|
9626
|
+
// or the bars show one frame at the wrong spot.
|
|
9627
|
+
const pinRO = typeof ResizeObserver === 'function' ? new ResizeObserver(() => {
|
|
9628
|
+
if (_quarterTurn === q && !q.landed) pin();
|
|
9629
|
+
}) : null;
|
|
9630
|
+
if (pinRO) new Set([...panes, ...panes.map(b => b.parentElement), ...glide, ...glide.map(el => el.parentElement)]
|
|
9631
|
+
.filter(Boolean)).forEach(el => pinRO.observe(el));
|
|
9632
|
+
// Per-box path. Size, centre and fit box stay the old box's until the
|
|
9633
|
+
// new frame lands (the new box is not known before; a guess sent the
|
|
9634
|
+
// backdrop the wrong way first), then go to the real new box over the
|
|
9635
|
+
// rest of the turn (r), in step with the turn itself.
|
|
9636
|
+
const path = old.map(o => ({ o, n: null }));
|
|
9487
9637
|
const sigEnd = (o, w, h) => Math.sqrt((w * h) / (o.w * o.h));
|
|
9488
9638
|
const pose = (p, e, r) => {
|
|
9489
|
-
const o = p.o;
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
cx = o.cx + (p.tcx - o.cx) * e; cy = o.cy + (p.tcy - o.cy) * e;
|
|
9494
|
-
fw = o.w + (p.tw - o.w) * e; fh = o.h + (p.th - o.h) * e;
|
|
9495
|
-
} else {
|
|
9496
|
-
const f = p.from, n = p.n;
|
|
9497
|
-
sig = f.sig + (sigEnd(o, n.w, n.h) - f.sig) * r;
|
|
9498
|
-
cx = f.cx + (n.cx - f.cx) * r; cy = f.cy + (n.cy - f.cy) * r;
|
|
9499
|
-
fw = f.fw + (n.w - f.fw) * r; fh = f.fh + (n.h - f.fh) * r;
|
|
9500
|
-
}
|
|
9639
|
+
const o = p.o, n = p.n || o;
|
|
9640
|
+
const L = (a, b) => a + (b - a) * r;
|
|
9641
|
+
const sig = L(1, sigEnd(o, n.w, n.h)), cx = L(o.cx, n.cx), cy = L(o.cy, n.cy);
|
|
9642
|
+
const fw = L(o.w, n.w), fh = L(o.h, n.h);
|
|
9501
9643
|
const w = o.w * sig, h = o.h * sig;
|
|
9502
9644
|
let ang, bw, bh, slack = 1;
|
|
9503
9645
|
if (mode === 'flip') {
|
|
@@ -9529,13 +9671,14 @@
|
|
|
9529
9671
|
// cube: e = turn progress; r = blend of the guessed incoming face/box
|
|
9530
9672
|
// toward the real new box once its frame has landed. Size-to-fit
|
|
9531
9673
|
// uses the visible faces' projected corners, so the box shrinks
|
|
9532
|
-
// exactly as much as its pose needs; faces
|
|
9674
|
+
// exactly as much as its pose needs; faces fade toward the backdrop as they turn away.
|
|
9533
9675
|
const cubePose = (i, e, r) => {
|
|
9534
9676
|
const c = cubes[i], o = old[i], n = c.n, { k, th, bx, by, bn, rot } = cube;
|
|
9535
9677
|
const L = (a, b) => a + (b - a) * r;
|
|
9536
9678
|
const w2 = n ? L(c.gw, n.w) : c.gw, h2 = n ? L(c.gh, n.h) : c.gh;
|
|
9537
9679
|
const cx = n ? L(o.cx, n.cx) : o.cx, cy = n ? L(o.cy, n.cy) : o.cy;
|
|
9538
9680
|
const fw = n ? L(o.w, n.w) : o.w, fh = n ? L(o.h, n.h) : o.h;
|
|
9681
|
+
setFrame(i, cx, cy, fw, fh);
|
|
9539
9682
|
const Z = Math.abs(bx[2]) * w2 + Math.abs(by[2]) * h2;
|
|
9540
9683
|
const dB = Math.abs(bn[0]) * o.w / 2 + Math.abs(bn[1]) * o.h / 2;
|
|
9541
9684
|
const zc = Z / 2 + (dB - Z / 2) * e, ang = th * e, P = 1800;
|
|
@@ -9564,6 +9707,7 @@
|
|
|
9564
9707
|
c.sa.style.opacity = shade(nzA); c.sb.style.opacity = shade(nzB);
|
|
9565
9708
|
};
|
|
9566
9709
|
let prog = 0, lastNow = t0;
|
|
9710
|
+
const turnMs = cube ? cube.ms : _TURN_MS;
|
|
9567
9711
|
let raf = 0, lastSeq = seq0, quiet = 0, t1 = 0, tEnd = 0;
|
|
9568
9712
|
// Turn clock: runs `speed` times real time, so a turn can hurry
|
|
9569
9713
|
// without jumping (WAAPI glides follow via playbackRate).
|
|
@@ -9576,8 +9720,10 @@
|
|
|
9576
9720
|
};
|
|
9577
9721
|
const finishAll = () => {
|
|
9578
9722
|
if (raf) cancelAnimationFrame(raf); raf = 0;
|
|
9723
|
+
pinRO?.disconnect();
|
|
9579
9724
|
document.body.classList.remove('av-turning');
|
|
9580
|
-
|
|
9725
|
+
frames.forEach(f => { f.el.remove(); f.edge?.remove(); });
|
|
9726
|
+
nameGhosts.forEach(p => p.g.remove());
|
|
9581
9727
|
holds.forEach(a => a.cancel()); pins.forEach(a => a.cancel());
|
|
9582
9728
|
newcomers.forEach(a => a.cancel());
|
|
9583
9729
|
glides.forEach(a => a.cancel());
|
|
@@ -9588,18 +9734,12 @@
|
|
|
9588
9734
|
_quarterTurn = q;
|
|
9589
9735
|
const land = now => {
|
|
9590
9736
|
q.landed = true; t1 = now;
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
path.forEach((p, i) => {
|
|
9594
|
-
const cur = pose(p, e, 0);
|
|
9595
|
-
p.from = cur;
|
|
9596
|
-
p.n = rectOf(panes[i].getBoundingClientRect());
|
|
9597
|
-
});
|
|
9737
|
+
tEnd = now + Math.max(180, (1 - prog) * turnMs);
|
|
9738
|
+
path.forEach((p, i) => { p.n = rectOf(panes[i].getBoundingClientRect()); });
|
|
9598
9739
|
// cube: the incoming face gets the new frame, sized to the real new box.
|
|
9599
9740
|
if (cube) cubes.forEach((c, i) => {
|
|
9600
9741
|
const n = c.n = path[i].n;
|
|
9601
9742
|
const copy = snap(panes[i]);
|
|
9602
|
-
copy.querySelectorAll(_TURN_LABELS).forEach(el => { el.style.opacity = '0'; });
|
|
9603
9743
|
c.fb.insertBefore(copy, c.sb);
|
|
9604
9744
|
Object.assign(c.fb.style, { width: n.w + 'px', height: n.h + 'px', margin: `${-n.h / 2}px 0 0 ${-n.w / 2}px` });
|
|
9605
9745
|
c.bw = n.w; c.bh = n.h;
|
|
@@ -9612,6 +9752,22 @@
|
|
|
9612
9752
|
glides = glide.map((el, i) => el.animate(
|
|
9613
9753
|
[{ translate: glideDelta(el, i).map(v => v + 'px').join(' ') }, { translate: '0px 0px' }],
|
|
9614
9754
|
{ duration: tEnd - now, easing: 'cubic-bezier(0.4, 0, 0.2, 1)' }));
|
|
9755
|
+
// Each name copy glides onto its name (the same element, else a rebuilt
|
|
9756
|
+
// one with the same text); a name that is gone fades out.
|
|
9757
|
+
const shown = _turnLiveNames();
|
|
9758
|
+
const taken = new Set();
|
|
9759
|
+
nameGhosts.forEach(p => { if (shown.includes(p.n)) { p.to = p.n; taken.add(p.n); } });
|
|
9760
|
+
nameGhosts.forEach(p => {
|
|
9761
|
+
if (!p.to) {
|
|
9762
|
+
p.to = shown.find(m => !taken.has(m) && m.textContent === p.g.textContent) || null;
|
|
9763
|
+
if (p.to) taken.add(p.to);
|
|
9764
|
+
}
|
|
9765
|
+
const to = p.to && p.to.getBoundingClientRect();
|
|
9766
|
+
glides.push(p.g.animate(to
|
|
9767
|
+
? [{ transform: 'none' }, { transform: `translate(${to.left - p.g._from.left}px, ${to.top - p.g._from.top}px)` }]
|
|
9768
|
+
: [{ opacity: p.g.style.opacity || 1 }, { opacity: 0 }],
|
|
9769
|
+
{ duration: tEnd - now, easing: 'cubic-bezier(0.4, 0, 0.2, 1)', fill: 'forwards' }));
|
|
9770
|
+
});
|
|
9615
9771
|
[...glides, ...fades].forEach(a => { a.playbackRate = speed; });
|
|
9616
9772
|
};
|
|
9617
9773
|
const tick = () => {
|
|
@@ -9625,27 +9781,31 @@
|
|
|
9625
9781
|
const seq = _frameDisplaySeq;
|
|
9626
9782
|
quiet = (seq !== seq0 && seq === lastSeq) ? quiet + 1 : 0;
|
|
9627
9783
|
lastSeq = seq;
|
|
9628
|
-
|
|
9784
|
+
const wait = waiting();
|
|
9785
|
+
if ((quiet >= 1 && !wait) || real - t0 > (wait ? _TURN_WAIT_MS : 1200)) land(now);
|
|
9629
9786
|
else pin();
|
|
9630
9787
|
}
|
|
9631
9788
|
holdLabels();
|
|
9632
9789
|
const r = q.landed ? _turnEase(Math.min(1, (now - t1) / Math.max(1, tEnd - t1))) : 0;
|
|
9790
|
+
// Barely moves until the new frame is there: the cube's incoming face is
|
|
9791
|
+
// never empty, and every turn sets off for a box it knows.
|
|
9792
|
+
prog = Math.min(q.landed ? 1 : 0.15, prog + (now - lastNow) / turnMs);
|
|
9793
|
+
lastNow = now;
|
|
9633
9794
|
if (cube) {
|
|
9634
|
-
// Barely moves until the new frame is there, so the face rolling in is never empty.
|
|
9635
|
-
prog = Math.min(q.landed ? 1 : 0.15, prog + (now - lastNow) / cube.ms);
|
|
9636
|
-
lastNow = now;
|
|
9637
9795
|
const e = _cubeEase(prog);
|
|
9638
9796
|
cubes.forEach((c, i) => cubePose(i, e, r));
|
|
9639
9797
|
} else {
|
|
9640
|
-
const
|
|
9798
|
+
const e = _turnEase(prog);
|
|
9641
9799
|
path.forEach((p, i) => {
|
|
9642
9800
|
const ps = pose(p, e, r);
|
|
9643
9801
|
setPose(ghosts[i], ps.ang, ps.k, ps.cx - p.o.cx, ps.cy - p.o.cy);
|
|
9802
|
+
setFrame(i, ps.cx, ps.cy, ps.fw, ps.fh);
|
|
9644
9803
|
});
|
|
9645
9804
|
}
|
|
9646
|
-
if (q.landed && now >= tEnd &&
|
|
9805
|
+
if (q.landed && now >= tEnd && prog >= 1) {
|
|
9647
9806
|
holdLabels();
|
|
9648
|
-
|
|
9807
|
+
// A name its copy landed on just takes over; any other fades in.
|
|
9808
|
+
const names = [...labelHolds.keys()].filter(n => n.isConnected && !nameGhosts.some(p => p.to === n));
|
|
9649
9809
|
finishAll();
|
|
9650
9810
|
fades = names.map(n => n.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 180, easing: 'ease-out' }));
|
|
9651
9811
|
if (_quarterTurn === q) _quarterTurn = null;
|
|
@@ -10474,6 +10634,10 @@
|
|
|
10474
10634
|
const cv = compareCanvases[i];
|
|
10475
10635
|
if (!frame || !cv) continue;
|
|
10476
10636
|
const base = Math.min(availW / frame.width, availH / frame.height) * fitSlack;
|
|
10637
|
+
// Each pane holds the box it has at userZoom = 1 and lets the
|
|
10638
|
+
// zoom overflow inside it (as big-left does). Growing the clip
|
|
10639
|
+
// to the cap on the first zoom step re-centred the row and
|
|
10640
|
+
// moved the colorbar under it on every step.
|
|
10477
10641
|
const r = _scalePane(
|
|
10478
10642
|
{ canvas: cv, w: frame.width, h: frame.height, pan: comparePan },
|
|
10479
10643
|
null,
|
|
@@ -10484,6 +10648,9 @@
|
|
|
10484
10648
|
squareStretch: squareStretch,
|
|
10485
10649
|
updateAutoFit: false,
|
|
10486
10650
|
allowOverflowRecalc: false,
|
|
10651
|
+
forceViewport: _paneViewportAtBaseZoom(
|
|
10652
|
+
frame.width, frame.height, Math.max(0.0001, base), capPaneW, capPaneH, squareStretch,
|
|
10653
|
+
),
|
|
10487
10654
|
}
|
|
10488
10655
|
);
|
|
10489
10656
|
const inner = cv.closest('.compare-canvas-inner');
|
|
@@ -10920,7 +11087,8 @@
|
|
|
10920
11087
|
function _detachedDimPaneTitleHTML(idx, label) {
|
|
10921
11088
|
const escaped = String(label || '').replace(/</g, '<');
|
|
10922
11089
|
if (detachedDimIdx.length < 2) return escaped;
|
|
10923
|
-
|
|
11090
|
+
const body = escaped.replace(' · ', '<span class="hint-sep"> · </span>');
|
|
11091
|
+
return `<span class="detached-index-hint" data-detached-pane="${idx}"><span class="hint-bracket" data-detached-key="[">[</span><span>${body}</span><span class="hint-bracket" data-detached-key="]">]</span></span>`;
|
|
10924
11092
|
}
|
|
10925
11093
|
|
|
10926
11094
|
// The key just pressed. Titles are rebuilt on redraws, so the flash is
|
|
@@ -11171,36 +11339,6 @@
|
|
|
11171
11339
|
}).join('') + `</div>`;
|
|
11172
11340
|
}
|
|
11173
11341
|
|
|
11174
|
-
// Summary of the A−B pair on screen, from the last diff image's headers.
|
|
11175
|
-
let _diffStats = null;
|
|
11176
|
-
function _fmtDiffStat(v) {
|
|
11177
|
-
if (!Number.isFinite(v)) return '—';
|
|
11178
|
-
if (v === 0) return '0';
|
|
11179
|
-
const m = Math.abs(v);
|
|
11180
|
-
if (m >= 1e4 || m < 1e-3) return v.toExponential(1);
|
|
11181
|
-
return parseFloat(v.toPrecision(3)).toString();
|
|
11182
|
-
}
|
|
11183
|
-
/** The A−B title row carries the numbers for the view it shows; the
|
|
11184
|
-
* source panes' titles carry their file names in the same style. */
|
|
11185
|
-
function _reconcileDiffStats() {
|
|
11186
|
-
const diffTitle = document.getElementById('compare-diff-title');
|
|
11187
|
-
if (!diffTitle) return;
|
|
11188
|
-
const show = _compareCenterSupported() && compareCenterMode > 0
|
|
11189
|
-
&& diffMode >= 1 && diffMode <= 3 && !!_diffStats;
|
|
11190
|
-
let el = diffTitle.querySelector('.compare-diff-stats');
|
|
11191
|
-
if (!show) { if (el) el.remove(); return; }
|
|
11192
|
-
if (!el) {
|
|
11193
|
-
el = document.createElement('span');
|
|
11194
|
-
el.className = 'compare-diff-stats';
|
|
11195
|
-
el.title = 'For the view shown: root-mean-square of A−B · largest |A−B| · RMS of A−B relative to the RMS of A';
|
|
11196
|
-
diffTitle.appendChild(el);
|
|
11197
|
-
}
|
|
11198
|
-
const st = _diffStats;
|
|
11199
|
-
const rel = Number.isFinite(st.rel) ? `${parseFloat((st.rel * 100).toPrecision(2))}%` : '—';
|
|
11200
|
-
const html = `<span>rmse <b>${_fmtDiffStat(st.rmse)}</b></span><span>max <b>${_fmtDiffStat(st.max)}</b></span><span>rel <b>${rel}</b></span>`;
|
|
11201
|
-
if (el.innerHTML !== html) el.innerHTML = html;
|
|
11202
|
-
}
|
|
11203
|
-
|
|
11204
11342
|
function _renderCompareCenterTitleControls() {
|
|
11205
11343
|
const supported = _compareCenterSupported();
|
|
11206
11344
|
const diffTitle = document.getElementById('compare-diff-title');
|
|
@@ -11215,7 +11353,6 @@
|
|
|
11215
11353
|
diffTitle.innerHTML = 'A − B';
|
|
11216
11354
|
}
|
|
11217
11355
|
}
|
|
11218
|
-
_reconcileDiffStats();
|
|
11219
11356
|
if (wipeTitle) {
|
|
11220
11357
|
wipeTitle.classList.toggle('compare-center-title', supported);
|
|
11221
11358
|
if (isCenter) {
|
|
@@ -13749,6 +13886,18 @@
|
|
|
13749
13886
|
// the canvas by half the difference the instant a drag
|
|
13750
13887
|
// begins (the wrap re-centers); agreeing on width
|
|
13751
13888
|
// removes that one-time jump.
|
|
13889
|
+
// The high-water mark (and the cached reserve format)
|
|
13890
|
+
// keep the width from shrinking while the window moves,
|
|
13891
|
+
// but they belong to one data range: a new array starts
|
|
13892
|
+
// over, otherwise one wide array left every later one
|
|
13893
|
+
// padded.
|
|
13894
|
+
const hd = this._histData;
|
|
13895
|
+
const hwmKey = hd ? `${hd.vmin}|${hd.vmax}` : null;
|
|
13896
|
+
if (hwmKey !== this._labelWidthHwmKey) {
|
|
13897
|
+
this._labelWidthHwmKey = hwmKey;
|
|
13898
|
+
this._labelWidthHwmPx = 0;
|
|
13899
|
+
this._reserveFormatter = null;
|
|
13900
|
+
}
|
|
13752
13901
|
const reserveWm = this._reserveWidestLabelPx();
|
|
13753
13902
|
const restFloor = Math.max(natMw, reserveWm);
|
|
13754
13903
|
if (restFloor > this._labelWidthHwmPx) this._labelWidthHwmPx = restFloor;
|
|
@@ -14129,11 +14278,16 @@
|
|
|
14129
14278
|
// so its own font, padding, and box-sizing all apply (a detached
|
|
14130
14279
|
// probe inherits none of those and undershoots).
|
|
14131
14280
|
_reserveWidestLabelPx() {
|
|
14132
|
-
if (!this.vminLabel || !this.vmaxLabel
|
|
14281
|
+
if (!this.vminLabel || !this.vmaxLabel) return 0;
|
|
14282
|
+
const hd = this._histData;
|
|
14283
|
+
const win = this.opts.getWindow ? this.opts.getWindow() : null;
|
|
14284
|
+
if (!hd && !win) return 0;
|
|
14285
|
+
const dMin = hd ? hd.vmin : NaN, dMax = hd ? hd.vmax : NaN;
|
|
14286
|
+
const wMin = win ? win.vmin : NaN, wMax = win ? win.vmax : NaN;
|
|
14133
14287
|
const fmt = this._dragLabelFormatter || this._reserveFormatter
|
|
14134
|
-
|| _cbLabelFormatter(
|
|
14135
|
-
this._reserveFormatter = fmt;
|
|
14136
|
-
const candidates = [
|
|
14288
|
+
|| _cbLabelFormatter(dMin, dMax, wMin, wMax);
|
|
14289
|
+
if (hd) this._reserveFormatter = fmt;
|
|
14290
|
+
const candidates = [dMin, dMax, wMin, wMax];
|
|
14137
14291
|
let widest = '';
|
|
14138
14292
|
for (const v of candidates) {
|
|
14139
14293
|
if (!Number.isFinite(v)) continue;
|
|
@@ -18625,11 +18779,6 @@
|
|
|
18625
18779
|
const hdrVmin = parseFloat(resp.headers.get('X-ArrayView-Vmin'));
|
|
18626
18780
|
const hdrVmax = parseFloat(resp.headers.get('X-ArrayView-Vmax'));
|
|
18627
18781
|
const usedCmap = resp.headers.get('X-ArrayView-Colormap') || '';
|
|
18628
|
-
const diffStats = {
|
|
18629
|
-
rmse: parseFloat(resp.headers.get('X-ArrayView-Diff-Rmse')),
|
|
18630
|
-
max: parseFloat(resp.headers.get('X-ArrayView-Diff-Max')),
|
|
18631
|
-
rel: parseFloat(resp.headers.get('X-ArrayView-Diff-Rel')),
|
|
18632
|
-
};
|
|
18633
18782
|
const blob = await resp.blob();
|
|
18634
18783
|
const bmp = await createImageBitmap(blob);
|
|
18635
18784
|
// Cache gradient stops for the colormap used by the server
|
|
@@ -18661,8 +18810,6 @@
|
|
|
18661
18810
|
_diffAutoVmax = hdrVmax;
|
|
18662
18811
|
}
|
|
18663
18812
|
}
|
|
18664
|
-
_diffStats = diffStats;
|
|
18665
|
-
_reconcileDiffStats();
|
|
18666
18813
|
const diffCanvas = document.getElementById('compare-diff-canvas');
|
|
18667
18814
|
diffCanvas.width = bmp.width;
|
|
18668
18815
|
diffCanvas.height = bmp.height;
|
|
@@ -19054,7 +19201,10 @@
|
|
|
19054
19201
|
const _askedForView = (data.initial_view && Object.keys(data.initial_view).length)
|
|
19055
19202
|
|| urlParams.has('dim_x');
|
|
19056
19203
|
if (data.remembered_view && !_askedForView) applyStateSnapshot(data.remembered_view);
|
|
19057
|
-
else
|
|
19204
|
+
else {
|
|
19205
|
+
_applyInitialView(data.initial_view);
|
|
19206
|
+
_openPlaneUpright(urlParams.has('dim_x') || Array.isArray(data.initial_view?.dims));
|
|
19207
|
+
}
|
|
19058
19208
|
}
|
|
19059
19209
|
_syncRaggedShapeForCollection();
|
|
19060
19210
|
_ensureViewingDimsAreSpatial();
|
|
@@ -26554,7 +26704,7 @@
|
|
|
26554
26704
|
'viewer.theme': ['Theme', 'The colours of the viewer. Press T to switch while you work.'],
|
|
26555
26705
|
'viewer.rounded_panes': ['Rounded panes', 'Rounds the corners of images. Rounding hides a few pixels in each corner, so turn it off to see them. Press Shift+B to switch while you work.'],
|
|
26556
26706
|
'viewer.qmri_gapless': ['qMRI maps touching', 'qMRI mode (q) shows T₁, T₂, PD and other maps next to each other. This removes the space between them so they can be larger. With two rows of maps, the colour bars move inside the maps.'],
|
|
26557
|
-
'viewer.compare_gapless': ['Compare panes touching', 'Removes the space between arrays shown side by side, so they can be larger. Immersive view always joins them. With two rows of arrays, their names move inside the images.'],
|
|
26707
|
+
'viewer.compare_gapless': ['Compare panes touching', 'Removes the space between arrays shown side by side, so they can be larger. Arrays of different sizes keep their space. Immersive view always joins them. With two rows of arrays, their names move inside the images.'],
|
|
26558
26708
|
'viewer.remember_view': ['Reopen where you left off', 'Opening the same file again brings back its slice, view, colormap and rotation. Its display range comes back too, unless the file has changed. Kept in ~/.arrayview/view_memory.json.'],
|
|
26559
26709
|
'viewer.colormaps': ['Colormap cycle', 'The colormaps offered when you press c, in this order. Type names separated by commas. Unknown names are skipped. Leave empty for the full built-in list. Applies the next time you open a viewer.'],
|
|
26560
26710
|
'viewer.ortho_layout': ['Ortho-view layout', 'Ortho view (v) shows three planes of a volume at once. This sets how they are arranged when it opens. Responsive picks what fits your window best.'],
|
|
@@ -27023,7 +27173,8 @@
|
|
|
27023
27173
|
async function _bcEnsureCmapLut(name) {
|
|
27024
27174
|
if (_cmapLutCache[name]) return _cmapLutCache[name];
|
|
27025
27175
|
try {
|
|
27026
|
-
|
|
27176
|
+
// ?v=: the table is browser-cached for a day — bump when a table changes.
|
|
27177
|
+
const resp = await proxyFetch(`/colormap_lut/${encodeURIComponent(name)}?v=2`);
|
|
27027
27178
|
if (!resp.ok) return null;
|
|
27028
27179
|
const buf = await resp.arrayBuffer();
|
|
27029
27180
|
if (buf.byteLength !== 1024) return null;
|
|
@@ -30231,7 +30382,7 @@
|
|
|
30231
30382
|
run: (ctx, e) => {
|
|
30232
30383
|
const floor = _fullscreenActive
|
|
30233
30384
|
? _calcAutoFitZoom(lastImgW || canvas.width, lastImgH || canvas.height, true) * 1.005
|
|
30234
|
-
:
|
|
30385
|
+
: _normalZoomFloor();
|
|
30235
30386
|
userZoom = Math.max(userZoom / 1.1, floor);
|
|
30236
30387
|
if (!_snapZoomToFit()) _zoomAdjustedByUser = true;
|
|
30237
30388
|
_scaleAllWithAnim();
|
|
@@ -44564,18 +44715,35 @@
|
|
|
44564
44715
|
const _hZ = lastImgH || canvas.height;
|
|
44565
44716
|
const floorZ = qmriPaneZoom ? 1.0 : (_fullscreenActive && _wZ && _hZ
|
|
44566
44717
|
? _calcAutoFitZoom(_wZ, _hZ, true) * 1.005
|
|
44567
|
-
:
|
|
44718
|
+
: _normalZoomFloor());
|
|
44568
44719
|
const desiredZoom = Math.max(floorZ, Math.min(10.0, zoomBase * factor));
|
|
44569
44720
|
_scrubRequestedZoom = null;
|
|
44570
44721
|
userZoom = desiredZoom;
|
|
44722
|
+
// Snap to fit only on the way out. Pinch steps are ~1–2 %, so
|
|
44723
|
+
// snapping both ways swallowed the start of every pinch-in.
|
|
44724
|
+
// Outside immersive, snap to the normal floor only: _fitZoom may
|
|
44725
|
+
// hold the immersive fit, and snapping there then re-fitting
|
|
44726
|
+
// made a visible jump just before the bottom.
|
|
44727
|
+
const zoomingOut = desiredZoom < zoomBase;
|
|
44571
44728
|
let snapped = false;
|
|
44572
|
-
if (
|
|
44573
|
-
|
|
44729
|
+
if (!zoomingOut) {
|
|
44730
|
+
// no snap
|
|
44731
|
+
} else if (qmriPaneZoom) {
|
|
44732
|
+
if (Math.abs(userZoom - 1.0) < 0.02) {
|
|
44733
|
+
userZoom = 1.0;
|
|
44734
|
+
_zoomAdjustedByUser = false;
|
|
44735
|
+
qvPan.reset();
|
|
44736
|
+
snapped = true;
|
|
44737
|
+
}
|
|
44738
|
+
} else if (_fullscreenActive) {
|
|
44739
|
+
snapped = _snapZoomToFit();
|
|
44740
|
+
} else if (Math.abs(userZoom - floorZ) < 0.02) {
|
|
44741
|
+
userZoom = floorZ;
|
|
44574
44742
|
_zoomAdjustedByUser = false;
|
|
44575
|
-
|
|
44743
|
+
mainPan.reset();
|
|
44744
|
+
comparePan.reset();
|
|
44745
|
+
_autoFitPending = true;
|
|
44576
44746
|
snapped = true;
|
|
44577
|
-
} else if (!qmriPaneZoom) {
|
|
44578
|
-
snapped = _snapZoomToFit();
|
|
44579
44747
|
}
|
|
44580
44748
|
if (!snapped) {
|
|
44581
44749
|
_zoomAdjustedByUser = true;
|
|
@@ -45297,8 +45465,8 @@
|
|
|
45297
45465
|
return true;
|
|
45298
45466
|
}
|
|
45299
45467
|
// Also snap to normal-fit floor when close (prevents fractional drift below floor)
|
|
45300
|
-
if (!_fullscreenActive && Math.abs(userZoom -
|
|
45301
|
-
userZoom =
|
|
45468
|
+
if (!_fullscreenActive && Math.abs(userZoom - _normalZoomFloor()) < 0.02) {
|
|
45469
|
+
userZoom = _normalZoomFloor();
|
|
45302
45470
|
_zoomAdjustedByUser = false;
|
|
45303
45471
|
mainPan.reset();
|
|
45304
45472
|
_autoFitPending = true;
|
|
@@ -47024,10 +47192,24 @@
|
|
|
47024
47192
|
// a centre view (A−B, overlay, wipe…) keeps the gaps around it.
|
|
47025
47193
|
function _compareTouching() {
|
|
47026
47194
|
// Immersive is there to fill the screen: its panes always join.
|
|
47027
|
-
|
|
47195
|
+
// The preference yields to panes of different sizes: joined, they
|
|
47196
|
+
// make a ragged block instead of a grid.
|
|
47197
|
+
return compareActive && ((compareGapless && !_comparePanesDifferInSize()) || _fullscreenActive)
|
|
47028
47198
|
&& !_compareGridShape(compareFrames.filter(Boolean).length).hasCenterPane;
|
|
47029
47199
|
}
|
|
47030
47200
|
|
|
47201
|
+
// True when the side-by-side images are not all the same size in the
|
|
47202
|
+
// displayed plane. A mixed-size stack answers from its known shapes, for
|
|
47203
|
+
// every case at once, so the layout does not hop while panes load or page.
|
|
47204
|
+
function _comparePanesDifferInSize() {
|
|
47205
|
+
if (detachedDimMode && Array.isArray(raggedSpatialShapes) && detachedDim >= collectionSpatialNdim) {
|
|
47206
|
+
const sizes = new Set(raggedSpatialShapes.flat().map(sh => `${(sh || [])[dim_x]}x${(sh || [])[dim_y]}`));
|
|
47207
|
+
if (sizes.size > 1) return true;
|
|
47208
|
+
}
|
|
47209
|
+
const frames = compareFrames.filter(Boolean);
|
|
47210
|
+
return frames.some(f => f.width !== frames[0].width || f.height !== frames[0].height);
|
|
47211
|
+
}
|
|
47212
|
+
|
|
47031
47213
|
// Array names sit in the images' top-left corners, as in the single
|
|
47032
47214
|
// view and ortho. A centre view (A−B, overlay, wipe…) keeps the title
|
|
47033
47215
|
// row above the panes for its own label and stats.
|
|
@@ -50216,7 +50398,11 @@
|
|
|
50216
50398
|
&& qmriViews.some(v => v.canvas === cvs);
|
|
50217
50399
|
}
|
|
50218
50400
|
function _zoomPanForCanvas(cvs) {
|
|
50219
|
-
|
|
50401
|
+
if (_usesQmriPaneZoom(cvs)) return qvPan;
|
|
50402
|
+
// Side-by-side panes share one pan; anchoring on mainPan left them
|
|
50403
|
+
// growing out of their top-left corner instead of under the cursor.
|
|
50404
|
+
if (compareActive && cvs && cvs.closest && cvs.closest('.compare-canvas-inner')) return comparePan;
|
|
50405
|
+
return mainPan;
|
|
50220
50406
|
}
|
|
50221
50407
|
function _captureZoomAnchor(clientX, clientY, targetCanvas = canvas) {
|
|
50222
50408
|
const r = targetCanvas.getBoundingClientRect();
|
|
@@ -50303,7 +50489,7 @@
|
|
|
50303
50489
|
function _onGestureChange(e) {
|
|
50304
50490
|
e.preventDefault();
|
|
50305
50491
|
// e.scale is cumulative from gesturestart — multiply against cached start
|
|
50306
|
-
const floorZoom = _usesQmriPaneZoom(e.currentTarget) ? 1.0 :
|
|
50492
|
+
const floorZoom = _usesQmriPaneZoom(e.currentTarget) ? 1.0 : _normalZoomFloor();
|
|
50307
50493
|
userZoom = Math.max(floorZoom, Math.min(10.0, _gestureStartZoom * e.scale));
|
|
50308
50494
|
_zoomAdjustedByUser = true;
|
|
50309
50495
|
ModeRegistry.scaleAll();
|
|
@@ -7,19 +7,19 @@ arrayview/_bootstrap_app.py,sha256=ljiZ0o5D3nkJqEGcyyVF06dFWxXujBufQjbcn50QzXM,4
|
|
|
7
7
|
arrayview/_config.py,sha256=wG7okKXojzxqz9AYs_WefZJEEFBC6YInPOYDmfPtqo0,15052
|
|
8
8
|
arrayview/_diagnostics.py,sha256=XB0rCoDn3cpfhz4H-ayLktOgCMIoVJ0wM9N0ep_kKkQ,11018
|
|
9
9
|
arrayview/_dicom.py,sha256=tNY353MNWTvcXavHeIkqj3242dbgfH_ctwcx9NDee-E,19607
|
|
10
|
-
arrayview/_diff.py,sha256=
|
|
10
|
+
arrayview/_diff.py,sha256=N2pYWY5n0XqH82noAO55caYzAam9pt-_lXld4OoLtrA,7793
|
|
11
11
|
arrayview/_extra_ports.py,sha256=dQ0IdBJOkNEKDHaCgDbSkIwP_V8IbdeYQMrZCJp-kO0,13733
|
|
12
12
|
arrayview/_icon.png,sha256=a8RTAbvweLhh3hzD5eGg76Peq-KSDcS6YrCphRb_HEs,2748
|
|
13
13
|
arrayview/_imaging.py,sha256=MQX1uy4m1lofOeoLDhCp6cHO5p_V5fXm4qlSu9Ykn-c,534
|
|
14
14
|
arrayview/_instance_registry.py,sha256=amfufA6EAWZV350QXEeeAF53FpTCu3ytEGp8Scny8s0,9068
|
|
15
|
-
arrayview/_io.py,sha256=
|
|
15
|
+
arrayview/_io.py,sha256=80HmDmD5wr8OC8hwLKLY5_TtBOqHxjxtqR_A1bFlxBo,116657
|
|
16
16
|
arrayview/_launch_plan.py,sha256=KGgIPGsflXArECB2txnIAewjuPvF4fZTbO63alC8x28,23570
|
|
17
17
|
arrayview/_launch_trace.py,sha256=l0tukfF1gPQqzeCYtIpnEOvTc5ssuiHvQ59uybtDdiY,5753
|
|
18
18
|
arrayview/_launcher.py,sha256=MG6333ebL92W3HIlmA85FbUb2cUpt38ArIj2phVculE,257361
|
|
19
19
|
arrayview/_lifecycle.py,sha256=bqG0oKr-e-5S1ssCTlGmF-yBE47ilrpO1S_Owfjs9Z8,5365
|
|
20
20
|
arrayview/_overlays.py,sha256=CksypG9rWfCz_3RRGIeyaKeXse17AFxvkEjmYyXnIIE,5399
|
|
21
21
|
arrayview/_platform.py,sha256=2WhLCqDDeaQpY5ezigkiFVqxxZX4afHUalb_-YISPB0,30324
|
|
22
|
-
arrayview/_render.py,sha256=
|
|
22
|
+
arrayview/_render.py,sha256=27cVUwW0ioKA3wu0zUGrHQb1klkGp--pGbM6nWOTvNU,40493
|
|
23
23
|
arrayview/_routes_analysis.py,sha256=Xz9Ysr04u07pzSRB4Fzmcl6XwVxyaG6xCWxGwYZi_80,33085
|
|
24
24
|
arrayview/_routes_drop.py,sha256=FC4e7STdCo3hYIA0C4Yy9Ka2UKFx7nLDU5dkujmc1Vo,12477
|
|
25
25
|
arrayview/_routes_export.py,sha256=q3ySRsJLW6ZpxtmjBYQzJ0KBeRNbhpKg9QKDVD310wo,4113
|
|
@@ -28,7 +28,7 @@ arrayview/_routes_persistence.py,sha256=T03csHb7ppGT-8yMDf227XkqhnhjgSLYj0RW2wmg
|
|
|
28
28
|
arrayview/_routes_preferences.py,sha256=gJYl5zkfgXlRhwOTGlTS0RchK49i7a5-xAWGRrh576U,5582
|
|
29
29
|
arrayview/_routes_preload.py,sha256=KOsankNguxdIWmFW9iZcY9p2SvUN1mOKY7KkW1qMGcc,1729
|
|
30
30
|
arrayview/_routes_query.py,sha256=EQlcuQGY81fs0ZynV2JX15BBcT9zLmj1-NZjehQEm8Q,25724
|
|
31
|
-
arrayview/_routes_rendering.py,sha256=
|
|
31
|
+
arrayview/_routes_rendering.py,sha256=5373qwaNYVedPnBHNo0b2PXBGIiVx37SqEcMCksFNJo,24874
|
|
32
32
|
arrayview/_routes_segmentation.py,sha256=x2bBjQffZryeTMmOH38YdBWethw1o3KpA8V0chJcZHI,23599
|
|
33
33
|
arrayview/_routes_state.py,sha256=3_3VswMI99tPkdb7Ec0YQeEaIF1HdV81W6NFuDXaByI,15887
|
|
34
34
|
arrayview/_routes_vectorfield.py,sha256=OWZtAONwRKQHdYnbDAMbOVf0q6pH7kqV8fa1icDhKHM,9734
|
|
@@ -44,7 +44,7 @@ arrayview/_torch.py,sha256=13sqIMCUu_-b9SQ9KfDCExDz2UMStL87EDVjnbJxAEo,7536
|
|
|
44
44
|
arrayview/_tutorial.py,sha256=2zZHJGJDa4n30GE1-9ADjKFAifGBH9vvHXP4uDt7BaA,19547
|
|
45
45
|
arrayview/_vectorfield.py,sha256=eDqMCMEGjO8Jdt-6Auh01cz3WD9dbF7xYUWD9xHAf1E,8115
|
|
46
46
|
arrayview/_view_memory.py,sha256=w2_zKyrucJInK9531aWnWSBfcmagT32CgI7s3LLM6kY,3241
|
|
47
|
-
arrayview/_viewer.html,sha256=
|
|
47
|
+
arrayview/_viewer.html,sha256=k4SZP4bV-8VsXSWmq0wPf5MKycNmeIpCcgS93UhngD4,2686439
|
|
48
48
|
arrayview/_vscode.py,sha256=EKnGN2zrjlybc4FQOmYA8BvYdtkcJbLHDEdgtvO7ul4,837
|
|
49
49
|
arrayview/_vscode_browser.py,sha256=VCH9JpAAjFuhO0wQe8tIGjAL5837AXg_bpmBFtWOQqc,20573
|
|
50
50
|
arrayview/_vscode_extension.py,sha256=P70gsFDtE7onJ9m79h6VGaS8CxC7yr5Yy-DW7a4Ib1U,53408
|
|
@@ -53,8 +53,8 @@ arrayview/_watch.py,sha256=Vsfcwg_VZLzh2u9XmsZPV3NiaGOCVUETHCmYge74BYc,2368
|
|
|
53
53
|
arrayview/arrayview-opener.vsix,sha256=3WQtf9tCZl0ch8wa5ig5owGTN25LCl9EyOZDjfGe6B8,63529
|
|
54
54
|
arrayview/gsap.min.js,sha256=VGihm4idI0E1uqrWezWsiScB9F_jMosn7qs6pPSkeac,72304
|
|
55
55
|
arrayview/todo.md,sha256=KhnRzpn6_jezR0nDDB61-zhox-rbOmEGW-A7Z0_7FnU,622
|
|
56
|
-
arrayview-0.
|
|
57
|
-
arrayview-0.
|
|
58
|
-
arrayview-0.
|
|
59
|
-
arrayview-0.
|
|
60
|
-
arrayview-0.
|
|
56
|
+
arrayview-0.56.0.dist-info/METADATA,sha256=uIjNBRhTLa93CXnDSvCv4Vw_1sLJ-mIg8wtLnYnyxVM,2423
|
|
57
|
+
arrayview-0.56.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
58
|
+
arrayview-0.56.0.dist-info/entry_points.txt,sha256=-0s08axutXkTbINiKs0Q7iv-33aWuTaamUg2q2-NyQ4,60
|
|
59
|
+
arrayview-0.56.0.dist-info/licenses/LICENSE,sha256=34OivjM9faB2QaPjZpMRTIiSx31V3U9cEyQ6F2k-bH0,1062
|
|
60
|
+
arrayview-0.56.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|