patchworks 0.3.0__tar.gz → 0.5.0__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.
- {patchworks-0.3.0 → patchworks-0.5.0}/.github/workflows/docs.yml +4 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/.github/workflows/lint.yml +2 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/.github/workflows/release.yml +3 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/PKG-INFO +21 -5
- {patchworks-0.3.0 → patchworks-0.5.0}/README.md +7 -4
- {patchworks-0.3.0 → patchworks-0.5.0}/cliff.toml +7 -4
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/guide/ome_zarr_napari.md +21 -7
- {patchworks-0.3.0 → patchworks-0.5.0}/mkdocs.yml +3 -1
- {patchworks-0.3.0 → patchworks-0.5.0}/pyproject.toml +14 -5
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/_io.py +9 -2
- patchworks-0.5.0/src/patchworks/plugins/ome_zarr.py +570 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/tests/test_ome_zarr.py +35 -0
- patchworks-0.3.0/src/patchworks/plugins/ome_zarr.py +0 -459
- {patchworks-0.3.0 → patchworks-0.5.0}/.gitignore +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/chunks.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/cluster.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/io.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/merge_tile_labels.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/plugins/cellpose.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/plugins/napari.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/plugins/ome_zarr.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/relabel.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/api/tile_process.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/cellpose_2d.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/cellpose_2d.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/cellpose_3d.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/cellpose_3d.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/custom.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/custom_method.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/standalone_merge.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/stardist.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/examples/stardist_2d.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/getting_started.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/guide/gpu_distributed.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/guide/merging.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/guide/pitfalls.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/guide/skip_empty.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/guide/tiling.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/docs/index.md +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/__init__.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/_chunks.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/_cluster.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/_core.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/_merge.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/_relabel.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/plugins/__init__.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/plugins/cellpose.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/src/patchworks/plugins/napari.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/tests/test_core.py +0 -0
- {patchworks-0.3.0 → patchworks-0.5.0}/tests/test_napari.py +0 -0
|
@@ -22,6 +22,9 @@ jobs:
|
|
|
22
22
|
with:
|
|
23
23
|
config: cliff.toml
|
|
24
24
|
args: --latest --strip header
|
|
25
|
+
env:
|
|
26
|
+
# Lets git-cliff resolve commit authors to GitHub handles/avatars.
|
|
27
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
25
28
|
|
|
26
29
|
- name: Create GitHub release
|
|
27
30
|
uses: softprops/action-gh-release@v2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: patchworks
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Tiled processing of arbitrarily large images with globally consistent labels
|
|
5
5
|
Project-URL: Homepage, https://github.com/imcf/patchworks
|
|
6
6
|
Project-URL: Issues, https://github.com/imcf/patchworks/issues
|
|
@@ -24,6 +24,12 @@ Requires-Dist: zarr>=2.14
|
|
|
24
24
|
Provides-Extra: all
|
|
25
25
|
Requires-Dist: bioio; extra == 'all'
|
|
26
26
|
Requires-Dist: bioio-bioformats; extra == 'all'
|
|
27
|
+
Requires-Dist: bioio-czi; extra == 'all'
|
|
28
|
+
Requires-Dist: bioio-lif; extra == 'all'
|
|
29
|
+
Requires-Dist: bioio-nd2; extra == 'all'
|
|
30
|
+
Requires-Dist: bioio-ome-tiff; extra == 'all'
|
|
31
|
+
Requires-Dist: bioio-tifffile; extra == 'all'
|
|
32
|
+
Requires-Dist: imaris-ims-file-reader; extra == 'all'
|
|
27
33
|
Requires-Dist: nvidia-ml-py; extra == 'all'
|
|
28
34
|
Requires-Dist: psutil; extra == 'all'
|
|
29
35
|
Requires-Dist: scikit-image; extra == 'all'
|
|
@@ -31,6 +37,11 @@ Requires-Dist: tqdm; extra == 'all'
|
|
|
31
37
|
Provides-Extra: bioio
|
|
32
38
|
Requires-Dist: bioio; extra == 'bioio'
|
|
33
39
|
Requires-Dist: bioio-bioformats; extra == 'bioio'
|
|
40
|
+
Requires-Dist: bioio-czi; extra == 'bioio'
|
|
41
|
+
Requires-Dist: bioio-lif; extra == 'bioio'
|
|
42
|
+
Requires-Dist: bioio-nd2; extra == 'bioio'
|
|
43
|
+
Requires-Dist: bioio-ome-tiff; extra == 'bioio'
|
|
44
|
+
Requires-Dist: bioio-tifffile; extra == 'bioio'
|
|
34
45
|
Provides-Extra: cellpose
|
|
35
46
|
Requires-Dist: cellpose>=3.0; extra == 'cellpose'
|
|
36
47
|
Provides-Extra: dev
|
|
@@ -44,6 +55,8 @@ Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
|
|
|
44
55
|
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
|
|
45
56
|
Provides-Extra: gpu
|
|
46
57
|
Requires-Dist: nvidia-ml-py; extra == 'gpu'
|
|
58
|
+
Provides-Extra: imaris
|
|
59
|
+
Requires-Dist: imaris-ims-file-reader; extra == 'imaris'
|
|
47
60
|
Provides-Extra: io
|
|
48
61
|
Requires-Dist: psutil; extra == 'io'
|
|
49
62
|
Requires-Dist: tqdm; extra == 'io'
|
|
@@ -61,7 +74,7 @@ Description-Content-Type: text/markdown
|
|
|
61
74
|
> Tiled processing of arbitrarily large images — any image, any function.
|
|
62
75
|
|
|
63
76
|
```
|
|
64
|
-
┌──────┬──────┬──────┐ fn(tile) → labels
|
|
77
|
+
┌──────┬──────┬──────┐ fn(tile) → labels ┌──────┬──────┬──────┐
|
|
65
78
|
│ tile │ tile │ tile │ ─────────────────────► │ 1 │ 2 │ 3 │
|
|
66
79
|
├──────┼──────┼──────┤ ├──────┼──────┼──────┤
|
|
67
80
|
│ tile │ tile │ tile │ │ 4 │ 5 │ 6 │ globally
|
|
@@ -88,13 +101,16 @@ Optional extras:
|
|
|
88
101
|
pip install "patchworks[gpu]" # GPU VRAM querying (nvidia-ml-py)
|
|
89
102
|
pip install "patchworks[cellpose]" # Cellpose plugin
|
|
90
103
|
pip install "patchworks[bioio]" # convert any image format to OME-ZARR
|
|
104
|
+
pip install "patchworks[imaris]" # convert Imaris .ims files to OME-ZARR
|
|
91
105
|
pip install "patchworks[napari]" # interactive napari viewer plugin
|
|
92
106
|
pip install "patchworks[all]" # Everything (except napari GUI)
|
|
93
107
|
```
|
|
94
108
|
|
|
95
|
-
> `bioio` reads CZI/LIF/ND2/OME-TIFF/…
|
|
96
|
-
>
|
|
97
|
-
>
|
|
109
|
+
> `bioio` reads CZI/LIF/ND2/OME-TIFF/… The `[bioio]` extra bundles the common
|
|
110
|
+
> native readers (`bioio-nd2`, `bioio-ome-tiff`, `bioio-czi`, `bioio-tifffile`,
|
|
111
|
+
> `bioio-lif`) plus `bioio-bioformats`, the Bio-Formats catch-all reader (JVM).
|
|
112
|
+
> `[imaris]` adds native `.ims` support (HDF5, no JVM). Physical pixel
|
|
113
|
+
> calibration is read from the input and written into the OME-ZARR.
|
|
98
114
|
|
|
99
115
|
---
|
|
100
116
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
> Tiled processing of arbitrarily large images — any image, any function.
|
|
9
9
|
|
|
10
10
|
```
|
|
11
|
-
┌──────┬──────┬──────┐ fn(tile) → labels
|
|
11
|
+
┌──────┬──────┬──────┐ fn(tile) → labels ┌──────┬──────┬──────┐
|
|
12
12
|
│ tile │ tile │ tile │ ─────────────────────► │ 1 │ 2 │ 3 │
|
|
13
13
|
├──────┼──────┼──────┤ ├──────┼──────┼──────┤
|
|
14
14
|
│ tile │ tile │ tile │ │ 4 │ 5 │ 6 │ globally
|
|
@@ -35,13 +35,16 @@ Optional extras:
|
|
|
35
35
|
pip install "patchworks[gpu]" # GPU VRAM querying (nvidia-ml-py)
|
|
36
36
|
pip install "patchworks[cellpose]" # Cellpose plugin
|
|
37
37
|
pip install "patchworks[bioio]" # convert any image format to OME-ZARR
|
|
38
|
+
pip install "patchworks[imaris]" # convert Imaris .ims files to OME-ZARR
|
|
38
39
|
pip install "patchworks[napari]" # interactive napari viewer plugin
|
|
39
40
|
pip install "patchworks[all]" # Everything (except napari GUI)
|
|
40
41
|
```
|
|
41
42
|
|
|
42
|
-
> `bioio` reads CZI/LIF/ND2/OME-TIFF/…
|
|
43
|
-
>
|
|
44
|
-
>
|
|
43
|
+
> `bioio` reads CZI/LIF/ND2/OME-TIFF/… The `[bioio]` extra bundles the common
|
|
44
|
+
> native readers (`bioio-nd2`, `bioio-ome-tiff`, `bioio-czi`, `bioio-tifffile`,
|
|
45
|
+
> `bioio-lif`) plus `bioio-bioformats`, the Bio-Formats catch-all reader (JVM).
|
|
46
|
+
> `[imaris]` adds native `.ims` support (HDF5, no JVM). Physical pixel
|
|
47
|
+
> calibration is read from the input and written into the OME-ZARR.
|
|
45
48
|
|
|
46
49
|
---
|
|
47
50
|
|
|
@@ -8,12 +8,11 @@ body = """
|
|
|
8
8
|
- {% if commit.scope %}**{{ commit.scope }}**: {% endif %}{{ commit.message | split(pat="\n") | first }}
|
|
9
9
|
{% endfor %}
|
|
10
10
|
{% endfor %}\
|
|
11
|
-
{%
|
|
12
|
-
{% if contributors | length > 0 %}
|
|
11
|
+
{% if github.contributors | length > 0 %}
|
|
13
12
|
### 👥 Contributors
|
|
14
13
|
|
|
15
|
-
{% for
|
|
16
|
-
|
|
14
|
+
{% for contributor in github.contributors | sort(attribute="username") %}\
|
|
15
|
+
* @{{ contributor.username }}
|
|
17
16
|
{% endfor %}
|
|
18
17
|
{% endif %}\
|
|
19
18
|
"""
|
|
@@ -47,3 +46,7 @@ commit_parsers = [
|
|
|
47
46
|
filter_commits = true
|
|
48
47
|
tag_pattern = "v[0-9].*"
|
|
49
48
|
sort_commits = "oldest"
|
|
49
|
+
|
|
50
|
+
[remote.github]
|
|
51
|
+
owner = "imcf"
|
|
52
|
+
repo = "patchworks"
|
|
@@ -38,19 +38,33 @@ existed.
|
|
|
38
38
|
|
|
39
39
|
## Convert any image to OME-ZARR
|
|
40
40
|
|
|
41
|
-
`to_ome_zarr` accepts a dask/NumPy array, an existing `.zarr` store,
|
|
42
|
-
file format** readable by
|
|
43
|
-
LIF, ND2, OME-TIFF, …). File
|
|
44
|
-
|
|
45
|
-
bounded RAM.
|
|
41
|
+
`to_ome_zarr` accepts a dask/NumPy array, an existing `.zarr` store, an
|
|
42
|
+
**Imaris `.ims`** file, or **any format** readable by
|
|
43
|
+
[bioio](https://github.com/bioio-devs/bioio) (CZI, LIF, ND2, OME-TIFF, …). File
|
|
44
|
+
inputs are read **lazily**.
|
|
46
45
|
|
|
47
46
|
```python
|
|
48
47
|
from patchworks.plugins.ome_zarr import to_ome_zarr
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
to_ome_zarr("scan.
|
|
49
|
+
to_ome_zarr("scan.czi", "scan.zarr", n_levels=5) # via bioio
|
|
50
|
+
to_ome_zarr("scan.ims", "scan.zarr") # Imaris, native HDF5
|
|
52
51
|
```
|
|
53
52
|
|
|
53
|
+
### Pixel calibration
|
|
54
|
+
|
|
55
|
+
The physical voxel size is read from the input — bioio's `physical_pixel_sizes`,
|
|
56
|
+
the Imaris resolution metadata, or an existing OME-ZARR's scale — and written
|
|
57
|
+
into the NGFF `coordinateTransformations` (in micrometers), so calibration is
|
|
58
|
+
preserved regardless of input. Override or supply it for bare arrays with
|
|
59
|
+
`pixel_size={"z": 2.0, "y": 0.32, "x": 0.32}`.
|
|
60
|
+
|
|
61
|
+
### Won't OOM
|
|
62
|
+
|
|
63
|
+
Each pyramid level is built by reading the **previous level back from disk**
|
|
64
|
+
and streaming the downsampled result out through dask with bounded chunks. The
|
|
65
|
+
graph never chains level-on-level and no whole plane/volume is held in RAM, so
|
|
66
|
+
terabyte images convert in bounded memory.
|
|
67
|
+
|
|
54
68
|
!!! note "Install the readers you need"
|
|
55
69
|
`pip install "patchworks[bioio]"` pulls `bioio` plus the `bioio-bioformats`
|
|
56
70
|
catch-all reader (needs a JVM). For speed, add native readers for your
|
|
@@ -22,9 +22,11 @@ theme:
|
|
|
22
22
|
- content.code.annotate
|
|
23
23
|
- content.code.copy
|
|
24
24
|
- content.tabs.link
|
|
25
|
-
- navigation.
|
|
25
|
+
- navigation.expand
|
|
26
|
+
- navigation.sections
|
|
26
27
|
- navigation.top
|
|
27
28
|
- navigation.footer
|
|
29
|
+
- toc.integrate
|
|
28
30
|
- search.highlight
|
|
29
31
|
- search.share
|
|
30
32
|
|
|
@@ -43,15 +43,24 @@ io = ["psutil", "tqdm"]
|
|
|
43
43
|
cellpose = ["cellpose>=3.0"]
|
|
44
44
|
gpu = ["nvidia-ml-py"]
|
|
45
45
|
# bioio enables converting any image format (CZI, LIF, ND2, OME-TIFF, …) to
|
|
46
|
-
# OME-ZARR.
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
# OME-ZARR. Ships the common native readers (faster than going through Java)
|
|
47
|
+
# plus bioio-bioformats, the Bio-Formats catch-all reader (needs a JVM).
|
|
48
|
+
bioio = [
|
|
49
|
+
"bioio",
|
|
50
|
+
"bioio-bioformats",
|
|
51
|
+
"bioio-nd2",
|
|
52
|
+
"bioio-ome-tiff",
|
|
53
|
+
"bioio-czi",
|
|
54
|
+
"bioio-tifffile",
|
|
55
|
+
"bioio-lif",
|
|
56
|
+
]
|
|
57
|
+
# imaris reads .ims files natively (HDF5, no JVM) for OME-ZARR conversion.
|
|
58
|
+
imaris = ["imaris-ims-file-reader"]
|
|
50
59
|
# napari enables the interactive viewer plugin (GUI-heavy, kept out of [all]).
|
|
51
60
|
napari = ["napari[all]"]
|
|
52
61
|
dev = ["pytest", "pytest-cov", "scikit-image", "psutil", "tqdm"]
|
|
53
62
|
docs = ["mkdocs-material>=9.0", "mkdocstrings[python]>=0.24"]
|
|
54
|
-
all = ["patchworks[io,gpu,bioio]", "psutil", "tqdm", "scikit-image"]
|
|
63
|
+
all = ["patchworks[io,gpu,bioio,imaris]", "psutil", "tqdm", "scikit-image"]
|
|
55
64
|
|
|
56
65
|
[project.urls]
|
|
57
66
|
Homepage = "https://github.com/imcf/patchworks"
|
|
@@ -47,8 +47,11 @@ def load_ome_zarr(
|
|
|
47
47
|
(128, 2048, 2048)
|
|
48
48
|
"""
|
|
49
49
|
root = zarr.open_group(str(store_path), mode="r")
|
|
50
|
+
# OME-ZARR 0.5 nests under "ome" key; older stores use "multiscales" directly
|
|
51
|
+
_attrs = dict(root.attrs)
|
|
52
|
+
_ms = _attrs.get("multiscales") or _attrs.get("ome", {}).get("multiscales")
|
|
50
53
|
try:
|
|
51
|
-
path =
|
|
54
|
+
path = _ms[0]["datasets"][level]["path"]
|
|
52
55
|
except (KeyError, IndexError, TypeError) as exc:
|
|
53
56
|
raise ValueError(
|
|
54
57
|
f"Cannot read OME-ZARR multiscales metadata at level {level} "
|
|
@@ -157,8 +160,12 @@ def estimate_empty_tiles(
|
|
|
157
160
|
z_src: Any = None
|
|
158
161
|
if isinstance(image, (str, Path)):
|
|
159
162
|
_root = zarr.open_group(str(image), mode="r")
|
|
163
|
+
_rattr = dict(_root.attrs)
|
|
164
|
+
_rms = _rattr.get("multiscales") or _rattr.get("ome", {}).get(
|
|
165
|
+
"multiscales"
|
|
166
|
+
)
|
|
160
167
|
try:
|
|
161
|
-
_zpath =
|
|
168
|
+
_zpath = _rms[0]["datasets"][level]["path"]
|
|
162
169
|
except (KeyError, IndexError, TypeError) as exc:
|
|
163
170
|
raise ValueError(
|
|
164
171
|
f"Cannot read OME-ZARR multiscales metadata at level {level} "
|