patchworks 3.2.0__tar.gz → 3.4.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.
Files changed (231) hide show
  1. patchworks-3.4.0/.github/workflows/docs.yml +54 -0
  2. {patchworks-3.2.0 → patchworks-3.4.0}/.github/workflows/lint.yml +3 -3
  3. {patchworks-3.2.0 → patchworks-3.4.0}/.github/workflows/test.yml +2 -4
  4. patchworks-3.4.0/.gitignore +22 -0
  5. patchworks-3.4.0/PKG-INFO +208 -0
  6. patchworks-3.4.0/README.md +102 -0
  7. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/io.md +1 -1
  8. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/careamics.md +1 -1
  9. patchworks-3.4.0/docs/api/provenance.md +28 -0
  10. patchworks-3.4.0/docs/assets/logo.svg +11 -0
  11. patchworks-3.4.0/docs/examples/cellpose_2d.md +27 -0
  12. patchworks-3.4.0/docs/examples/cellpose_3d.md +32 -0
  13. patchworks-3.4.0/docs/examples/dog.md +83 -0
  14. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/dog.py +6 -2
  15. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/standalone_merge.md +0 -16
  16. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/stardist.md +2 -19
  17. patchworks-3.4.0/docs/getting_started.md +84 -0
  18. {patchworks-3.2.0 → patchworks-3.4.0}/docs/guide/cli.md +25 -22
  19. patchworks-3.4.0/docs/guide/custom_segmentation.md +109 -0
  20. patchworks-3.4.0/docs/guide/launcher.md +91 -0
  21. patchworks-3.4.0/docs/guide/membrane_cells.md +132 -0
  22. patchworks-3.4.0/docs/guide/merging.md +104 -0
  23. patchworks-3.4.0/docs/guide/ome_zarr_napari.md +102 -0
  24. patchworks-3.4.0/docs/guide/performance.md +65 -0
  25. {patchworks-3.2.0 → patchworks-3.4.0}/docs/guide/review.md +11 -55
  26. patchworks-3.4.0/docs/guide/snakemake.md +290 -0
  27. patchworks-3.4.0/docs/guide/tables.md +66 -0
  28. patchworks-3.4.0/docs/guide/tiling.md +49 -0
  29. patchworks-3.4.0/docs/index.md +47 -0
  30. patchworks-3.4.0/docs/stylesheets/extra.css +64 -0
  31. {patchworks-3.2.0 → patchworks-3.4.0}/mkdocs.yml +16 -15
  32. {patchworks-3.2.0 → patchworks-3.4.0}/pyproject.toml +3 -4
  33. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/__init__.py +11 -2
  34. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_chunks.py +4 -18
  35. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_core.py +3 -17
  36. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_distributed.py +103 -18
  37. patchworks-3.4.0/src/patchworks/_filter.py +315 -0
  38. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_gpu.py +2 -5
  39. patchworks-3.4.0/src/patchworks/_intensity.py +193 -0
  40. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_io.py +23 -10
  41. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_merge.py +425 -62
  42. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_notify.py +94 -1
  43. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_occupancy.py +12 -7
  44. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_postprocess.py +120 -0
  45. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_provenance.py +17 -1
  46. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_relabel.py +1 -4
  47. patchworks-3.4.0/src/patchworks/_relations.py +351 -0
  48. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_review.py +66 -12
  49. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_tables.py +391 -61
  50. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_volume_filter.py +41 -12
  51. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/cli.py +141 -1
  52. patchworks-3.4.0/src/patchworks/plugins/_cellpose_defaults.py +77 -0
  53. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/cellpose.py +141 -8
  54. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/dog.py +173 -21
  55. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/napari.py +259 -72
  56. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/ome_zarr.py +896 -36
  57. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/plantseg.py +323 -20
  58. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/review.py +1 -9
  59. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/watershed.py +38 -3
  60. patchworks-3.4.0/tests/test_cellpose.py +326 -0
  61. patchworks-3.4.0/tests/test_check.py +371 -0
  62. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_core.py +30 -0
  63. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_distributed.py +233 -0
  64. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_dog.py +105 -4
  65. patchworks-3.4.0/tests/test_filter.py +106 -0
  66. patchworks-3.4.0/tests/test_launcher.py +2489 -0
  67. patchworks-3.4.0/tests/test_merge.py +21 -0
  68. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_napari.py +259 -2
  69. patchworks-3.4.0/tests/test_ngff_conformance.py +177 -0
  70. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_notify.py +39 -1
  71. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_ome_zarr.py +152 -3
  72. patchworks-3.4.0/tests/test_plantseg.py +414 -0
  73. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_position.py +105 -7
  74. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_postprocess.py +24 -0
  75. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_pw.py +244 -2
  76. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_relations.py +71 -2
  77. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_review.py +40 -0
  78. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_run_multi.py +1311 -38
  79. patchworks-3.4.0/tests/test_status.py +361 -0
  80. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_tables.py +68 -0
  81. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_volume_filter.py +35 -0
  82. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_watershed.py +19 -0
  83. patchworks-3.4.0/workflow/README.md +28 -0
  84. patchworks-3.4.0/workflow/Snakefile +86 -0
  85. patchworks-3.4.0/workflow/config/common.yaml +24 -0
  86. patchworks-3.4.0/workflow/config/config.yaml +60 -0
  87. patchworks-3.4.0/workflow/config/config_cilia.yaml +41 -0
  88. patchworks-3.4.0/workflow/config/config_cyto.yaml +38 -0
  89. patchworks-3.4.0/workflow/config/config_cyto_plantseg.yaml +38 -0
  90. patchworks-3.4.0/workflow/config/config_nuclei.yaml +36 -0
  91. patchworks-3.4.0/workflow/config/multi.yaml +34 -0
  92. patchworks-3.4.0/workflow/config/multi_plantseg.yaml +18 -0
  93. patchworks-3.4.0/workflow/launcher/README.md +147 -0
  94. patchworks-3.4.0/workflow/launcher/app.py +3811 -0
  95. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/launcher/clusters.yaml +8 -1
  96. patchworks-3.4.0/workflow/launcher/help_text.py +324 -0
  97. patchworks-3.4.0/workflow/launcher/launcher_core.py +2533 -0
  98. patchworks-3.4.0/workflow/launcher/pixi.toml +30 -0
  99. patchworks-3.4.0/workflow/launcher/requirements.txt +4 -0
  100. patchworks-3.4.0/workflow/pixi.toml +108 -0
  101. patchworks-3.4.0/workflow/profile/slurm/config.yaml +52 -0
  102. patchworks-3.4.0/workflow/rules/common.smk +55 -0
  103. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/rules/convert.smk +3 -5
  104. patchworks-3.4.0/workflow/rules/segment.smk +39 -0
  105. patchworks-3.4.0/workflow/scripts/_pw.py +1763 -0
  106. patchworks-3.4.0/workflow/scripts/_src.py +35 -0
  107. patchworks-3.4.0/workflow/scripts/bench_view.py +268 -0
  108. patchworks-3.4.0/workflow/scripts/channels.py +147 -0
  109. patchworks-3.4.0/workflow/scripts/check.py +193 -0
  110. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/scripts/convert.py +1 -5
  111. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/scripts/export_iso.py +55 -8
  112. patchworks-3.4.0/workflow/scripts/fetch_model.py +12 -0
  113. patchworks-3.4.0/workflow/scripts/fetch_models.py +46 -0
  114. patchworks-3.4.0/workflow/scripts/merge.py +374 -0
  115. patchworks-3.4.0/workflow/scripts/prepare_tiles.py +192 -0
  116. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/scripts/relate.py +129 -65
  117. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/scripts/run_multi.py +828 -163
  118. patchworks-3.4.0/workflow/scripts/segment_tile.py +148 -0
  119. patchworks-3.4.0/workflow/scripts/status.py +555 -0
  120. patchworks-3.4.0/workflow/scripts/view.py +133 -0
  121. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/viewer/pixi.toml +5 -7
  122. patchworks-3.2.0/.github/workflows/docs.yml +0 -30
  123. patchworks-3.2.0/.gitignore +0 -14
  124. patchworks-3.2.0/PKG-INFO +0 -483
  125. patchworks-3.2.0/README.md +0 -375
  126. patchworks-3.2.0/docs/api/provenance.md +0 -17
  127. patchworks-3.2.0/docs/examples/cellpose_2d.md +0 -72
  128. patchworks-3.2.0/docs/examples/cellpose_3d.md +0 -78
  129. patchworks-3.2.0/docs/examples/dog.md +0 -243
  130. patchworks-3.2.0/docs/getting_started.md +0 -216
  131. patchworks-3.2.0/docs/guide/custom_segmentation.md +0 -210
  132. patchworks-3.2.0/docs/guide/gpu_distributed.md +0 -129
  133. patchworks-3.2.0/docs/guide/label_relations.md +0 -66
  134. patchworks-3.2.0/docs/guide/launcher.md +0 -252
  135. patchworks-3.2.0/docs/guide/measurements.md +0 -68
  136. patchworks-3.2.0/docs/guide/membrane_cells.md +0 -253
  137. patchworks-3.2.0/docs/guide/merging.md +0 -292
  138. patchworks-3.2.0/docs/guide/ome_zarr_napari.md +0 -292
  139. patchworks-3.2.0/docs/guide/performance.md +0 -126
  140. patchworks-3.2.0/docs/guide/pitfalls.md +0 -126
  141. patchworks-3.2.0/docs/guide/skip_empty.md +0 -134
  142. patchworks-3.2.0/docs/guide/snakemake.md +0 -1164
  143. patchworks-3.2.0/docs/guide/tiling.md +0 -136
  144. patchworks-3.2.0/docs/index.md +0 -102
  145. patchworks-3.2.0/src/patchworks/_relations.py +0 -194
  146. patchworks-3.2.0/tests/test_cellpose.py +0 -73
  147. patchworks-3.2.0/tests/test_launcher.py +0 -299
  148. patchworks-3.2.0/tests/test_plantseg.py +0 -175
  149. patchworks-3.2.0/workflow/README.md +0 -152
  150. patchworks-3.2.0/workflow/Snakefile +0 -74
  151. patchworks-3.2.0/workflow/config/common.yaml +0 -63
  152. patchworks-3.2.0/workflow/config/config.yaml +0 -140
  153. patchworks-3.2.0/workflow/config/config_cilia.yaml +0 -64
  154. patchworks-3.2.0/workflow/config/config_cyto.yaml +0 -58
  155. patchworks-3.2.0/workflow/config/config_cyto_plantseg.yaml +0 -51
  156. patchworks-3.2.0/workflow/config/config_nuclei.yaml +0 -22
  157. patchworks-3.2.0/workflow/config/multi.yaml +0 -98
  158. patchworks-3.2.0/workflow/config/multi_plantseg.yaml +0 -33
  159. patchworks-3.2.0/workflow/launcher/README.md +0 -83
  160. patchworks-3.2.0/workflow/launcher/app.py +0 -739
  161. patchworks-3.2.0/workflow/launcher/launcher_core.py +0 -572
  162. patchworks-3.2.0/workflow/launcher/requirements.txt +0 -3
  163. patchworks-3.2.0/workflow/pixi.toml +0 -203
  164. patchworks-3.2.0/workflow/profile/slurm/config.yaml +0 -150
  165. patchworks-3.2.0/workflow/rules/common.smk +0 -87
  166. patchworks-3.2.0/workflow/rules/segment.smk +0 -52
  167. patchworks-3.2.0/workflow/scripts/_pw.py +0 -837
  168. patchworks-3.2.0/workflow/scripts/fetch_model.py +0 -21
  169. patchworks-3.2.0/workflow/scripts/merge.py +0 -315
  170. patchworks-3.2.0/workflow/scripts/prepare_tiles.py +0 -232
  171. patchworks-3.2.0/workflow/scripts/segment_tile.py +0 -113
  172. patchworks-3.2.0/workflow/scripts/view.py +0 -68
  173. {patchworks-3.2.0 → patchworks-3.4.0}/.github/min-versions.txt +0 -0
  174. {patchworks-3.2.0 → patchworks-3.4.0}/.github/workflows/release.yml +0 -0
  175. {patchworks-3.2.0 → patchworks-3.4.0}/.markdownlint-cli2.yaml +0 -0
  176. {patchworks-3.2.0 → patchworks-3.4.0}/.pre-commit-config.yaml +0 -0
  177. {patchworks-3.2.0 → patchworks-3.4.0}/LICENSE +0 -0
  178. {patchworks-3.2.0 → patchworks-3.4.0}/benchmarks/bench.py +0 -0
  179. {patchworks-3.2.0 → patchworks-3.4.0}/benchmarks/compare.py +0 -0
  180. {patchworks-3.2.0 → patchworks-3.4.0}/cliff.toml +0 -0
  181. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/chunks.md +0 -0
  182. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/cluster.md +0 -0
  183. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/merge_tile_labels.md +0 -0
  184. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/cellpose.md +0 -0
  185. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/dog.md +0 -0
  186. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/napari.md +0 -0
  187. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/ome_zarr.md +0 -0
  188. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/plantseg.md +0 -0
  189. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/plugins/watershed.md +0 -0
  190. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/postprocess.md +0 -0
  191. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/relabel.md +0 -0
  192. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/review.md +0 -0
  193. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/seams.md +0 -0
  194. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/tile_process.md +0 -0
  195. {patchworks-3.2.0 → patchworks-3.4.0}/docs/api/volume_filter.md +0 -0
  196. {patchworks-3.2.0 → patchworks-3.4.0}/docs/assets/logo.png +0 -0
  197. {patchworks-3.2.0 → patchworks-3.4.0}/docs/assets/review_panel.png +0 -0
  198. {patchworks-3.2.0 → patchworks-3.4.0}/docs/assets/review_position.png +0 -0
  199. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/cellpose_2d.py +0 -0
  200. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/cellpose_3d.py +0 -0
  201. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/custom.md +0 -0
  202. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/custom_method.py +0 -0
  203. {patchworks-3.2.0 → patchworks-3.4.0}/docs/examples/stardist_2d.py +0 -0
  204. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_autotune.py +0 -0
  205. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_cluster.py +0 -0
  206. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_progress.py +0 -0
  207. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/_seams.py +0 -0
  208. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/__init__.py +0 -0
  209. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/plugins/careamics.py +0 -0
  210. {patchworks-3.2.0 → patchworks-3.4.0}/src/patchworks/py.typed +0 -0
  211. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.4/image.schema +0 -0
  212. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.4/label.schema +0 -0
  213. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.4/ome.schema +0 -0
  214. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.5/_version.schema +0 -0
  215. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.5/image.schema +0 -0
  216. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.5/label.schema +0 -0
  217. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/0.5/ome.schema +0 -0
  218. {patchworks-3.2.0 → patchworks-3.4.0}/tests/ngff_schemas/README.md +0 -0
  219. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_allocation.py +0 -0
  220. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_autotune.py +0 -0
  221. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_careamics.py +0 -0
  222. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_cli.py +0 -0
  223. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_gpu.py +0 -0
  224. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_occupancy.py +0 -0
  225. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_progress.py +0 -0
  226. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_remote.py +0 -0
  227. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_review_napari.py +0 -0
  228. {patchworks-3.2.0 → patchworks-3.4.0}/tests/test_seams.py +0 -0
  229. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/rules/merge.smk +0 -0
  230. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/scripts/build_occupancy.py +0 -0
  231. {patchworks-3.2.0 → patchworks-3.4.0}/workflow/scripts/reshard_store.py +0 -0
