ci-deconvolve 0.1.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.
- ci_deconvolve-0.1.0/PKG-INFO +232 -0
- ci_deconvolve-0.1.0/README.md +205 -0
- ci_deconvolve-0.1.0/ci_deconvolve.egg-info/PKG-INFO +232 -0
- ci_deconvolve-0.1.0/ci_deconvolve.egg-info/SOURCES.txt +15 -0
- ci_deconvolve-0.1.0/ci_deconvolve.egg-info/dependency_links.txt +1 -0
- ci_deconvolve-0.1.0/ci_deconvolve.egg-info/entry_points.txt +2 -0
- ci_deconvolve-0.1.0/ci_deconvolve.egg-info/requires.txt +13 -0
- ci_deconvolve-0.1.0/ci_deconvolve.egg-info/top_level.txt +2 -0
- ci_deconvolve-0.1.0/pyproject.toml +46 -0
- ci_deconvolve-0.1.0/setup.cfg +4 -0
- ci_deconvolve-0.1.0/src/ci_deconvolve/__init__.py +3 -0
- ci_deconvolve-0.1.0/src/ci_deconvolve/cli.py +292 -0
- ci_deconvolve-0.1.0/src/core/__init__.py +23 -0
- ci_deconvolve-0.1.0/src/core/_meta_helpers.py +272 -0
- ci_deconvolve-0.1.0/src/core/deconvolve.py +1584 -0
- ci_deconvolve-0.1.0/src/core/deconvolve_ci.py +2200 -0
- ci_deconvolve-0.1.0/src/core/ome_zarr_io.py +258 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ci-deconvolve
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.
|
|
5
|
+
Author: NL-BioImaging contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: microscopy,deconvolution,ome-tiff,ome-zarr,richardson-lucy
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: numpy<3,>=1.26
|
|
16
|
+
Requires-Dist: Pillow>=10.0
|
|
17
|
+
Requires-Dist: tifffile>=2024.1.30
|
|
18
|
+
Requires-Dist: imagecodecs>=2024.1.1
|
|
19
|
+
Requires-Dist: bioio==3.2.0
|
|
20
|
+
Requires-Dist: bioio-ome-tiff==1.4.0
|
|
21
|
+
Requires-Dist: ome-zarr<0.19,>=0.18
|
|
22
|
+
Requires-Dist: numcodecs>=0.14
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest; extra == "dev"
|
|
25
|
+
Requires-Dist: build; extra == "dev"
|
|
26
|
+
Requires-Dist: twine; extra == "dev"
|
|
27
|
+
|
|
28
|
+
# ci-deconvolve
|
|
29
|
+
|
|
30
|
+
Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.
|
|
31
|
+
|
|
32
|
+
This package installs the `ci_deconvolve` command. On Windows, `pip` also
|
|
33
|
+
creates a `ci_deconvolve.exe` console launcher in the active environment.
|
|
34
|
+
|
|
35
|
+
## Prerequisite: PyTorch
|
|
36
|
+
|
|
37
|
+
PyTorch is required but is not bundled in this package. Install the CPU or CUDA
|
|
38
|
+
build that matches your system before running `ci_deconvolve`.
|
|
39
|
+
|
|
40
|
+
Examples:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install torch
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
or install a CUDA build using the command from:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
https://pytorch.org/get-started/locally/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
From this folder during development:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
From PyPI after publishing:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install ci-deconvolve
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The package depends on `ome-zarr` for OME-Zarr reading and writing. `zarr` is
|
|
67
|
+
installed transitively by `ome-zarr`; it is not declared as a direct dependency.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
Run one OME-TIFF file:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
ci_deconvolve --input image.ome.tiff --output out
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Run one OME-Zarr image:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
ci_deconvolve --input image.ome.zarr --output out --output-format ome-zarr
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Run every supported immediate child in a folder:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ci_deconvolve --input in_folder --output out_folder --iterations 40
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Only these inputs are accepted:
|
|
90
|
+
|
|
91
|
+
- `.ome.tif`
|
|
92
|
+
- `.ome.tiff`
|
|
93
|
+
- `.zarr` / `.ome.zarr` directories
|
|
94
|
+
|
|
95
|
+
The CLI always runs `ci_rl`. It intentionally has no `--method` option.
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
101
|
+
--iterations 40 ^
|
|
102
|
+
--device auto ^
|
|
103
|
+
--output-format ome-tiff ^
|
|
104
|
+
--emission-wl 520 ^
|
|
105
|
+
--excitation-wl 488 ^
|
|
106
|
+
--pixel-size-xy 0.065 ^
|
|
107
|
+
--pixel-size-z 0.2
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Use `--overrule-metadata` when CLI metadata values should replace image
|
|
111
|
+
metadata. Without it, CLI metadata values are used as fallbacks.
|
|
112
|
+
|
|
113
|
+
Per-channel values can be comma-separated. If there are more channels than
|
|
114
|
+
values, the last value is reused for the remaining channels.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
118
|
+
--iterations 40,60,80 ^
|
|
119
|
+
--emission-wl 520,610 ^
|
|
120
|
+
--excitation-wl 488,561 ^
|
|
121
|
+
--pinhole-airy 1.0,1.2
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Parameters
|
|
125
|
+
|
|
126
|
+
### Required Paths
|
|
127
|
+
|
|
128
|
+
| Option | Default | Description |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| `input_path` | none | Optional positional input path. Use this or `--input`. |
|
|
131
|
+
| `--input PATH` | none | Input OME-TIFF file, OME-Zarr folder, or folder containing supported inputs. |
|
|
132
|
+
| `--output DIR` | required | Output folder. Created if it does not exist. |
|
|
133
|
+
|
|
134
|
+
Supported inputs are immediate files/folders only:
|
|
135
|
+
|
|
136
|
+
- `.ome.tif`
|
|
137
|
+
- `.ome.tiff`
|
|
138
|
+
- `.zarr` / `.ome.zarr` directories
|
|
139
|
+
|
|
140
|
+
HCS plate OME-Zarr inputs are detected and rejected clearly; this focused CLI
|
|
141
|
+
does not process plate fields.
|
|
142
|
+
|
|
143
|
+
### Output And Compute
|
|
144
|
+
|
|
145
|
+
| Option | Default | Description |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `--output-format ome-tiff\|ome-zarr` | `ome-tiff` | Writes `<stem>_decon.ome.tiff` or `<stem>_decon.ome.zarr`. |
|
|
148
|
+
| `--iterations N[,N...]` | `40` | CI-RL iteration count. A comma- or semicolon-separated list applies per channel, with the last value reused for extra channels. |
|
|
149
|
+
| `--device auto\|cpu\|cuda` | `auto` | Compute device. `auto` lets PyTorch choose CUDA when available, otherwise CPU. |
|
|
150
|
+
| `-v`, `--verbose` | off | Enable INFO logging from the CLI and core deconvolution code. |
|
|
151
|
+
|
|
152
|
+
### CI-RL Solver
|
|
153
|
+
|
|
154
|
+
| Option | Default | Description |
|
|
155
|
+
| --- | --- | --- |
|
|
156
|
+
| `--background VALUE\|auto` | `auto` | Background level used by the solver. `auto` estimates it from the image. Numeric values are accepted. |
|
|
157
|
+
| `--offset VALUE\|auto\|none` | `auto` | Positive offset added before iteration and removed afterwards. Use `none`, `0`, or `0.0` to disable. |
|
|
158
|
+
| `--damping VALUE\|auto\|none` | `none` | Noise-gated damping strength. Use `auto` for automatic damping, numeric values for manual damping, or `none`/`0` to disable. |
|
|
159
|
+
| `--prefilter-sigma VALUE` | `0.0` | Optional Anscombe/low-pass prefilter sigma. `0.0` disables prefiltering. |
|
|
160
|
+
| `--start MODE` | `auto` | Initial estimate mode. Choices: `auto`, `flat`, `percentile_flat`, `observed`, `observed_bgsub`, `lowpass`, `lowpass_bgsub`, `hybrid`. |
|
|
161
|
+
| `--convergence auto\|fixed\|none` | `auto` | `auto` enables early stopping based on convergence. `fixed` and `none` both run the requested iteration count. |
|
|
162
|
+
| `--rel-threshold VALUE` | `0.005` | Relative convergence threshold used when `--convergence auto`. Values are clamped to at least `1e-8`. |
|
|
163
|
+
| `--check-every N` | `5` | Check convergence every N iterations. Values below 1 are clamped to 1. |
|
|
164
|
+
|
|
165
|
+
### Metadata And PSF
|
|
166
|
+
|
|
167
|
+
These values are used to generate the point spread function. By default, image
|
|
168
|
+
metadata wins and CLI values fill in missing metadata. With
|
|
169
|
+
`--overrule-metadata`, CLI values replace image metadata.
|
|
170
|
+
|
|
171
|
+
| Option | Default | Description |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| `--na VALUE` | `1.4` | Numerical aperture. |
|
|
174
|
+
| `--refractive-index VALUE` | `1.515` | Immersion medium refractive index, typically oil. |
|
|
175
|
+
| `--sample-ri VALUE` | `1.47` | Sample medium refractive index. |
|
|
176
|
+
| `--microscope-type widefield\|confocal` | `confocal` | Microscope model used for PSF generation. |
|
|
177
|
+
| `--emission-wl VALUE[,VALUE...]` | `520` | Emission wavelength(s), in nm. Per-channel list supported. |
|
|
178
|
+
| `--excitation-wl VALUE[,VALUE...]` | `488` | Excitation wavelength(s), in nm. Per-channel list supported. |
|
|
179
|
+
| `--pinhole-airy VALUE[,VALUE...]` | `1.0` | Confocal pinhole diameter in Airy units. Per-channel list supported. |
|
|
180
|
+
| `--pixel-size-xy VALUE` | `0.065` | Lateral pixel size in micrometers. Applied to X and Y. |
|
|
181
|
+
| `--pixel-size-z VALUE` | `0.2` | Axial pixel size in micrometers. |
|
|
182
|
+
| `--overrule-metadata` | off | Replace image metadata with CLI metadata values instead of only using CLI values as fallbacks. |
|
|
183
|
+
|
|
184
|
+
List syntax:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
--emission-wl 520,610
|
|
188
|
+
--excitation-wl 488;561
|
|
189
|
+
--iterations 30,40,50
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Commas and semicolons are both accepted.
|
|
193
|
+
|
|
194
|
+
### 2D Widefield Options
|
|
195
|
+
|
|
196
|
+
These only affect 2D widefield data when `--microscope-type widefield` and
|
|
197
|
+
`--two-d-mode auto` are used.
|
|
198
|
+
|
|
199
|
+
| Option | Default | Description |
|
|
200
|
+
| --- | --- | --- |
|
|
201
|
+
| `--two-d-mode auto\|legacy_2d` | `auto` | `auto` enables the enhanced 2D widefield path. `legacy_2d` uses the historical pure-2D PSF behavior. |
|
|
202
|
+
| `--two-d-wf-aggressiveness conservative\|balanced\|strong` | `balanced` | Strength preset for the enhanced 2D widefield model. |
|
|
203
|
+
| `--two-d-wf-bg-radius-um VALUE` | `0.5` | Background-estimation radius in micrometers. Values below `0.1` are clamped to `0.1`. |
|
|
204
|
+
| `--two-d-wf-bg-scale VALUE` | `1.0` | Multiplier for the estimated 2D widefield background. Values below `0.1` are clamped to `0.1`. |
|
|
205
|
+
|
|
206
|
+
## Metadata Override Behavior
|
|
207
|
+
|
|
208
|
+
Without `--overrule-metadata`:
|
|
209
|
+
|
|
210
|
+
- Existing OME metadata is preserved.
|
|
211
|
+
- CLI metadata values are used only when a value is missing or invalid.
|
|
212
|
+
- This is the recommended mode for well-annotated OME-TIFF or OME-Zarr data.
|
|
213
|
+
|
|
214
|
+
With `--overrule-metadata`:
|
|
215
|
+
|
|
216
|
+
- CLI metadata values replace image metadata.
|
|
217
|
+
- Use this when source metadata is known to be wrong, incomplete, or converted
|
|
218
|
+
with incorrect physical pixel sizes or wavelengths.
|
|
219
|
+
|
|
220
|
+
Example:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
224
|
+
--overrule-metadata ^
|
|
225
|
+
--microscope-type widefield ^
|
|
226
|
+
--na 1.40 ^
|
|
227
|
+
--refractive-index 1.515 ^
|
|
228
|
+
--sample-ri 1.47 ^
|
|
229
|
+
--pixel-size-xy 0.065 ^
|
|
230
|
+
--pixel-size-z 0.200 ^
|
|
231
|
+
--emission-wl 520,610
|
|
232
|
+
```
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# ci-deconvolve
|
|
2
|
+
|
|
3
|
+
Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.
|
|
4
|
+
|
|
5
|
+
This package installs the `ci_deconvolve` command. On Windows, `pip` also
|
|
6
|
+
creates a `ci_deconvolve.exe` console launcher in the active environment.
|
|
7
|
+
|
|
8
|
+
## Prerequisite: PyTorch
|
|
9
|
+
|
|
10
|
+
PyTorch is required but is not bundled in this package. Install the CPU or CUDA
|
|
11
|
+
build that matches your system before running `ci_deconvolve`.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install torch
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or install a CUDA build using the command from:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
https://pytorch.org/get-started/locally/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
From this folder during development:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
From PyPI after publishing:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install ci-deconvolve
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The package depends on `ome-zarr` for OME-Zarr reading and writing. `zarr` is
|
|
40
|
+
installed transitively by `ome-zarr`; it is not declared as a direct dependency.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Run one OME-TIFF file:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
ci_deconvolve --input image.ome.tiff --output out
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Run one OME-Zarr image:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
ci_deconvolve --input image.ome.zarr --output out --output-format ome-zarr
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Run every supported immediate child in a folder:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
ci_deconvolve --input in_folder --output out_folder --iterations 40
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Only these inputs are accepted:
|
|
63
|
+
|
|
64
|
+
- `.ome.tif`
|
|
65
|
+
- `.ome.tiff`
|
|
66
|
+
- `.zarr` / `.ome.zarr` directories
|
|
67
|
+
|
|
68
|
+
The CLI always runs `ci_rl`. It intentionally has no `--method` option.
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
74
|
+
--iterations 40 ^
|
|
75
|
+
--device auto ^
|
|
76
|
+
--output-format ome-tiff ^
|
|
77
|
+
--emission-wl 520 ^
|
|
78
|
+
--excitation-wl 488 ^
|
|
79
|
+
--pixel-size-xy 0.065 ^
|
|
80
|
+
--pixel-size-z 0.2
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use `--overrule-metadata` when CLI metadata values should replace image
|
|
84
|
+
metadata. Without it, CLI metadata values are used as fallbacks.
|
|
85
|
+
|
|
86
|
+
Per-channel values can be comma-separated. If there are more channels than
|
|
87
|
+
values, the last value is reused for the remaining channels.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
91
|
+
--iterations 40,60,80 ^
|
|
92
|
+
--emission-wl 520,610 ^
|
|
93
|
+
--excitation-wl 488,561 ^
|
|
94
|
+
--pinhole-airy 1.0,1.2
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Parameters
|
|
98
|
+
|
|
99
|
+
### Required Paths
|
|
100
|
+
|
|
101
|
+
| Option | Default | Description |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| `input_path` | none | Optional positional input path. Use this or `--input`. |
|
|
104
|
+
| `--input PATH` | none | Input OME-TIFF file, OME-Zarr folder, or folder containing supported inputs. |
|
|
105
|
+
| `--output DIR` | required | Output folder. Created if it does not exist. |
|
|
106
|
+
|
|
107
|
+
Supported inputs are immediate files/folders only:
|
|
108
|
+
|
|
109
|
+
- `.ome.tif`
|
|
110
|
+
- `.ome.tiff`
|
|
111
|
+
- `.zarr` / `.ome.zarr` directories
|
|
112
|
+
|
|
113
|
+
HCS plate OME-Zarr inputs are detected and rejected clearly; this focused CLI
|
|
114
|
+
does not process plate fields.
|
|
115
|
+
|
|
116
|
+
### Output And Compute
|
|
117
|
+
|
|
118
|
+
| Option | Default | Description |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| `--output-format ome-tiff\|ome-zarr` | `ome-tiff` | Writes `<stem>_decon.ome.tiff` or `<stem>_decon.ome.zarr`. |
|
|
121
|
+
| `--iterations N[,N...]` | `40` | CI-RL iteration count. A comma- or semicolon-separated list applies per channel, with the last value reused for extra channels. |
|
|
122
|
+
| `--device auto\|cpu\|cuda` | `auto` | Compute device. `auto` lets PyTorch choose CUDA when available, otherwise CPU. |
|
|
123
|
+
| `-v`, `--verbose` | off | Enable INFO logging from the CLI and core deconvolution code. |
|
|
124
|
+
|
|
125
|
+
### CI-RL Solver
|
|
126
|
+
|
|
127
|
+
| Option | Default | Description |
|
|
128
|
+
| --- | --- | --- |
|
|
129
|
+
| `--background VALUE\|auto` | `auto` | Background level used by the solver. `auto` estimates it from the image. Numeric values are accepted. |
|
|
130
|
+
| `--offset VALUE\|auto\|none` | `auto` | Positive offset added before iteration and removed afterwards. Use `none`, `0`, or `0.0` to disable. |
|
|
131
|
+
| `--damping VALUE\|auto\|none` | `none` | Noise-gated damping strength. Use `auto` for automatic damping, numeric values for manual damping, or `none`/`0` to disable. |
|
|
132
|
+
| `--prefilter-sigma VALUE` | `0.0` | Optional Anscombe/low-pass prefilter sigma. `0.0` disables prefiltering. |
|
|
133
|
+
| `--start MODE` | `auto` | Initial estimate mode. Choices: `auto`, `flat`, `percentile_flat`, `observed`, `observed_bgsub`, `lowpass`, `lowpass_bgsub`, `hybrid`. |
|
|
134
|
+
| `--convergence auto\|fixed\|none` | `auto` | `auto` enables early stopping based on convergence. `fixed` and `none` both run the requested iteration count. |
|
|
135
|
+
| `--rel-threshold VALUE` | `0.005` | Relative convergence threshold used when `--convergence auto`. Values are clamped to at least `1e-8`. |
|
|
136
|
+
| `--check-every N` | `5` | Check convergence every N iterations. Values below 1 are clamped to 1. |
|
|
137
|
+
|
|
138
|
+
### Metadata And PSF
|
|
139
|
+
|
|
140
|
+
These values are used to generate the point spread function. By default, image
|
|
141
|
+
metadata wins and CLI values fill in missing metadata. With
|
|
142
|
+
`--overrule-metadata`, CLI values replace image metadata.
|
|
143
|
+
|
|
144
|
+
| Option | Default | Description |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| `--na VALUE` | `1.4` | Numerical aperture. |
|
|
147
|
+
| `--refractive-index VALUE` | `1.515` | Immersion medium refractive index, typically oil. |
|
|
148
|
+
| `--sample-ri VALUE` | `1.47` | Sample medium refractive index. |
|
|
149
|
+
| `--microscope-type widefield\|confocal` | `confocal` | Microscope model used for PSF generation. |
|
|
150
|
+
| `--emission-wl VALUE[,VALUE...]` | `520` | Emission wavelength(s), in nm. Per-channel list supported. |
|
|
151
|
+
| `--excitation-wl VALUE[,VALUE...]` | `488` | Excitation wavelength(s), in nm. Per-channel list supported. |
|
|
152
|
+
| `--pinhole-airy VALUE[,VALUE...]` | `1.0` | Confocal pinhole diameter in Airy units. Per-channel list supported. |
|
|
153
|
+
| `--pixel-size-xy VALUE` | `0.065` | Lateral pixel size in micrometers. Applied to X and Y. |
|
|
154
|
+
| `--pixel-size-z VALUE` | `0.2` | Axial pixel size in micrometers. |
|
|
155
|
+
| `--overrule-metadata` | off | Replace image metadata with CLI metadata values instead of only using CLI values as fallbacks. |
|
|
156
|
+
|
|
157
|
+
List syntax:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
--emission-wl 520,610
|
|
161
|
+
--excitation-wl 488;561
|
|
162
|
+
--iterations 30,40,50
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Commas and semicolons are both accepted.
|
|
166
|
+
|
|
167
|
+
### 2D Widefield Options
|
|
168
|
+
|
|
169
|
+
These only affect 2D widefield data when `--microscope-type widefield` and
|
|
170
|
+
`--two-d-mode auto` are used.
|
|
171
|
+
|
|
172
|
+
| Option | Default | Description |
|
|
173
|
+
| --- | --- | --- |
|
|
174
|
+
| `--two-d-mode auto\|legacy_2d` | `auto` | `auto` enables the enhanced 2D widefield path. `legacy_2d` uses the historical pure-2D PSF behavior. |
|
|
175
|
+
| `--two-d-wf-aggressiveness conservative\|balanced\|strong` | `balanced` | Strength preset for the enhanced 2D widefield model. |
|
|
176
|
+
| `--two-d-wf-bg-radius-um VALUE` | `0.5` | Background-estimation radius in micrometers. Values below `0.1` are clamped to `0.1`. |
|
|
177
|
+
| `--two-d-wf-bg-scale VALUE` | `1.0` | Multiplier for the estimated 2D widefield background. Values below `0.1` are clamped to `0.1`. |
|
|
178
|
+
|
|
179
|
+
## Metadata Override Behavior
|
|
180
|
+
|
|
181
|
+
Without `--overrule-metadata`:
|
|
182
|
+
|
|
183
|
+
- Existing OME metadata is preserved.
|
|
184
|
+
- CLI metadata values are used only when a value is missing or invalid.
|
|
185
|
+
- This is the recommended mode for well-annotated OME-TIFF or OME-Zarr data.
|
|
186
|
+
|
|
187
|
+
With `--overrule-metadata`:
|
|
188
|
+
|
|
189
|
+
- CLI metadata values replace image metadata.
|
|
190
|
+
- Use this when source metadata is known to be wrong, incomplete, or converted
|
|
191
|
+
with incorrect physical pixel sizes or wavelengths.
|
|
192
|
+
|
|
193
|
+
Example:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
197
|
+
--overrule-metadata ^
|
|
198
|
+
--microscope-type widefield ^
|
|
199
|
+
--na 1.40 ^
|
|
200
|
+
--refractive-index 1.515 ^
|
|
201
|
+
--sample-ri 1.47 ^
|
|
202
|
+
--pixel-size-xy 0.065 ^
|
|
203
|
+
--pixel-size-z 0.200 ^
|
|
204
|
+
--emission-wl 520,610
|
|
205
|
+
```
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ci-deconvolve
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.
|
|
5
|
+
Author: NL-BioImaging contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: microscopy,deconvolution,ome-tiff,ome-zarr,richardson-lucy
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: numpy<3,>=1.26
|
|
16
|
+
Requires-Dist: Pillow>=10.0
|
|
17
|
+
Requires-Dist: tifffile>=2024.1.30
|
|
18
|
+
Requires-Dist: imagecodecs>=2024.1.1
|
|
19
|
+
Requires-Dist: bioio==3.2.0
|
|
20
|
+
Requires-Dist: bioio-ome-tiff==1.4.0
|
|
21
|
+
Requires-Dist: ome-zarr<0.19,>=0.18
|
|
22
|
+
Requires-Dist: numcodecs>=0.14
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest; extra == "dev"
|
|
25
|
+
Requires-Dist: build; extra == "dev"
|
|
26
|
+
Requires-Dist: twine; extra == "dev"
|
|
27
|
+
|
|
28
|
+
# ci-deconvolve
|
|
29
|
+
|
|
30
|
+
Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.
|
|
31
|
+
|
|
32
|
+
This package installs the `ci_deconvolve` command. On Windows, `pip` also
|
|
33
|
+
creates a `ci_deconvolve.exe` console launcher in the active environment.
|
|
34
|
+
|
|
35
|
+
## Prerequisite: PyTorch
|
|
36
|
+
|
|
37
|
+
PyTorch is required but is not bundled in this package. Install the CPU or CUDA
|
|
38
|
+
build that matches your system before running `ci_deconvolve`.
|
|
39
|
+
|
|
40
|
+
Examples:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install torch
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
or install a CUDA build using the command from:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
https://pytorch.org/get-started/locally/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
From this folder during development:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
From PyPI after publishing:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install ci-deconvolve
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The package depends on `ome-zarr` for OME-Zarr reading and writing. `zarr` is
|
|
67
|
+
installed transitively by `ome-zarr`; it is not declared as a direct dependency.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
Run one OME-TIFF file:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
ci_deconvolve --input image.ome.tiff --output out
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Run one OME-Zarr image:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
ci_deconvolve --input image.ome.zarr --output out --output-format ome-zarr
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Run every supported immediate child in a folder:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ci_deconvolve --input in_folder --output out_folder --iterations 40
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Only these inputs are accepted:
|
|
90
|
+
|
|
91
|
+
- `.ome.tif`
|
|
92
|
+
- `.ome.tiff`
|
|
93
|
+
- `.zarr` / `.ome.zarr` directories
|
|
94
|
+
|
|
95
|
+
The CLI always runs `ci_rl`. It intentionally has no `--method` option.
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
101
|
+
--iterations 40 ^
|
|
102
|
+
--device auto ^
|
|
103
|
+
--output-format ome-tiff ^
|
|
104
|
+
--emission-wl 520 ^
|
|
105
|
+
--excitation-wl 488 ^
|
|
106
|
+
--pixel-size-xy 0.065 ^
|
|
107
|
+
--pixel-size-z 0.2
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Use `--overrule-metadata` when CLI metadata values should replace image
|
|
111
|
+
metadata. Without it, CLI metadata values are used as fallbacks.
|
|
112
|
+
|
|
113
|
+
Per-channel values can be comma-separated. If there are more channels than
|
|
114
|
+
values, the last value is reused for the remaining channels.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
118
|
+
--iterations 40,60,80 ^
|
|
119
|
+
--emission-wl 520,610 ^
|
|
120
|
+
--excitation-wl 488,561 ^
|
|
121
|
+
--pinhole-airy 1.0,1.2
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Parameters
|
|
125
|
+
|
|
126
|
+
### Required Paths
|
|
127
|
+
|
|
128
|
+
| Option | Default | Description |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| `input_path` | none | Optional positional input path. Use this or `--input`. |
|
|
131
|
+
| `--input PATH` | none | Input OME-TIFF file, OME-Zarr folder, or folder containing supported inputs. |
|
|
132
|
+
| `--output DIR` | required | Output folder. Created if it does not exist. |
|
|
133
|
+
|
|
134
|
+
Supported inputs are immediate files/folders only:
|
|
135
|
+
|
|
136
|
+
- `.ome.tif`
|
|
137
|
+
- `.ome.tiff`
|
|
138
|
+
- `.zarr` / `.ome.zarr` directories
|
|
139
|
+
|
|
140
|
+
HCS plate OME-Zarr inputs are detected and rejected clearly; this focused CLI
|
|
141
|
+
does not process plate fields.
|
|
142
|
+
|
|
143
|
+
### Output And Compute
|
|
144
|
+
|
|
145
|
+
| Option | Default | Description |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `--output-format ome-tiff\|ome-zarr` | `ome-tiff` | Writes `<stem>_decon.ome.tiff` or `<stem>_decon.ome.zarr`. |
|
|
148
|
+
| `--iterations N[,N...]` | `40` | CI-RL iteration count. A comma- or semicolon-separated list applies per channel, with the last value reused for extra channels. |
|
|
149
|
+
| `--device auto\|cpu\|cuda` | `auto` | Compute device. `auto` lets PyTorch choose CUDA when available, otherwise CPU. |
|
|
150
|
+
| `-v`, `--verbose` | off | Enable INFO logging from the CLI and core deconvolution code. |
|
|
151
|
+
|
|
152
|
+
### CI-RL Solver
|
|
153
|
+
|
|
154
|
+
| Option | Default | Description |
|
|
155
|
+
| --- | --- | --- |
|
|
156
|
+
| `--background VALUE\|auto` | `auto` | Background level used by the solver. `auto` estimates it from the image. Numeric values are accepted. |
|
|
157
|
+
| `--offset VALUE\|auto\|none` | `auto` | Positive offset added before iteration and removed afterwards. Use `none`, `0`, or `0.0` to disable. |
|
|
158
|
+
| `--damping VALUE\|auto\|none` | `none` | Noise-gated damping strength. Use `auto` for automatic damping, numeric values for manual damping, or `none`/`0` to disable. |
|
|
159
|
+
| `--prefilter-sigma VALUE` | `0.0` | Optional Anscombe/low-pass prefilter sigma. `0.0` disables prefiltering. |
|
|
160
|
+
| `--start MODE` | `auto` | Initial estimate mode. Choices: `auto`, `flat`, `percentile_flat`, `observed`, `observed_bgsub`, `lowpass`, `lowpass_bgsub`, `hybrid`. |
|
|
161
|
+
| `--convergence auto\|fixed\|none` | `auto` | `auto` enables early stopping based on convergence. `fixed` and `none` both run the requested iteration count. |
|
|
162
|
+
| `--rel-threshold VALUE` | `0.005` | Relative convergence threshold used when `--convergence auto`. Values are clamped to at least `1e-8`. |
|
|
163
|
+
| `--check-every N` | `5` | Check convergence every N iterations. Values below 1 are clamped to 1. |
|
|
164
|
+
|
|
165
|
+
### Metadata And PSF
|
|
166
|
+
|
|
167
|
+
These values are used to generate the point spread function. By default, image
|
|
168
|
+
metadata wins and CLI values fill in missing metadata. With
|
|
169
|
+
`--overrule-metadata`, CLI values replace image metadata.
|
|
170
|
+
|
|
171
|
+
| Option | Default | Description |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| `--na VALUE` | `1.4` | Numerical aperture. |
|
|
174
|
+
| `--refractive-index VALUE` | `1.515` | Immersion medium refractive index, typically oil. |
|
|
175
|
+
| `--sample-ri VALUE` | `1.47` | Sample medium refractive index. |
|
|
176
|
+
| `--microscope-type widefield\|confocal` | `confocal` | Microscope model used for PSF generation. |
|
|
177
|
+
| `--emission-wl VALUE[,VALUE...]` | `520` | Emission wavelength(s), in nm. Per-channel list supported. |
|
|
178
|
+
| `--excitation-wl VALUE[,VALUE...]` | `488` | Excitation wavelength(s), in nm. Per-channel list supported. |
|
|
179
|
+
| `--pinhole-airy VALUE[,VALUE...]` | `1.0` | Confocal pinhole diameter in Airy units. Per-channel list supported. |
|
|
180
|
+
| `--pixel-size-xy VALUE` | `0.065` | Lateral pixel size in micrometers. Applied to X and Y. |
|
|
181
|
+
| `--pixel-size-z VALUE` | `0.2` | Axial pixel size in micrometers. |
|
|
182
|
+
| `--overrule-metadata` | off | Replace image metadata with CLI metadata values instead of only using CLI values as fallbacks. |
|
|
183
|
+
|
|
184
|
+
List syntax:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
--emission-wl 520,610
|
|
188
|
+
--excitation-wl 488;561
|
|
189
|
+
--iterations 30,40,50
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Commas and semicolons are both accepted.
|
|
193
|
+
|
|
194
|
+
### 2D Widefield Options
|
|
195
|
+
|
|
196
|
+
These only affect 2D widefield data when `--microscope-type widefield` and
|
|
197
|
+
`--two-d-mode auto` are used.
|
|
198
|
+
|
|
199
|
+
| Option | Default | Description |
|
|
200
|
+
| --- | --- | --- |
|
|
201
|
+
| `--two-d-mode auto\|legacy_2d` | `auto` | `auto` enables the enhanced 2D widefield path. `legacy_2d` uses the historical pure-2D PSF behavior. |
|
|
202
|
+
| `--two-d-wf-aggressiveness conservative\|balanced\|strong` | `balanced` | Strength preset for the enhanced 2D widefield model. |
|
|
203
|
+
| `--two-d-wf-bg-radius-um VALUE` | `0.5` | Background-estimation radius in micrometers. Values below `0.1` are clamped to `0.1`. |
|
|
204
|
+
| `--two-d-wf-bg-scale VALUE` | `1.0` | Multiplier for the estimated 2D widefield background. Values below `0.1` are clamped to `0.1`. |
|
|
205
|
+
|
|
206
|
+
## Metadata Override Behavior
|
|
207
|
+
|
|
208
|
+
Without `--overrule-metadata`:
|
|
209
|
+
|
|
210
|
+
- Existing OME metadata is preserved.
|
|
211
|
+
- CLI metadata values are used only when a value is missing or invalid.
|
|
212
|
+
- This is the recommended mode for well-annotated OME-TIFF or OME-Zarr data.
|
|
213
|
+
|
|
214
|
+
With `--overrule-metadata`:
|
|
215
|
+
|
|
216
|
+
- CLI metadata values replace image metadata.
|
|
217
|
+
- Use this when source metadata is known to be wrong, incomplete, or converted
|
|
218
|
+
with incorrect physical pixel sizes or wavelengths.
|
|
219
|
+
|
|
220
|
+
Example:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
ci_deconvolve --input image.ome.tiff --output out ^
|
|
224
|
+
--overrule-metadata ^
|
|
225
|
+
--microscope-type widefield ^
|
|
226
|
+
--na 1.40 ^
|
|
227
|
+
--refractive-index 1.515 ^
|
|
228
|
+
--sample-ri 1.47 ^
|
|
229
|
+
--pixel-size-xy 0.065 ^
|
|
230
|
+
--pixel-size-z 0.200 ^
|
|
231
|
+
--emission-wl 520,610
|
|
232
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
ci_deconvolve.egg-info/PKG-INFO
|
|
4
|
+
ci_deconvolve.egg-info/SOURCES.txt
|
|
5
|
+
ci_deconvolve.egg-info/dependency_links.txt
|
|
6
|
+
ci_deconvolve.egg-info/entry_points.txt
|
|
7
|
+
ci_deconvolve.egg-info/requires.txt
|
|
8
|
+
ci_deconvolve.egg-info/top_level.txt
|
|
9
|
+
src/ci_deconvolve/__init__.py
|
|
10
|
+
src/ci_deconvolve/cli.py
|
|
11
|
+
src/core/__init__.py
|
|
12
|
+
src/core/_meta_helpers.py
|
|
13
|
+
src/core/deconvolve.py
|
|
14
|
+
src/core/deconvolve_ci.py
|
|
15
|
+
src/core/ome_zarr_io.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|