arrayview 0.43.4__py3-none-any.whl → 0.44.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/_analysis.py CHANGED
@@ -42,6 +42,11 @@ def _build_metadata(session) -> dict:
42
42
  # Collection axes are appended after the image dimensions. They
43
43
  # select a case; they must not influence the startup plane.
44
44
  default_shape = target_shape[:spatial_ndim]
45
+ # NIfTI metadata identifies the first three axes as anatomical.
46
+ # Later axes may be echoes, parameters, or time points, so they
47
+ # must not change which anatomical plane opens first.
48
+ if getattr(session, "spatial_meta", None) is not None:
49
+ default_shape = default_shape[:3]
45
50
  default_dims = _session_mod._startup_dims_for_data(session.data, default_shape)
46
51
  if default_dims is not None:
47
52
  meta["default_dims"] = [int(default_dims[0]), int(default_dims[1])]
arrayview/_io.py CHANGED
@@ -172,7 +172,9 @@ def _nifti_header_with_meta(filepath, *, native=False):
172
172
  (abs(norm_rot[i, j]) for i in range(3) for j in range(3) if i != j),
173
173
  default=0.0,
174
174
  )
175
- canonical_shape = tuple(int(img.shape[int(axis)]) for axis in transform[:, 0])
175
+ canonical_shape = tuple(
176
+ int(img.shape[int(axis)]) for axis in transform[:, 0]
177
+ ) + tuple(int(size) for size in img.shape[3:])
176
178
  meta = {
177
179
  "affine": original_affine,
178
180
  "affine_canonical": affine_canonical,