@@ -0,0 +1,54 @@
1
+ name: Deploy docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ # Rebuild after each release so the version shown in the header refreshes.
8
+ release:
9
+ types: [published]
10
+ workflow_dispatch:
11
+
12
+ # Published with GitHub Pages' own deployment (repository settings > Pages >
13
+ # Source: GitHub Actions), not by pushing a gh-pages branch.
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ concurrency:
20
+ group: pages
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: "3.12"
32
+ cache: pip
33
+
34
+ - name: Install docs dependencies
35
+ run: pip install "zensical>=0.0.72" "mkdocstrings[python]>=0.24" .
36
+
37
+ - name: Build
38
+ run: zensical build --clean
39
+
40
+ - uses: actions/configure-pages@v5
41
+
42
+ - uses: actions/upload-pages-artifact@v3
43
+ with:
44
+ path: site
45
+
46
+ deploy:
47
+ needs: build
48
+ runs-on: ubuntu-latest
49
+ environment:
50
+ name: github-pages
51
+ url: ${{ steps.deployment.outputs.page_url }}
52
+ steps:
53
+ - id: deployment
54
+ uses: actions/deploy-pages@v4
@@ -47,10 +47,10 @@ jobs:
47
47
  cache: pip
48
48
 
49
49
  - name: Install docs dependencies
