worldarray 0.3.0__py3-none-any.whl → 0.4.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.
- worldarray/__init__.py +1 -1
- worldarray/array.py +122 -13
- worldarray/resample.py +12 -4
- worldarray/units.py +3 -1
- worldarray/write.py +10 -1
- {worldarray-0.3.0.dist-info → worldarray-0.4.0.dist-info}/METADATA +19 -9
- worldarray-0.4.0.dist-info/RECORD +16 -0
- worldarray-0.3.0.dist-info/RECORD +0 -16
- {worldarray-0.3.0.dist-info → worldarray-0.4.0.dist-info}/WHEEL +0 -0
- {worldarray-0.3.0.dist-info → worldarray-0.4.0.dist-info}/licenses/LICENSE +0 -0
worldarray/__init__.py
CHANGED
worldarray/array.py
CHANGED
|
@@ -36,7 +36,15 @@ from .placement import (
|
|
|
36
36
|
read_meta_light,
|
|
37
37
|
)
|
|
38
38
|
from .retry import Retry, read_with_retries
|
|
39
|
-
from .store import
|
|
39
|
+
from .store import (
|
|
40
|
+
Node,
|
|
41
|
+
detect,
|
|
42
|
+
is_remote,
|
|
43
|
+
join,
|
|
44
|
+
normalize_path,
|
|
45
|
+
open_array,
|
|
46
|
+
precomputed_scale_index,
|
|
47
|
+
)
|
|
40
48
|
|
|
41
49
|
logger = logging.getLogger(__name__)
|
|
42
50
|
|
|
@@ -90,6 +98,9 @@ class WorldArray:
|
|
|
90
98
|
if mode not in ("r", "r+"):
|
|
91
99
|
raise ValueError("mode is 'r' (read) or 'r+' (read and write)")
|
|
92
100
|
self.path = path
|
|
101
|
+
# where later opens find it (reopen, a pickle, the pyramid): a local path resolved
|
|
102
|
+
# against the working directory now, so a worker that changes directory opens the same store
|
|
103
|
+
self._where = normalize_path(path)
|
|
93
104
|
self._mode = mode
|
|
94
105
|
self._store_fill = bool(store_fill)
|
|
95
106
|
self.padding = padding
|
|
@@ -139,6 +150,9 @@ class WorldArray:
|
|
|
139
150
|
self._meta = self._rescaled_to_base(base_voxel_size, base_units)
|
|
140
151
|
space, time = _unit_targets(units)
|
|
141
152
|
self._grid = self._meta.in_units(space=space, time=time, strict=strict_units)
|
|
153
|
+
# the stored level's spatial placement, before any relabel renames the grid
|
|
154
|
+
self._stored_voxel_size = tuple(self._grid.voxel_size[i] for i in self._grid.spatial)
|
|
155
|
+
self._stored_translation = tuple(self._grid.translation[i] for i in self._grid.spatial)
|
|
142
156
|
|
|
143
157
|
self._target: tuple[float, ...] | None = None
|
|
144
158
|
if voxel_size is not None:
|
|
@@ -299,8 +313,16 @@ class WorldArray:
|
|
|
299
313
|
|
|
300
314
|
@property
|
|
301
315
|
def source_voxel_size(self) -> tuple[float, ...]:
|
|
302
|
-
"""The stored level's voxel size on the spatial axes, in ``units
|
|
303
|
-
|
|
316
|
+
"""The stored level's voxel size on the spatial axes, in ``units``: what the level
|
|
317
|
+
is, whether reads resample it or ``on_mismatch="relabel"`` renames its grid."""
|
|
318
|
+
return self._stored_voxel_size
|
|
319
|
+
|
|
320
|
+
@property
|
|
321
|
+
def source_translation(self) -> tuple[float, ...]:
|
|
322
|
+
"""The stored level's translation (the centre of its voxel 0) on the spatial axes, in
|
|
323
|
+
``units``: where the level is, whether reads resample it or ``on_mismatch="relabel"``
|
|
324
|
+
renames its grid."""
|
|
325
|
+
return self._stored_translation
|
|
304
326
|
|
|
305
327
|
@property
|
|
306
328
|
def resampled(self) -> bool:
|
|
@@ -337,8 +359,22 @@ class WorldArray:
|
|
|
337
359
|
def box(self) -> Box:
|
|
338
360
|
"""The array's extent on the spatial axes as a world box, ``[corner, corner + shape *
|
|
339
361
|
voxel_size)``: what funlib calls the array's roi. ``Box.from_index`` gives the same
|
|
340
|
-
over every axis.
|
|
362
|
+
over every axis. With a resample target it is the extent of the target voxels that
|
|
363
|
+
``shape`` counts, which may reach past the stored data by less than one target voxel,
|
|
364
|
+
so ``read(box)`` returns ``shape``."""
|
|
341
365
|
sp = self._grid.spatial
|
|
366
|
+
if self._target is not None:
|
|
367
|
+
begin, end = [], []
|
|
368
|
+
for k, axis in enumerate(sp):
|
|
369
|
+
first, last = _resample.target_range(
|
|
370
|
+
self._grid.shape[axis],
|
|
371
|
+
self._grid.voxel_size[axis],
|
|
372
|
+
self._target[k],
|
|
373
|
+
self._origins()[k],
|
|
374
|
+
)
|
|
375
|
+
begin.append(self.anchor[k] + first * self._target[k])
|
|
376
|
+
end.append(self.anchor[k] + last * self._target[k])
|
|
377
|
+
return Box(tuple(begin), tuple(end))
|
|
342
378
|
return Box.from_index(
|
|
343
379
|
(0,) * len(sp),
|
|
344
380
|
tuple(self._grid.shape[i] for i in sp),
|
|
@@ -356,7 +392,7 @@ class WorldArray:
|
|
|
356
392
|
def levels_pyramid(self) -> Pyramid:
|
|
357
393
|
if self._pyramid is None:
|
|
358
394
|
self._pyramid = Pyramid(
|
|
359
|
-
self.
|
|
395
|
+
self._where, context=self.context, units=self.units, select=self._select
|
|
360
396
|
)
|
|
361
397
|
return self._pyramid
|
|
362
398
|
|
|
@@ -405,14 +441,15 @@ class WorldArray:
|
|
|
405
441
|
**overrides,
|
|
406
442
|
}
|
|
407
443
|
return WorldArray(
|
|
408
|
-
self.
|
|
444
|
+
self._where, context=context if context is not None else self.context, **opts
|
|
409
445
|
)
|
|
410
446
|
|
|
411
447
|
def __reduce__(self):
|
|
412
448
|
"""A handle pickles by its arguments and its context's recipe, and reopens in the
|
|
413
449
|
receiving process (Behaviour 11): a worker opens its own store, cheaply, on a shared
|
|
414
450
|
context when the handle had one, else on a context rebuilt from the same spec, so a
|
|
415
|
-
capped context stays capped.
|
|
451
|
+
capped context stays capped. A local path goes as resolved at open, so a worker that
|
|
452
|
+
changed directory still finds the store."""
|
|
416
453
|
opts = {
|
|
417
454
|
**self._opts,
|
|
418
455
|
"padding": self.padding,
|
|
@@ -422,7 +459,7 @@ class WorldArray:
|
|
|
422
459
|
"retries": self.retries,
|
|
423
460
|
"transform": self.transform,
|
|
424
461
|
}
|
|
425
|
-
return (_reopen, (self.
|
|
462
|
+
return (_reopen, (self._where, opts, recipe_of(self.context)))
|
|
426
463
|
|
|
427
464
|
# --- index space ------------------------------------------------------------
|
|
428
465
|
|
|
@@ -503,7 +540,9 @@ class WorldArray:
|
|
|
503
540
|
or the array's end), so writers in different processes need no coordination; a
|
|
504
541
|
unit written whole is one put. ``partial=True`` lifts the check and does tensorstore's
|
|
505
542
|
read-modify-write of the touched units, unsafe while anything else writes the same
|
|
506
|
-
unit.
|
|
543
|
+
unit. ``data`` may be a scalar, which fills the box: it is converted to the array's
|
|
544
|
+
dtype only when the value survives (``0`` into ``uint8``, not ``300`` or ``0.5``).
|
|
545
|
+
No other cast, no padding, no resampling; the write commits before returning."""
|
|
507
546
|
if not self.writable:
|
|
508
547
|
raise ValueError(
|
|
509
548
|
f"{self.path} was opened read-only; open it with mode='r+' or create it"
|
|
@@ -518,9 +557,11 @@ class WorldArray:
|
|
|
518
557
|
if len(begin) != len(shape) or len(end) != len(shape):
|
|
519
558
|
raise ValueError(f"{self.path}: begin and end need one entry per axis of {shape}")
|
|
520
559
|
wanted = tuple(e - b for b, e in zip(begin, end))
|
|
521
|
-
if data.
|
|
560
|
+
if data.ndim == 0:
|
|
561
|
+
data = self._scalar(data)
|
|
562
|
+
elif data.shape != wanted:
|
|
522
563
|
raise ValueError(f"{self.path}: data has shape {data.shape}; the box is {wanted}")
|
|
523
|
-
|
|
564
|
+
elif data.dtype != self.dtype:
|
|
524
565
|
raise ValueError(
|
|
525
566
|
f"{self.path}: data is {data.dtype}, the array {self.dtype}; nothing is cast on write"
|
|
526
567
|
)
|
|
@@ -538,6 +579,22 @@ class WorldArray:
|
|
|
538
579
|
)
|
|
539
580
|
self._store[tuple(slice(b, e) for b, e in zip(begin, end))].write(data).result()
|
|
540
581
|
|
|
582
|
+
def _scalar(self, value: np.ndarray) -> np.ndarray:
|
|
583
|
+
"""A 0-d ``value`` in the array's dtype, or ``ValueError`` when converting changes it:
|
|
584
|
+
an integer or bool array takes only whole numbers in its range, a float array any
|
|
585
|
+
number that does not overflow it (rounded to its precision)."""
|
|
586
|
+
dtype = self.dtype
|
|
587
|
+
with np.errstate(invalid="ignore", over="ignore"), warnings.catch_warnings():
|
|
588
|
+
warnings.simplefilter("ignore")
|
|
589
|
+
out = value.astype(dtype)
|
|
590
|
+
if dtype.kind in "biu":
|
|
591
|
+
kept = bool(out == value)
|
|
592
|
+
else:
|
|
593
|
+
kept = bool(np.isfinite(out) or not np.isfinite(value))
|
|
594
|
+
if not kept:
|
|
595
|
+
raise ValueError(f"{self.path}: {value.item()!r} does not fit {dtype}")
|
|
596
|
+
return out
|
|
597
|
+
|
|
541
598
|
def write(self, box, data: np.ndarray, partial: bool = False) -> None:
|
|
542
599
|
"""Write ``data`` over a world box: the voxels Behaviour 2's centre rule selects, then
|
|
543
600
|
``write_index``. A box reaching outside the array raises; nothing is padded or
|
|
@@ -863,6 +920,57 @@ class WorldArray:
|
|
|
863
920
|
data[~inside] = padding
|
|
864
921
|
return _squeeze((data, inside) if mask else data, drop)
|
|
865
922
|
|
|
923
|
+
def read_onto(
|
|
924
|
+
self,
|
|
925
|
+
grid,
|
|
926
|
+
begin: Sequence[int] | None = None,
|
|
927
|
+
end: Sequence[int] | None = None,
|
|
928
|
+
padding: Any = None,
|
|
929
|
+
method: str | None = None,
|
|
930
|
+
mask: bool = False,
|
|
931
|
+
retries: Retry | None = None,
|
|
932
|
+
transform: Transform | None = None,
|
|
933
|
+
post_transform: Transform | None = None,
|
|
934
|
+
select: dict[str, int] | None = None,
|
|
935
|
+
) -> np.ndarray | tuple[np.ndarray, np.ndarray]:
|
|
936
|
+
"""Voxels ``[begin, end)`` of another grid (a ``Grid``), read from this array
|
|
937
|
+
(Behaviour 20): ``begin`` and ``end`` index the grid's spatial axes, all of it when
|
|
938
|
+
None, and the result has exactly that shape there; other axes are read as ``read``
|
|
939
|
+
reads them. At the array's own voxel size nothing is resampled, however the grids are
|
|
940
|
+
offset: each grid voxel takes the stored voxel whose centre lies in it. Otherwise the
|
|
941
|
+
array is resampled onto the grid by ``method``, anchored at the grid's corner. The
|
|
942
|
+
grid's units are converted to ``units``; its spatial axes must be named as this
|
|
943
|
+
array's are."""
|
|
944
|
+
sp, mine = grid.spatial, self._grid.spatial
|
|
945
|
+
names = tuple(grid.axes[i] for i in sp)
|
|
946
|
+
if names != tuple(self._grid.axes[i] for i in mine):
|
|
947
|
+
raise ValueError(
|
|
948
|
+
f"{self.path}: the grid's spatial axes are {names}; the array's "
|
|
949
|
+
f"{tuple(self._grid.axes[i] for i in mine)}"
|
|
950
|
+
)
|
|
951
|
+
vs, tr = [], []
|
|
952
|
+
for i, j in zip(sp, mine):
|
|
953
|
+
have, want = grid.units[i], self._grid.units[j]
|
|
954
|
+
f = 1.0 if have == want else U.factor(have, want)
|
|
955
|
+
vs.append(grid.voxel_size[i] * f)
|
|
956
|
+
tr.append(grid.translation[i] * f)
|
|
957
|
+
begin = (0,) * len(sp) if begin is None else tuple(int(b) for b in begin)
|
|
958
|
+
end = tuple(grid.shape[i] for i in sp) if end is None else tuple(int(e) for e in end)
|
|
959
|
+
if len(begin) != len(sp) or len(end) != len(sp):
|
|
960
|
+
raise ValueError(f"begin and end need one entry per spatial axis of the grid {names}")
|
|
961
|
+
return self.read(
|
|
962
|
+
Box.from_index(begin, end, vs, tr),
|
|
963
|
+
voxel_size=vs,
|
|
964
|
+
anchor=tuple(t - v / 2 for t, v in zip(tr, vs)),
|
|
965
|
+
padding=padding,
|
|
966
|
+
method=method,
|
|
967
|
+
mask=mask,
|
|
968
|
+
retries=retries,
|
|
969
|
+
transform=transform,
|
|
970
|
+
post_transform=post_transform,
|
|
971
|
+
select=select,
|
|
972
|
+
)
|
|
973
|
+
|
|
866
974
|
|
|
867
975
|
def _squeeze(out, drop: tuple[int, ...]):
|
|
868
976
|
if not drop:
|
|
@@ -1106,8 +1214,8 @@ def create(
|
|
|
1106
1214
|
0.5) following the group's format (Behaviours 11 and 12). ``chunks`` is required.
|
|
1107
1215
|
Nothing is ever deleted or overwritten: with ``exists="error"`` anything at ``path``
|
|
1108
1216
|
raises ``FileExistsError``; with ``"adopt"`` an identical array (shape, dtype, chunks,
|
|
1109
|
-
shards, placement
|
|
1110
|
-
naming every difference. Returns a writable ``WorldArray``."""
|
|
1217
|
+
shards, placement, and every key of ``attrs`` already holding the value given) is opened
|
|
1218
|
+
for writing and a different one raises ``ValueError`` naming every difference. Returns a writable ``WorldArray``."""
|
|
1111
1219
|
if grid is not None:
|
|
1112
1220
|
# a Grid planned the output (Behaviour 18): its facts are the array's, chunks and
|
|
1113
1221
|
# shards overridable; the placement arguments must not also be given
|
|
@@ -1148,6 +1256,7 @@ def create(
|
|
|
1148
1256
|
shards=shards,
|
|
1149
1257
|
voxel_size=vs,
|
|
1150
1258
|
translation=tr,
|
|
1259
|
+
attrs=attrs,
|
|
1151
1260
|
)
|
|
1152
1261
|
if diffs:
|
|
1153
1262
|
raise ValueError(
|
worldarray/resample.py
CHANGED
|
@@ -153,14 +153,22 @@ def apply_axis(block: np.ndarray, axis: int, plan: AxisPlan) -> np.ndarray:
|
|
|
153
153
|
raise ValueError(plan.kind)
|
|
154
154
|
|
|
155
155
|
|
|
156
|
+
def target_range(n: int, s: float, t: float, origin: float = 0.0) -> tuple[int, int]:
|
|
157
|
+
"""``[first, last)``: the target voxels of size ``t`` that overlap ``n`` source voxels of
|
|
158
|
+
size ``s``, indexed on a target grid whose voxel 0 corner sits ``origin`` source voxels
|
|
159
|
+
from the source corner."""
|
|
160
|
+
ratio = t / s
|
|
161
|
+
first = int(np.floor(snap_integral(-origin / ratio)))
|
|
162
|
+
last = int(np.ceil(snap_integral((n - origin) / ratio)))
|
|
163
|
+
return first, max(last, first)
|
|
164
|
+
|
|
165
|
+
|
|
156
166
|
def target_shape(n: int, s: float, t: float, origin: float = 0.0) -> int:
|
|
157
167
|
"""How many target voxels of size ``t`` cover ``n`` source voxels of size ``s``, counting
|
|
158
168
|
from a target grid whose voxel 0 corner sits ``origin`` source voxels from the source
|
|
159
169
|
corner: the first and last target voxels that overlap the data, inclusive."""
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
last = np.ceil(snap_integral((n - origin) / ratio))
|
|
163
|
-
return int(max(last - first, 0))
|
|
170
|
+
first, last = target_range(n, s, t, origin)
|
|
171
|
+
return last - first
|
|
164
172
|
|
|
165
173
|
|
|
166
174
|
def resample(
|
worldarray/units.py
CHANGED
|
@@ -19,6 +19,7 @@ LENGTH_M = {
|
|
|
19
19
|
"millimeter": 1e-3, "millimetre": 1e-3, "mm": 1e-3,
|
|
20
20
|
"centimeter": 1e-2, "centimetre": 1e-2, "cm": 1e-2,
|
|
21
21
|
"meter": 1.0, "metre": 1.0, "m": 1.0,
|
|
22
|
+
"kilometer": 1e3, "kilometre": 1e3, "km": 1e3,
|
|
22
23
|
} # fmt: skip
|
|
23
24
|
TIME_S = {
|
|
24
25
|
"nanosecond": 1e-9, "ns": 1e-9,
|
|
@@ -81,7 +82,7 @@ def factor(
|
|
|
81
82
|
# entry through the table above, so "nanometre", "nm" and "Nanometers" agree.
|
|
82
83
|
_SHORT = {
|
|
83
84
|
"picometer": "pm", "angstrom": "Å", "nanometer": "nm", "micrometer": "µm",
|
|
84
|
-
"millimeter": "mm", "centimeter": "cm", "meter": "m",
|
|
85
|
+
"millimeter": "mm", "centimeter": "cm", "meter": "m", "kilometer": "km",
|
|
85
86
|
"nanosecond": "ns", "microsecond": "µs", "millisecond": "ms", "second": "s",
|
|
86
87
|
"minute": "min", "hour": "h", "day": "d",
|
|
87
88
|
} # fmt: skip
|
|
@@ -103,6 +104,7 @@ def abbreviation(unit: str) -> str:
|
|
|
103
104
|
# The American spelling is OME's.
|
|
104
105
|
_OME_NAMES = (
|
|
105
106
|
"picometer", "angstrom", "nanometer", "micrometer", "millimeter", "centimeter", "meter",
|
|
107
|
+
"kilometer",
|
|
106
108
|
"nanosecond", "microsecond", "millisecond", "second", "minute", "hour", "day",
|
|
107
109
|
) # fmt: skip
|
|
108
110
|
_OME_BY_SIZE = {_lookup(name): name for name in _OME_NAMES}
|
worldarray/write.py
CHANGED
|
@@ -803,9 +803,12 @@ def differences(
|
|
|
803
803
|
shards: Sequence[int] | None,
|
|
804
804
|
voxel_size: Sequence[float],
|
|
805
805
|
translation: Sequence[float],
|
|
806
|
+
attrs: dict | None = None,
|
|
806
807
|
) -> list[str]:
|
|
807
808
|
"""How an existing array's ``ArrayMeta`` differs from what a caller wanted to create:
|
|
808
|
-
one line per field, empty when identical (placement within ``RTOL``).
|
|
809
|
+
one line per field, empty when identical (placement within ``RTOL``). Of the array's
|
|
810
|
+
attributes only the keys of ``attrs`` are compared, as JSON stores them; every other key
|
|
811
|
+
is someone else's."""
|
|
809
812
|
out = []
|
|
810
813
|
if tuple(meta.shape) != tuple(int(n) for n in shape):
|
|
811
814
|
out.append(f"shape: found {tuple(meta.shape)}, wanted {tuple(shape)}")
|
|
@@ -826,4 +829,10 @@ def differences(
|
|
|
826
829
|
out.append(
|
|
827
830
|
f"{what}: found {tuple(float(x) for x in f)}, wanted {tuple(float(x) for x in w)}"
|
|
828
831
|
)
|
|
832
|
+
found_attrs = meta.attrs or {}
|
|
833
|
+
for key, wanted in json.loads(json.dumps(attrs or {})).items():
|
|
834
|
+
if key not in found_attrs:
|
|
835
|
+
out.append(f"attrs[{key!r}]: missing, wanted {wanted!r}")
|
|
836
|
+
elif found_attrs[key] != wanted:
|
|
837
|
+
out.append(f"attrs[{key!r}]: found {found_attrs[key]!r}, wanted {wanted!r}")
|
|
829
838
|
return out
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: worldarray
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Read zarr, N5 and Neuroglancer precomputed volumes in world coordinates through tensorstore: correct voxel placement, pyramid levels, padded region reads, resampling. numpy + tensorstore only.
|
|
5
5
|
Project-URL: Homepage, https://janeliascicomp.github.io/worldarray/
|
|
6
6
|
Project-URL: Documentation, https://janeliascicomp.github.io/worldarray/
|
|
@@ -109,6 +109,7 @@ six = wa.open(path, voxel_size=(6, 6, 6), on_mismatch="resample")
|
|
|
109
109
|
|
|
110
110
|
# one volume read onto another volume's grid, for masks, contact sites, statistics
|
|
111
111
|
onto = raw.read(box, voxel_size=labels.voxel_size, anchor=labels.corner)
|
|
112
|
+
onto = raw.read_onto(grid, begin, end) # voxels [begin, end) of a Grid, exactly that shape
|
|
112
113
|
|
|
113
114
|
# index space, native units: what an engine or a viewer wants
|
|
114
115
|
vol = wa.open(path, units=None)
|
|
@@ -159,15 +160,24 @@ s1 = wa.open_pyramid("out.zarr", mode="r+").add_level("s1", factors=2) # place
|
|
|
159
160
|
- **Plans outputs and blocks** (0.3): a store-less `Grid` with the same geometry as an
|
|
160
161
|
array, so an output is planned, cut into blocks and only then created; `blocks` tiling an
|
|
161
162
|
array or a box into write boxes with context-grown read boxes, in C order, as plain
|
|
162
|
-
picklable records a cluster job takes by id; the anisotropy-aware pyramid schedule
|
|
163
|
-
Nothing is scheduled or run.
|
|
163
|
+
picklable records a cluster job takes by id; the anisotropy-aware pyramid schedule; every
|
|
164
|
+
input read onto that grid by its voxel indices (0.4). Nothing is scheduled or run.
|
|
164
165
|
|
|
165
166
|
## The placement rule
|
|
166
167
|
|
|
167
168
|
A translation is where the centre of voxel 0 is. Index `i` sits at
|
|
168
|
-
`translation + i * voxel_size
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
`translation + i * voxel_size` and covers half a voxel either side, so the array's corner
|
|
170
|
+
is `corner = translation - voxel_size / 2`. With 8 nm voxels and the corner at 0, the
|
|
171
|
+
translation is 4: voxel 0 covers 0 to 8 nm around its centre at 4, voxel 1 covers 8 to
|
|
172
|
+
16 nm around 12. That is how OME-NGFF defines it and how Neuroglancer draws it.
|
|
173
|
+
|
|
174
|
+
The centre is the model because a voxel is a sample taken at a point. Everything that
|
|
175
|
+
compares or resamples grids (picking a level, reading one volume onto another's grid,
|
|
176
|
+
interpolating) works on those points, and the box a voxel covers follows from its point.
|
|
177
|
+
The read rule follows too: a voxel is read iff its centre lies in the box, so boxes that
|
|
178
|
+
adjoin never share a voxel or drop one.
|
|
179
|
+
|
|
180
|
+
Dialects that store the corner are moved half a voxel on reading:
|
|
171
181
|
|
|
172
182
|
| Stored | Means | Read as `translation` |
|
|
173
183
|
|---|---|---|
|
|
@@ -218,12 +228,12 @@ wa.units.abbreviation("nanometer") ; wa.store.join(path, "s0") ; wa.store.parent
|
|
|
218
228
|
```
|
|
219
229
|
|
|
220
230
|
`WorldArray`: `ts`, `meta`, `grid`, `shape`, `dtype`, `axes`, `voxel_size`, `translation`,
|
|
221
|
-
`corner`, `box`, `levels`, `level_name`, `level_path`, `source_voxel_size`, `resampled`,
|
|
231
|
+
`corner`, `box`, `levels`, `level_name`, `level_path`, `source_voxel_size`, `source_translation`, `resampled`,
|
|
222
232
|
`writable`, `write_shape`;
|
|
223
233
|
`read(box, voxel_size=, padding=, method=, mask=, anchor=, transform=, post_transform=, select=, strict=)`,
|
|
224
|
-
`read_index(begin, end, padding=, mask=, select=, transform=)`, `index_box(box)`,
|
|
234
|
+
`read_index(begin, end, padding=, mask=, select=, transform=)`, `read_onto(grid, begin=, end=, ...)`, `index_box(box)`,
|
|
225
235
|
`chunks_covering(begin, end, write=)`, `list_chunks()`, `chunk_key(index)`, `parse_chunk_key(key)`,
|
|
226
|
-
`write_index(begin, end, data, partial=)
|
|
236
|
+
`write_index(begin, end, data, partial=)` and `write(box, data, partial=)` (`data` an array or a scalar), `reopen(context=)`.
|
|
227
237
|
|
|
228
238
|
A box is a `(begin, end)` pair of floats in your units, half-open per axis, over the
|
|
229
239
|
spatial axes or every axis; any object with `.begin`/`.end` or `.offset`/`.shape` also
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
worldarray/__init__.py,sha256=8So_Dr57Sb_TSV21VWMqGkqk-HPkoQVdgJhptcR0aPQ,1828
|
|
2
|
+
worldarray/array.py,sha256=dk2o464yWNS-Kfap8M7fkNiBhBabUAKI-N5_8oq12A4,61481
|
|
3
|
+
worldarray/context.py,sha256=MZQoHLyir1xNYCHtQPGTIQXaFzFr3oAcyfddrE_UWIA,3284
|
|
4
|
+
worldarray/geometry.py,sha256=ByQu8WrcUydKU2eDsugKwvx1LpQbETmhutfy5mv9inI,7449
|
|
5
|
+
worldarray/grid.py,sha256=ATa6rcWygQ9Pigvqftz1tV_0U6enA6xF4WA_Y2ubD6Y,22313
|
|
6
|
+
worldarray/levels.py,sha256=ICtax6A5Qi7DDlZI2S5UPg-S8Ze-AZoMxXyRykcs36A,6414
|
|
7
|
+
worldarray/placement.py,sha256=l7kPkS6GatjoD_Eb7pJqkkxsHLKLUr5gA9JrxeMsnxo,34140
|
|
8
|
+
worldarray/resample.py,sha256=S6J6SSp6wK4KRzp7tSA94tFRDaPhee8GS-gPKEcOTRU,10796
|
|
9
|
+
worldarray/retry.py,sha256=Uw4YP-tPwtg0tgpBzY0ux4F5vehdTZTp0385QH_vvrk,2766
|
|
10
|
+
worldarray/store.py,sha256=432iIX35ak_cHhibHcZd80ehH0MgN35rtxOtYU35LYg,19154
|
|
11
|
+
worldarray/units.py,sha256=hng7Q8J71jsacPsnmtYyag8ufR0S6xhaL6R38wepvTA,5325
|
|
12
|
+
worldarray/write.py,sha256=-IKEGOYDsozV-Cd-CmcaERC2devx2MojPmGdnE70kIc,33942
|
|
13
|
+
worldarray-0.4.0.dist-info/METADATA,sha256=Q-YS5t1Nahwd6AxG9SnC64gK42mjy7_QD53yG4AKfPM,16123
|
|
14
|
+
worldarray-0.4.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
15
|
+
worldarray-0.4.0.dist-info/licenses/LICENSE,sha256=NsviVkqc3M7YUSeSNmisDSg3e3L8S4ofeIjthWm8pvk,1518
|
|
16
|
+
worldarray-0.4.0.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
worldarray/__init__.py,sha256=_g8gaopTTDUXz_vfEqaWzSEXSf3hflzNW6zjCLpiX-A,1828
|
|
2
|
-
worldarray/array.py,sha256=1lmdq-Mi5Nu4wWJ3d6Ek5ZeA0-QmJJ6JgHdsQG7ud3k,56051
|
|
3
|
-
worldarray/context.py,sha256=MZQoHLyir1xNYCHtQPGTIQXaFzFr3oAcyfddrE_UWIA,3284
|
|
4
|
-
worldarray/geometry.py,sha256=ByQu8WrcUydKU2eDsugKwvx1LpQbETmhutfy5mv9inI,7449
|
|
5
|
-
worldarray/grid.py,sha256=ATa6rcWygQ9Pigvqftz1tV_0U6enA6xF4WA_Y2ubD6Y,22313
|
|
6
|
-
worldarray/levels.py,sha256=ICtax6A5Qi7DDlZI2S5UPg-S8Ze-AZoMxXyRykcs36A,6414
|
|
7
|
-
worldarray/placement.py,sha256=l7kPkS6GatjoD_Eb7pJqkkxsHLKLUr5gA9JrxeMsnxo,34140
|
|
8
|
-
worldarray/resample.py,sha256=nAls-m0vchrsua0q_1yx1K9-djlAnWtkgokCfXqbpIQ,10411
|
|
9
|
-
worldarray/retry.py,sha256=Uw4YP-tPwtg0tgpBzY0ux4F5vehdTZTp0385QH_vvrk,2766
|
|
10
|
-
worldarray/store.py,sha256=432iIX35ak_cHhibHcZd80ehH0MgN35rtxOtYU35LYg,19154
|
|
11
|
-
worldarray/units.py,sha256=02i7kpkPjB3HJ2-7ZAvEXLjv6j0mmfiYZjpUNwFDvz4,5238
|
|
12
|
-
worldarray/write.py,sha256=IjV2jtwSBBAcWKHfms9KPUALX5GDs7v-2FRpTMO2Gfo,33442
|
|
13
|
-
worldarray-0.3.0.dist-info/METADATA,sha256=lhY78UeT83ZZLyshx6u-DwSWFo-1aWqhXmaXYaKARXk,15280
|
|
14
|
-
worldarray-0.3.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
15
|
-
worldarray-0.3.0.dist-info/licenses/LICENSE,sha256=NsviVkqc3M7YUSeSNmisDSg3e3L8S4ofeIjthWm8pvk,1518
|
|
16
|
-
worldarray-0.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|