50
- run: pip install "mkdocs-material>=9.0" "mkdocstrings[python]>=0.24" .
50
+ run: pip install "zensical>=0.0.72" "mkdocstrings[python]>=0.24" .
51
51
 
52
- - name: mkdocs build --strict
53
- run: mkdocs build --strict
52
+ - name: zensical build --strict
53
+ run: zensical build --strict
54
54
 
55
55
  mypy:
56
56
  runs-on: ubuntu-latest
@@ -32,11 +32,9 @@ jobs:
32
32
  run: pytest -q --doctest-modules src
33
33
 
34
34
  other-platforms:
35
- # Not yet verified on macOS or Windows (no CI ran there before), so this
36
- # job reports without failing the build; promote it into the matrix
37
- # above once it is green.
35
+ # Green on macOS and Windows since 2026-10-07: a failure there now fails
36
+ # the build like any other.
38
37
  runs-on: ${{ matrix.os }}
39
- continue-on-error: true
40
38
  strategy:
41
39
  fail-fast: false
42
40
  matrix:
@@ -0,0 +1,22 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ site/
8
+ .pytest_cache/
9
+ *.log
10
+ .snakemake/
11
+ .pixi/
12
+
13
+ # graft's local graph cache — regenerable, not committed (run `graft build`).
14
+ graft/
15
+
16
+ # Your own run configs (workflow/config/local/), and what the web launcher
17
+ # writes into the workflow folder.
18
+ workflow/config/local/
19
+ workflow/config/templates/
20
+ workflow/config/launcher_*
21
+ workflow/.streamlit_launcher_logs/
22
+ .cache/
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.5
2
+ Name: patchworks
3
+ Version: 3.4.0
4
+ Summary: Tiled processing of arbitrarily large images with globally consistent labels
5
+ Project-URL: Homepage, https://github.com/imcf/patchworks
6
+ Project-URL: Issues, https://github.com/imcf/patchworks/issues
7
+ Author-email: Laurent Guerard <laurent.guerard@unibas.ch>
8
+ License: GPL-3.0-only
9
+ License-File: LICENSE
10
+ Keywords: bioimage,chunked,dask,image processing,segmentation,tiling,zarr
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: dask[array]>=2024.10.0
22
+ Requires-Dist: numpy>=1.26
23
+ Requires-Dist: psutil
24
+ Requires-Dist: scipy>=1.11
25
+ Requires-Dist: zarr>=3.1.3
26
+ Provides-Extra: all
27
+ Requires-Dist: bioio; extra == 'all'
28
+ Requires-Dist: bioio-bioformats; extra == 'all'
29
+ Requires-Dist: bioio-czi; extra == 'all'
30
+ Requires-Dist: bioio-lif; extra == 'all'
31
+ Requires-Dist: bioio-nd2; extra == 'all'
32
+ Requires-Dist: bioio-ome-tiff; extra == 'all'
33
+ Requires-Dist: bioio-tifffile; extra == 'all'
34
+ Requires-Dist: dask[diagnostics,distributed]; extra == 'all'
35
+ Requires-Dist: imaris-ims-file-reader; extra == 'all'
36
+ Requires-Dist: ipykernel<7; extra == 'all'
37
+ Requires-Dist: lxml-html-clean; extra == 'all'
38
+ Requires-Dist: napari-chunked-regionprops>=0.1.0; extra == 'all'
39
+ Requires-Dist: napari[all]>=0.7.1; extra == 'all'
40
+ Requires-Dist: numpy<2.5; extra == 'all'
41
+ Requires-Dist: nvidia-ml-py; extra == 'all'
42
+ Requires-Dist: psutil; extra == 'all'
43
+ Requires-Dist: pyqt6<6.10; extra == 'all'
44
+ Requires-Dist: scikit-image; extra == 'all'
45
+ Requires-Dist: tqdm; extra == 'all'
46
+ Provides-Extra: bioio
47
+ Requires-Dist: bioio; extra == 'bioio'
48
+ Requires-Dist: bioio-bioformats; extra == 'bioio'
49
+ Requires-Dist: bioio-czi; extra == 'bioio'
50
+ Requires-Dist: bioio-lif; extra == 'bioio'
51
+ Requires-Dist: bioio-nd2; extra == 'bioio'
52
+ Requires-Dist: bioio-ome-tiff; extra == 'bioio'
53
+ Requires-Dist: bioio-tifffile; extra == 'bioio'
54
+ Provides-Extra: careamics
55
+ Requires-Dist: careamics>=0.3; extra == 'careamics'
56
+ Provides-Extra: cellpose
57
+ Requires-Dist: cellpose>=3.0; extra == 'cellpose'
58
+ Provides-Extra: cellpose3
59
+ Requires-Dist: cellpose<4,>=3.0; extra == 'cellpose3'
60
+ Provides-Extra: cellpose4
61
+ Requires-Dist: cellpose>=4; extra == 'cellpose4'
62
+ Provides-Extra: dev
63
+ Requires-Dist: jsonschema>=4.18; extra == 'dev'
64
+ Requires-Dist: mypy>=1.10; extra == 'dev'
65
+ Requires-Dist: openpyxl; extra == 'dev'
66
+ Requires-Dist: pandas>=2.0; extra == 'dev'
67
+ Requires-Dist: psutil; extra == 'dev'
68
+ Requires-Dist: pytest; extra == 'dev'
69
+ Requires-Dist: pytest-cov; extra == 'dev'
70
+ Requires-Dist: ruff==0.15.18; extra == 'dev'
71
+ Requires-Dist: scikit-image; extra == 'dev'
72
+ Requires-Dist: tqdm; extra == 'dev'
73
+ Provides-Extra: distributed
74
+ Requires-Dist: dask[diagnostics,distributed]; extra == 'distributed'
75
+ Provides-Extra: docs
76
+ Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
77
+ Requires-Dist: zensical>=0.0.72; extra == 'docs'
78
+ Provides-Extra: dog
79
+ Requires-Dist: pycudadecon; extra == 'dog'
80
+ Provides-Extra: gpu
81
+ Requires-Dist: nvidia-ml-py; extra == 'gpu'
82
+ Provides-Extra: imaris
83
+ Requires-Dist: imaris-ims-file-reader; extra == 'imaris'
84
+ Provides-Extra: io
85
+ Requires-Dist: psutil; extra == 'io'
86
+ Requires-Dist: tqdm; extra == 'io'
87
+ Provides-Extra: napari
88
+ Requires-Dist: ipykernel<7; extra == 'napari'
89
+ Requires-Dist: lxml-html-clean; extra == 'napari'
90
+ Requires-Dist: napari-chunked-regionprops>=0.1.0; extra == 'napari'
91
+ Requires-Dist: napari[all]>=0.7.1; extra == 'napari'
92
+ Requires-Dist: numpy<2.5; extra == 'napari'
93
+ Requires-Dist: pyqt6<6.10; extra == 'napari'
94
+ Provides-Extra: remote
95
+ Requires-Dist: fsspec[gcs,http,s3]; extra == 'remote'
96
+ Provides-Extra: review
97
+ Requires-Dist: openpyxl; extra == 'review'
98
+ Requires-Dist: pandas>=2.0; extra == 'review'
99
+ Provides-Extra: workflow
100
+ Requires-Dist: openpyxl; extra == 'workflow'
101
+ Requires-Dist: pandas>=2.0; extra == 'workflow'
102
+ Requires-Dist: scikit-image; extra == 'workflow'
103
+ Requires-Dist: snakemake-executor-plugin-slurm>=2.2; extra == 'workflow'
104
+ Requires-Dist: snakemake>=8; extra == 'workflow'
105
+ Description-Content-Type: text/markdown
106
+
107
+ <p align="center">
108
+ <img src="https://raw.githubusercontent.com/imcf/patchworks/main/docs/assets/logo.svg" alt="patchworks logo" width="220">
109
+ </p>
110
+
111
+ # patchworks
112
+
113
+ [![PyPI](https://img.shields.io/pypi/v/patchworks.svg)](https://pypi.org/project/patchworks/)
114
+ [![Python versions](https://img.shields.io/pypi/pyversions/patchworks.svg)](https://pypi.org/project/patchworks/)
115
+ [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
116
+ [![Docs](https://img.shields.io/badge/docs-imcf.one%2Fpatchworks-blue)](https://imcf.one/patchworks/)
117
+
118
+ > Tiled processing of arbitrarily large images — any image, any function.
119
+
120
+ ```text
121
+ ┌──────┬──────┬──────┐ fn(tile) → labels ┌──────┬──────┬──────┐
122
+ │ tile │ tile │ tile │ ─────────────────────► │ 1 │ 2 │ 3 │
123
+ ├──────┼──────┼──────┤ ├──────┼──────┼──────┤
124
+ │ tile │ tile │ tile │ │ 4 │ 5 │ 6 │ globally
125
+ ├──────┼──────┼──────┤ ├──────┼──────┼──────┤ consistent
126
+ │ tile │ tile │ tile │ │ 7 │ 8 │ 9 │ labels
127
+ └──────┴──────┴──────┘ └──────┴──────┴──────┘
128
+ ```
129
+
130
+ patchworks splits an image too large for memory into tiles, runs **any
131
+ segmentation function** on each tile, and stitches the results into one
132
+ consistent label image — stored with the image in a single OME-Zarr, with a
133
+ table of every object.
134
+
135
+ > [!NOTE]
136
+ > **On how this was written.** Large parts of patchworks were vibe coded —
137
+ > written with heavy LLM assistance rather than line by line. It is covered by
138
+ > a test suite and has been run on real data, so it is not untested, but the
139
+ > usual caveats apply: read the code before you trust it with anything
140
+ > irreplaceable, and please open an issue if something looks off.
141
+
142
+ ## Install
143
+
144
+ ```bash
145
+ pip install patchworks # core
146
+ pip install "patchworks[cellpose]" # + Cellpose
147
+ pip install "patchworks[bioio,imaris]" # + converting CZI/LIF/ND2/TIFF/.ims to OME-Zarr
148
+ pip install "patchworks[napari]" # + viewing and reviewing in napari
149
+ pip install "patchworks[all]" # everything above and more
150
+ ```
151
+
152
+ GPU options of the DoG plugin need `cupy` matching your CUDA version
153
+ (`pip install cupy-cuda12x`). PlantSeg is on conda-forge only. See
154
+ [Getting started](https://imcf.one/patchworks/getting_started/) for every
155
+ extra.
156
+
157
+ ## Three ways to use it
158
+
159
+ **Python** — any function from a tile to labels:
160
+
161
+ ```python
162
+ from patchworks import tile_process
163
+ from patchworks.plugins.cellpose import cellpose_fn
164
+
165
+ tile_process("scan.zarr", cellpose_fn("cyto3", gpu=True, diameter=30))
166
+ ```
167
+
168
+ The labels go into `scan.zarr/labels/labels`, as a multiscale pyramid next
169
+ to the image.
170
+
171
+ **Command line** — the same building blocks, no script:
172
+
173
+ ```bash
174
+ patchworks convert scan.czi scan.zarr
175
+ patchworks segment scan.zarr --method cellpose --model cyto3 --diameter 30 --gpu
176
+ patchworks view scan.zarr
177
+ ```
178
+
179
+ **On a cluster** — a Snakemake workflow with a pixi environment: convert,
180
+ segment tile batches as GPU jobs, merge, relate label images (which cell
181
+ each nucleus is in), and bundle, from one YAML config per segmentation:
182
+
183
+ ```bash
184
+ cd workflow
185
+ pixi run multi-slurm --config my_multi.yaml
186
+ ```
187
+
188
+ ## What you get
189
+
190
+ - **One OME-Zarr** holding the image and every label image, readable by
191
+ napari, Fiji and any OME-Zarr tool.
192
+ - **Object tables** — size, position, shape — and **relations** between label
193
+ images (the cell of each nucleus, the position of each cilium in its cell),
194
+ exported as spreadsheets.
195
+ - **Review in napari**: `patchworks review scan.zarr` steps through the
196
+ objects most likely to be wrong; corrections flow into the tables.
197
+ - Plugins for **Cellpose**, **PlantSeg**, a **nuclei-seeded watershed**,
198
+ **difference of Gaussians** (cilia, spots) and **Noise2Void** denoising —
199
+ or bring your own function.
200
+
201
+ ## Documentation
202
+
203
+ **<https://imcf.one/patchworks/>** — getting started, the cluster workflow,
204
+ guides, examples and the API reference.
205
+
206
+ ## License
207
+
208
+ GNU General Public License v3.0 (GPL-3.0). See [LICENSE](LICENSE).
@@ -0,0 +1,102 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/imcf/patchworks/main/docs/assets/logo.svg" alt="patchworks logo" width="220">
3
+ </p>
4
+
5
+ # patchworks
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/patchworks.svg)](https://pypi.org/project/patchworks/)
8
+ [![Python versions](https://img.shields.io/pypi/pyversions/patchworks.svg)](https://pypi.org/project/patchworks/)
9
+ [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
10
+ [![Docs](https://img.shields.io/badge/docs-imcf.one%2Fpatchworks-blue)](https://imcf.one/patchworks/)
11
+
12
+ > Tiled processing of arbitrarily large images — any image, any function.
13
+
14
+ ```text
15
+ ┌──────┬──────┬──────┐ fn(tile) → labels ┌──────┬──────┬──────┐
16
+ │ tile │ tile │ tile │ ─────────────────────► │ 1 │ 2 │ 3 │
17
+ ├──────┼──────┼──────┤ ├──────┼──────┼──────┤
18
+ │ tile │ tile │ tile │ │ 4 │ 5 │ 6 │ globally
19
+ ├──────┼──────┼──────┤ ├──────┼──────┼──────┤ consistent
20
+ │ tile │ tile │ tile │ │ 7 │ 8 │ 9 │ labels
21
+ └──────┴──────┴──────┘ └──────┴──────┴──────┘
22
+ ```
23
+
24
+ patchworks splits an image too large for memory into tiles, runs **any
25
+ segmentation function** on each tile, and stitches the results into one
26
+ consistent label image — stored with the image in a single OME-Zarr, with a
27
+ table of every object.
28
+
29
+ > [!NOTE]
30
+ > **On how this was written.** Large parts of patchworks were vibe coded —
31
+ > written with heavy LLM assistance rather than line by line. It is covered by
32
+ > a test suite and has been run on real data, so it is not untested, but the
33
+ > usual caveats apply: read the code before you trust it with anything
34
+ > irreplaceable, and please open an issue if something looks off.
35
+
36
+ ## Install
37
+
38
+ ```bash
39
+ pip install patchworks # core
40
+ pip install "patchworks[cellpose]" # + Cellpose
41
+ pip install "patchworks[bioio,imaris]" # + converting CZI/LIF/ND2/TIFF/.ims to OME-Zarr
42
+ pip install "patchworks[napari]" # + viewing and reviewing in napari
43
+ pip install "patchworks[all]" # everything above and more
44
+ ```
45
+
46
+ GPU options of the DoG plugin need `cupy` matching your CUDA version
47
+ (`pip install cupy-cuda12x`). PlantSeg is on conda-forge only. See
48
+ [Getting started](https://imcf.one/patchworks/getting_started/) for every
49
+ extra.
50
+
51
+ ## Three ways to use it
52
+
53
+ **Python** — any function from a tile to labels:
54
+
55
+ ```python
56
+ from patchworks import tile_process
57
+ from patchworks.plugins.cellpose import cellpose_fn
58
+
59
+ tile_process("scan.zarr", cellpose_fn("cyto3", gpu=True, diameter=30))
60
+ ```
61
+
62
+ The labels go into `scan.zarr/labels/labels`, as a multiscale pyramid next
63
+ to the image.
64
+
65
+ **Command line** — the same building blocks, no script:
66
+
67
+ ```bash
68
+ patchworks convert scan.czi scan.zarr
69
+ patchworks segment scan.zarr --method cellpose --model cyto3 --diameter 30 --gpu
70
+ patchworks view scan.zarr
71
+ ```
72
+
73
+ **On a cluster** — a Snakemake workflow with a pixi environment: convert,
74
+ segment tile batches as GPU jobs, merge, relate label images (which cell
75
+ each nucleus is in), and bundle, from one YAML config per segmentation:
76
+
77
+ ```bash
78
+ cd workflow
79
+ pixi run multi-slurm --config my_multi.yaml
80
+ ```
81
+
82
+ ## What you get
83
+
84
+ - **One OME-Zarr** holding the image and every label image, readable by
85
+ napari, Fiji and any OME-Zarr tool.
86
+ - **Object tables** — size, position, shape — and **relations** between label
87
+ images (the cell of each nucleus, the position of each cilium in its cell),
88
+ exported as spreadsheets.
89
+ - **Review in napari**: `patchworks review scan.zarr` steps through the
90
+ objects most likely to be wrong; corrections flow into the tables.
91
+ - Plugins for **Cellpose**, **PlantSeg**, a **nuclei-seeded watershed**,
92
+ **difference of Gaussians** (cilia, spots) and **Noise2Void** denoising —
93
+ or bring your own function.
94
+
95
+ ## Documentation
96
+
97
+ **<https://imcf.one/patchworks/>** — getting started, the cluster workflow,
98
+ guides, examples and the API reference.
99
+
100
+ ## License
101
+
102
+ GNU General Public License v3.0 (GPL-3.0). See [LICENSE](LICENSE).
@@ -8,7 +8,7 @@
8
8
  tile, so it can miss signal at a tile's edge. `build_occupancy_map` +
9
9
  `tile_occupancy` are **exact**: a brick maximum exceeds the threshold exactly
10
10
  when some voxel in that brick does. Use the latter pair when the result is
11
- used as a skip list. See [Skipping empty tiles](../guide/skip_empty.md).
11
+ used as a skip list. See [Skipping empty tiles](../guide/performance.md#skip-empty-tiles).
12
12
 
13
13
  ::: patchworks.estimate_empty_tiles
14
14
 
@@ -1,6 +1,6 @@
1
1
  # CAREamics denoising plugin
2
2
 
3
- See [Denoising first](../../guide/membrane_cells.md#denoising-first-careamics).
3
+ See [Denoising first](../../guide/membrane_cells.md#denoising-first).
4
4
 
5
5
  ::: patchworks.plugins.careamics.denoise_fn
6
6
 
@@ -0,0 +1,28 @@
1
+ # Provenance
2
+
3
+ Every label image patchworks writes records how it was made: the
4
+ segmentation function and its bound settings, tiling, overlap, stitching,
5
+ level, channel, codec, the input, the library versions (including the
6
+ segmentation tool's: Cellpose, PlantSeg, torch, ...) and a UTC timestamp.
7
+ It sits in the label group's attrs under `"patchworks"` (for `write_to=`
8
+ stores, on the labels array), so it travels with the data.
9
+
10
+ The cluster workflow stores its whole effective config (everything but the
11
+ email settings), plus what was only decided at run time under `resolved`
12
+ (tiles segmented, the empty threshold, the intensity range and thresholds
13
+ measured for the image, the size filter in voxels, the object count, and
14
+ for Cellpose the defaults it filled in) and the [seam report](../guide/merging.md#checking-the-seams)
15
+ ratios under `seams`.
16
+
17
+ ```python
18
+ from patchworks import read_provenance
19
+
20
+ rec = read_provenance("scan.zarr/labels/cilia_labels")
21
+ rec["settings"]["custom"] # the method's settings
22
+ rec["settings"]["resolved"] # tiles, empty threshold, object count
23
+ rec["seams"] # seam vs interior orphan rate per axis
24
+ ```
25
+
26
+ ::: patchworks.read_provenance
27
+
28
+ ::: patchworks.provenance
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 765" width="700" height="765" role="img" aria-label="patchworks: a sewing machine">
2
+ <title>patchworks</title>
3
+ <g fill="none" stroke="#a83f7a" stroke-width="11.2" stroke-linecap="round" stroke-linejoin="round">
4
+ <path d="M167.8,88.3C194.0,86.7 214.4,97.5 231.7,101.6C249.1,105.7 273.2,120.3 295.7,126.1C318.2,132.0 342.5,133.1 365.2,128.1C387.9,123.1 407.1,110.3 421.7,100.3C436.3,90.2 476.3,71.8 489.7,76.0"/>
5
+ <path d="M144.5,84.8C138.5,85.0 123.6,86.0 117.9,87.3C112.3,88.5 106.8,90.2 101.6,92.3C96.4,94.4 91.4,96.9 86.7,99.8C82.0,102.7 77.6,106.0 73.5,109.6C69.5,113.1 65.7,117.0 62.4,121.2C59.0,125.4 56.0,129.8 53.4,134.4C50.9,139.0 48.6,143.9 46.8,148.8C44.9,153.8 43.4,159.0 42.3,164.2C41.1,169.5 40.3,174.8 39.8,180.2C39.3,185.6 39.2,191.0 39.3,196.4C39.4,201.8 39.9,207.2 40.5,212.6C41.2,218.0 42.2,223.3 43.3,228.6C44.4,234.0 45.7,239.2 47.2,244.5C48.7,249.8 50.2,255.0 51.9,260.3C53.6,265.5 55.3,270.7 57.1,275.9C58.8,281.1 60.6,286.2 62.3,291.4C64.0,296.5 65.7,301.7 67.2,306.8C68.8,311.9 70.3,317.0 71.6,322.1C72.9,327.1 74.0,332.2 74.9,337.2C75.8,342.3 77.3,357.3 77.7,362.3"/>
6
+ <path d="M100.5,461.9C99.3,468.7 99.1,475.8 99.9,482.8C100.6,489.9 102.3,496.9 104.8,503.4C107.4,510.0 110.8,516.1 115.2,521.5C119.6,526.8 124.8,531.2 130.9,534.5C137.1,537.8 148.1,540.0 155.9,540.5"/>
7
+ </g>
8
+ <path fill="#384144" fill-rule="evenodd" d="M34.9,763.4C33.0,761.1 32.6,751.7 34.0,743.6C38.6,717.6 58.5,702.2 87.8,702.0L95.0,702.0L95.0,698.5C95.0,686.7 103.0,682.3 140.0,673.5C148.5,671.4 165.6,667.3 178.0,664.4C203.3,658.3 204.7,658.2 210.6,661.0C225.1,668.1 228.7,687.7 217.7,699.8L215.6,702.0L302.0,701.8L388.3,701.5L392.0,689.2L395.7,677.0L390.6,677.7C387.8,678.1 376.9,678.5 366.5,678.5C307.7,678.4 231.1,652.5 197.9,621.4L195.4,619.0L109.4,618.9C8.4,618.9 11.6,619.1 5.2,612.7L0.5,608.0L0.2,594.1L-0.1,580.3L5.3,574.4L10.8,568.5L193.6,568.0C294.2,567.7 376.6,567.3 376.8,567.2C377.0,567.1 377.0,547.1 376.8,522.8C376.5,472.5 376.3,473.7 385.0,465.0C392.2,457.8 398.5,455.6 411.9,455.6L423.3,455.6L428.1,445.6C437.6,425.6 448.2,391.4 452.6,367.0C458.6,333.5 450.8,308.4 431.5,299.4C409.4,289.1 334.9,282.9 282.5,287.0C255.7,289.1 239.6,297.9 233.4,313.6C223.1,339.8 214.3,349.7 196.8,354.6L190.0,356.5L190.0,365.6L190.0,374.8L201.8,376.9C232.9,382.7 255.2,387.8 257.9,389.8C268.2,397.5 267.2,413.1 255.8,420.0L253.1,421.6L261.2,435.6C272.6,455.3 274.0,458.4 274.0,465.3C274.0,484.5 251.2,498.7 236.4,488.8C229.0,483.8 224.5,476.9 203.6,438.7L199.8,431.9L193.2,432.6C189.5,432.9 186.3,433.4 186.1,433.6C185.8,433.9 185.4,445.6 185.2,459.8C184.8,485.1 184.7,485.6 182.2,490.3C179.9,494.5 171.1,504.0 168.4,505.1C167.8,505.3 166.7,513.5 165.9,523.9L164.4,542.3L160.6,545.7C155.5,550.4 152.8,549.2 155.4,543.2C156.2,541.4 155.9,540.5 153.7,538.2C152.2,536.6 151.0,534.7 151.0,533.8C151.0,532.9 150.5,532.0 149.8,531.8C149.1,531.5 148.3,526.7 147.7,519.1L146.7,506.8L138.1,498.5L129.5,490.2L129.2,459.3L128.9,428.4L122.8,425.7C115.4,422.5 116.1,422.0 107.9,435.6C89.6,465.9 85.6,470.9 77.3,474.0C70.6,476.5 69.4,476.5 62.4,473.9C51.8,469.9 42.8,458.7 42.7,449.1C42.7,443.7 44.7,439.4 60.4,412.1L70.9,393.7L66.2,390.2C53.4,380.6 50.3,374.7 53.0,364.8C55.0,357.8 64.7,349.7 68.8,351.6C69.8,352.0 70.7,352.4 71.0,352.5C71.3,352.6 72.7,353.2 74.1,353.7C77.3,355.1 83.2,355.6 84.7,354.7C85.3,354.3 90.7,354.9 96.7,356.0C117.7,360.0 123.0,361.1 124.5,361.6C125.5,362.0 126.0,361.6 126.0,360.2C126.0,359.1 126.2,357.5 126.6,356.7C127.0,355.7 125.5,354.8 120.8,353.5C104.2,348.9 94.1,337.7 90.8,320.5C89.1,311.1 89.0,155.9 90.8,146.2C94.2,127.5 107.0,114.8 124.7,112.5C127.3,112.2 131.0,111.7 132.8,111.4L136.2,110.9L136.0,102.2C136.0,97.4 136.2,90.4 136.6,86.6C137.0,82.2 136.8,78.4 136.0,76.1C131.5,62.5 145.0,52.7 163.9,56.0C174.9,57.8 177.5,60.5 177.2,69.6C176.9,81.7 177.0,93.2 177.6,103.1L178.1,112.7L185.4,113.3C197.4,114.2 199.3,115.6 226.5,144.1C245.2,163.6 271.7,168.9 317.5,162.1C325.8,160.9 337.4,159.3 343.5,158.5C349.6,157.6 365.3,154.9 378.5,152.5C391.7,150.0 410.6,146.7 420.5,145.1C430.4,143.4 445.7,140.8 454.5,139.1C524.3,126.1 543.0,125.3 571.8,133.6C595.5,140.5 617.1,159.0 630.9,184.2L635.2,192.0L644.6,192.0L654.0,192.0L654.0,176.5C654.0,158.9 654.3,157.9 661.2,151.4C673.3,139.7 690.8,142.5 698.6,157.2C700.7,161.2 700.7,318.8 698.6,322.8C690.6,338.1 671.5,339.9 658.5,326.4L654.2,322.0L653.5,308.5L652.8,295.0L648.4,295.0L644.1,295.0L643.8,323.2C643.6,338.8 643.6,374.7 643.8,403.1L644.1,454.7L650.8,455.4C667.4,457.1 675.0,464.0 675.0,477.4C675.0,489.6 666.4,496.7 649.2,498.5C643.9,499.1 642.9,499.5 642.5,501.3C642.2,502.5 641.3,506.8 640.5,510.9C634.5,540.1 615.3,574.4 591.0,599.4C583.0,607.6 570.1,619.2 567.3,620.5C566.9,620.7 579.6,654.3 589.0,678.1L598.4,701.7L612.5,702.3C633.0,703.3 643.3,707.1 652.8,717.4C662.9,728.4 669.8,754.6 664.6,762.5L663.0,765.0L349.6,765.0C66.9,765.0 36.1,764.8 34.9,763.4ZM498.1,623.5C522.7,615.1 524.2,582.5 500.5,571.0C481.9,562.0 457.7,582.6 463.4,602.4C468.1,618.6 484.1,628.3 498.1,623.5ZM551.4,269.0C581.5,253.8 570.2,205.7 536.5,205.5C507.0,205.4 493.0,245.0 515.6,264.9C524.3,272.6 540.5,274.4 551.4,269.0ZM475.3,120.3C463.8,118.0 466.4,96.8 477.9,98.5C483.9,99.4 567.3,99.5 572.5,98.5C582.5,96.8 587.4,110.6 579.4,118.1L576.8,120.5L527.2,120.6C499.9,120.7 476.5,120.6 475.3,120.3ZM474.2,19.9C469.9,18.2 467.7,14.3 468.2,9.0C469.2,-0.7 464.8,0.0 525.0,0.0L577.7,0.0L579.8,2.3C584.6,7.4 584.4,13.7 579.2,18.3C577.1,20.2 478.8,21.6 474.2,19.9Z"/>
9
+ <path fill="#19b4ab" fill-rule="evenodd" d="M351.0,645.3C336.7,644.4 323.2,642.4 313.0,640.0C289.5,634.2 252.9,620.6 254.4,618.2C254.7,617.7 281.6,617.0 314.2,616.7C386.1,616.0 385.2,616.1 395.9,604.4C408.1,591.1 409.0,586.2 409.6,536.5L410.1,497.5L509.8,497.2C569.2,497.1 609.8,497.4 610.3,497.9C611.4,499.0 607.7,510.6 601.3,526.5C592.4,548.5 584.7,559.9 567.1,577.4C553.7,590.6 552.6,591.2 551.5,585.7C549.6,577.2 538.1,559.0 529.7,551.4C504.1,528.0 463.3,531.6 442.6,559.1C435.9,568.0 431.1,578.7 423.1,602.6C414.6,628.0 409.4,642.0 408.1,643.3C406.3,645.1 367.4,646.5 351.0,645.3ZM496.5,456.3C477.3,456.1 461.2,455.6 460.8,455.2C460.3,454.7 462.0,448.8 464.6,441.9C486.0,383.7 491.7,337.3 481.0,308.8C472.0,284.8 448.3,267.2 416.0,260.6C381.1,253.5 285.0,251.6 257.3,257.4C232.0,262.8 215.6,277.6 200.6,308.5L193.3,323.7L183.4,324.3C164.7,325.6 133.3,325.1 129.5,323.6C122.0,320.4 122.5,326.5 122.5,232.5C122.5,166.7 122.8,148.0 123.8,146.2C125.1,144.0 125.1,144.0 152.9,144.0L180.8,144.0L185.7,147.8C188.3,149.9 195.5,157.0 201.5,163.4C220.8,184.1 234.4,191.8 260.5,196.6C274.9,199.2 306.2,198.1 328.5,194.0C337.9,192.3 368.2,187.1 396.0,182.4C423.8,177.7 455.8,171.9 467.3,169.4C478.7,167.0 495.3,163.8 504.3,162.4C560.3,153.5 593.7,169.3 608.1,211.5L610.5,218.5L610.5,337.5L610.5,456.5L571.0,456.5C549.3,456.5 515.8,456.4 496.5,456.3ZM546.2,290.9C603.5,279.2 601.7,196.9 543.9,187.9C509.5,182.6 478.5,214.4 485.4,248.0C491.5,277.6 518.5,296.6 546.2,290.9Z"/>
10
+ <g fill="#a83f7a"><rect x="481" y="20" width="86" height="80" rx="5"/><circle cx="536.1" cy="238.6" r="33.0"/><circle cx="489.8" cy="596.3" r="28.2"/></g>
11
+ </svg>
@@ -0,0 +1,27 @@
1
+ # Cellpose 2-D
2
+
3
+ Segment every z-slice independently: each tile is one plane `(1, y, x)`.
4
+
5
+ ```bash
6
+ pip install "patchworks[cellpose,gpu]"
7
+ ```
8
+
9
+ ```python
10
+ from functools import partial
11
+ from patchworks import auto_tile_shape_cellpose, tile_process
12
+ from patchworks.plugins.cellpose import cellpose_fn
13
+
14
+ tile_process(
15
+ "image.zarr",
16
+ cellpose_fn("cyto3", gpu=True, diameter=30),
17
+ channel=0,
18
+ tile_shape=partial(auto_tile_shape_cellpose, diameter=30, use_gpu=True), # fits the VRAM
19
+ overlap=20, # about one cell diameter
20
+ skip_empty=True,
21
+ )
22
+ ```
23
+
24
+ Cellpose arguments not listed in `cellpose_fn`'s signature (`flow_threshold`,
25
+ `cellprob_threshold`, ...) are passed through. A cyto stain with a nuclear
26
+ channel: on the cluster, set `nuclei_channel:`
27
+ ([Options worth knowing](../guide/snakemake.md#options-worth-knowing)).
@@ -0,0 +1,32 @@
1
+ # Cellpose 3-D
2
+
3
+ `do_3D=True` segments the xy, xz and yz planes and combines them, so each
4
+ tile holds a block of z as well. It is slower than 2-D: skip empty tiles.
5
+
6
+ ```python
7
+ from functools import partial
8
+ from patchworks import auto_tile_shape_cellpose, tile_process
9
+ from patchworks.plugins.cellpose import cellpose_fn
10
+ from patchworks.plugins.ome_zarr import read_pixel_size
11
+
12
+ fn = cellpose_fn(
13
+ "cyto3",
14
+ gpu=True,
15
+ do_3D=True,
16
+ diameter=20,
17
+ voxel_size=read_pixel_size("image.zarr"), # anisotropy = z / lateral
18
+ )
19
+
20
+ tile_process(
21
+ "image.zarr",
22
+ fn,
23
+ channel=0,
24
+ tile_shape=partial(auto_tile_shape_cellpose, do_3D=True, use_gpu=True, diameter=20),
25
+ overlap=[4, 20, 20],
26
+ skip_empty=True,
27
+ )
28
+ ```
29
+
30
+ Without `voxel_size` (or `anisotropy=`), Cellpose assumes isotropic voxels
31
+ and fragments objects along z. The cluster workflow passes the calibration
32
+ by itself ([Configure](../guide/snakemake.md#2-configure)).
@@ -0,0 +1,83 @@
1
+ # Difference of Gaussians (spots, cilia, fibres)
2
+
3
+ For small structures Cellpose is not made for: blur at two sigmas, subtract,
4
+ threshold, label. CPU by default, GPU with `use_gpu=True` (needs `cupy`);
5
+ optionally deconvolve each tile first with
6
+ [pycudadecon](https://github.com/tlambert03/pycudadecon)
7
+ (`pip install "patchworks[dog]"`, CUDA only).
8
+
9
+ > Cilia DoG + deconvolution approach courtesy of
10
+ > [angelo-angonezi](https://github.com/angelo-angonezi).
11
+
12
+ ```python
13
+ from patchworks import tile_process
14
+ from patchworks.plugins.dog import dog_label_fn
15
+
16
+ from patchworks import intensity_range
17
+
18
+ rng = intensity_range("image.zarr", 1, percentiles=(1, 99.9))[0]
19
+ fn = dog_label_fn(low_sigma=1.0, high_sigma=3.0, threshold=0.05, intensity_range=rng)
20
+ tile_process("image.zarr", fn, channel=1, tile_shape=(16, 1024, 1024), overlap=[4, 8, 8])
21
+ ```
22
+
23
+ ## Parameters
24
+
25
+ - `low_sigma`: about the object's radius; `high_sigma`: a few times larger
26
+ (the background to subtract).
27
+ - `threshold` applies to the DoG image, as a fraction of the channel's
28
+ intensity range (1st to 99.9th percentile), measured once for the whole
29
+ image: the same on every tile, and on 8- or 16-bit data. Too low, and
30
+ background texture joins into a few huge objects (a warning says so).
31
+ With the API, pass the range: `intensity_range=patchworks.intensity_range(
32
+ "image.zarr", 1, percentiles=(1, 99.9))[0]`; without it the threshold is
33
+ in raw counts.
34
+ - `connectivity=3` (3-D) joins voxels touching at an edge or corner, so an
35
+ oblique cilium is one object rather than a row of fragments. With the API,
36
+ pass the same value to `merge_tile_labels`; the workflow does it for you.
37
+ - `dilate_labels(fn, iterations=2)` grows thin labels
38
+ ([Growing labels](../guide/custom_segmentation.md#growing-labels)).
39
+
40
+ ## Deconvolution first
41
+
42
+ ```python
43
+ from patchworks.plugins.ome_zarr import read_pixel_size
44
+
45
+ fn = dog_label_fn(
46
+ low_sigma=1.0, high_sigma=3.0, threshold=0.05,
47
+ decon_kwargs=dict(psf=psf, wavelength=525, na=1.4, nimm=1.515),
48
+ voxel_size=read_pixel_size("image.zarr"), # fills dxdata/dzdata/dxpsf/dzpsf
49
+ )
50
+ ```
51
+
52
+ Anything set in `decon_kwargs` wins, such as `dxpsf`/`dzpsf` for a PSF sampled
53
+ differently from the data. A wrong voxel size does not fail, it gives a
54
+ subtly wrong image, so let it come from the image. Make `overlap` cover the
55
+ PSF as well as `high_sigma`.
56
+
57
+ ## On the cluster
58
+
59
+ `workflow/config/config_cilia.yaml` is a complete example:
60
+
61
+ ```yaml
62
+ channel: 2
63
+ overlap: [8, 30, 30]
64
+ method: "custom"
65
+ label_name: "cilia_labels"
66
+ custom:
67
+ module: "patchworks.plugins.dog"
68
+ kwargs:
69
+ low_sigma: 1.0
70
+ high_sigma: 3.0
71
+ threshold: 0.05 # of the channel's intensity range
72
+ connectivity: 3 # keep oblique cilia whole
73
+ decon_kwargs: # optional; voxel sizes come from the image
74
+ psf: "/path/to/psf.tif"
75
+ wavelength: 525
76
+ na: 1.4
77
+ nimm: 1.515
78
+ max_volume: 10 # µm³: drop texture that joined up
79
+ ```
80
+
81
+ Deconvolution needs a GPU in the segment jobs. List it in a multi config
82
+ next to the cells to get each cilium's cell
83
+ ([Tables and relations](../guide/tables.md#relating-two-label-images)).
@@ -4,14 +4,18 @@ Blur twice at different sigmas, subtract, threshold, label the connected
4
4
  components. CPU (scipy) by default.
5
5
  """
6
6
 
7
- from patchworks import tile_process
7
+ from patchworks import intensity_range, tile_process
8
8
  from patchworks.plugins.dog import dog_label_fn
9
9
 
10
10
  IMAGE = "image.zarr"
11
11
  OUTPUT = "labels_dog.zarr"
12
12
  CHANNEL = 1
13
13
 
14
- fn = dog_label_fn(low_sigma=1.0, high_sigma=3.0, threshold=0.02)
14
+ # The threshold is a fraction of the channel's range, measured once.
15
+ rng = intensity_range(IMAGE, CHANNEL, percentiles=(1, 99.9))[0]
16
+ fn = dog_label_fn(
17
+ low_sigma=1.0, high_sigma=3.0, threshold=0.05, intensity_range=rng
18
+ )
15
19
 
16
20
  tile_process(
17
21
  IMAGE,