Skip to main content

Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.

Project description

ci-deconvolve

Focused command-line CI-RL deconvolution for OME-TIFF and OME-Zarr images.

This package installs the ci_deconvolve command. On Windows, pip also creates a ci_deconvolve.exe console launcher in the active environment.

Prerequisite: PyTorch

PyTorch is required but is not bundled in this package. Install the CPU or CUDA build that matches your system before running ci_deconvolve.

Examples:

pip install torch

or install a CUDA build using the command from:

https://pytorch.org/get-started/locally/

Install

From this folder during development:

pip install -e .

From PyPI after publishing:

pip install ci-deconvolve

The package depends on ome-zarr for OME-Zarr reading and zarr>=2.16,<4 for writing QuPath- and OMERO-compatible OME-Zarr output.

Usage

Run one OME-TIFF file:

ci_deconvolve --input image.ome.tiff --output out

Run one OME-Zarr image:

ci_deconvolve --input image.ome.zarr --output out --output-format ome-zarr

Run every supported immediate child in a folder:

ci_deconvolve --input in_folder --output out_folder --iterations 40

Only these inputs are accepted:

  • .ome.tif
  • .ome.tiff
  • .zarr / .ome.zarr directories

The CLI always runs ci_rl. It intentionally has no --method option.

Examples

ci_deconvolve --input image.ome.tiff --output out ^
  --iterations 40 ^
  --device auto ^
  --output-format ome-tiff ^
  --emission-wl 520 ^
  --excitation-wl 488 ^
  --pixel-size-xy 0.065 ^
  --pixel-size-z 0.2

Use --overrule-metadata when CLI metadata values should replace image metadata. Without it, CLI metadata values are used as fallbacks.

Per-channel values can be comma-separated. If there are more channels than values, the last value is reused for the remaining channels.

ci_deconvolve --input image.ome.tiff --output out ^
  --iterations 40,60,80 ^
  --emission-wl 520,610 ^
  --excitation-wl 488,561 ^
  --pinhole-airy 1.0,1.2

Parameters

Required Paths

Option Default Description
input_path none Optional positional input path. Use this or --input.
--input PATH none Input OME-TIFF file, OME-Zarr folder, or folder containing supported inputs.
--output DIR required Output folder. Created if it does not exist.

Supported inputs are immediate files/folders only:

  • .ome.tif
  • .ome.tiff
  • .zarr / .ome.zarr directories

HCS plate OME-Zarr inputs are detected and rejected clearly; this focused CLI does not process plate fields.

Output And Compute

Option Default Description
--output-format ome-tiff|ome-zarr ome-tiff Writes <stem>_decon.ome.tiff or <stem>_decon.ome.zarr.
--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.
--device auto|cpu|cuda auto Compute device. auto lets PyTorch choose CUDA when available, otherwise CPU.
-v, --verbose off Enable INFO logging from the CLI and core deconvolution code.

CI-RL Solver

Option Default Description
--background VALUE|auto auto Background level used by the solver. auto estimates it from the image. Numeric values are accepted.
--offset VALUE|auto|none auto Positive offset added before iteration and removed afterwards. Use none, 0, or 0.0 to disable.
--damping VALUE|auto|none none Noise-gated damping strength. Use auto for automatic damping, numeric values for manual damping, or none/0 to disable.
--prefilter-sigma VALUE 0.0 Optional Anscombe/low-pass prefilter sigma. 0.0 disables prefiltering.
--start MODE auto Initial estimate mode. Choices: auto, flat, percentile_flat, observed, observed_bgsub, lowpass, lowpass_bgsub, hybrid.
--convergence auto|fixed|none auto auto enables early stopping based on convergence. fixed and none both run the requested iteration count.
--rel-threshold VALUE 0.005 Relative convergence threshold used when --convergence auto. Values are clamped to at least 1e-8.
--check-every N 5 Check convergence every N iterations. Values below 1 are clamped to 1.

Metadata And PSF

These values are used to generate the point spread function. By default, image metadata wins and CLI values fill in missing metadata. With --overrule-metadata, CLI values replace image metadata.

Option Default Description
--na VALUE 1.4 Numerical aperture.
--refractive-index VALUE 1.515 Immersion medium refractive index, typically oil.
--sample-ri VALUE 1.47 Sample medium refractive index.
--microscope-type widefield|confocal confocal Microscope model used for PSF generation.
--emission-wl VALUE[,VALUE...] 520 Emission wavelength(s), in nm. Per-channel list supported.
--excitation-wl VALUE[,VALUE...] 488 Excitation wavelength(s), in nm. Per-channel list supported.
--pinhole-airy VALUE[,VALUE...] 1.0 Confocal pinhole diameter in Airy units. Per-channel list supported.
--pixel-size-xy VALUE 0.065 Lateral pixel size in micrometers. Applied to X and Y.
--pixel-size-z VALUE 0.2 Axial pixel size in micrometers.
--overrule-metadata off Replace image metadata with CLI metadata values instead of only using CLI values as fallbacks.

List syntax:

--emission-wl 520,610
--excitation-wl 488;561
--iterations 30,40,50

Commas and semicolons are both accepted.

OME-Zarr Compatibility

OME-Zarr output is written as OME-NGFF 0.4 on Zarr v2, with .zgroup and .zattrs metadata plus OMERO channel display metadata. This layout is intended to open in QuPath 0.7 and remain compatible with OMERO tooling.

2D Widefield Options

These only affect 2D widefield data when --microscope-type widefield and --two-d-mode auto are used.

Option Default Description
--two-d-mode auto|legacy_2d auto auto enables the enhanced 2D widefield path. legacy_2d uses the historical pure-2D PSF behavior.
--two-d-wf-aggressiveness conservative|balanced|strong balanced Strength preset for the enhanced 2D widefield model.
--two-d-wf-bg-radius-um VALUE 0.5 Background-estimation radius in micrometers. Values below 0.1 are clamped to 0.1.
--two-d-wf-bg-scale VALUE 1.0 Multiplier for the estimated 2D widefield background. Values below 0.1 are clamped to 0.1.

Metadata Override Behavior

Without --overrule-metadata:

  • Existing OME metadata is preserved.
  • CLI metadata values are used only when a value is missing or invalid.
  • This is the recommended mode for well-annotated OME-TIFF or OME-Zarr data.

With --overrule-metadata:

  • CLI metadata values replace image metadata.
  • Use this when source metadata is known to be wrong, incomplete, or converted with incorrect physical pixel sizes or wavelengths.

Example:

ci_deconvolve --input image.ome.tiff --output out ^
  --overrule-metadata ^
  --microscope-type widefield ^
  --na 1.40 ^
  --refractive-index 1.515 ^
  --sample-ri 1.47 ^
  --pixel-size-xy 0.065 ^
  --pixel-size-z 0.200 ^
  --emission-wl 520,610

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ci_deconvolve-0.2.0.tar.gz (49.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ci_deconvolve-0.2.0-py3-none-any.whl (52.0 kB view details)

Uploaded Python 3

File details

Details for the file ci_deconvolve-0.2.0.tar.gz.

File metadata

  • Download URL: ci_deconvolve-0.2.0.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ci_deconvolve-0.2.0.tar.gz
Algorithm Hash digest
SHA256 05bab9f20c1c27060ebad9a8c352cdfb24c006184b0991ad4d9381de686a9ac2
MD5 88ab6065c1a799f838d548ae505786eb
BLAKE2b-256 fb6b8cbac815e182813574f45cd3bd8b733fcb13986e9def614ecf46388caf66

See more details on using hashes here.

File details

Details for the file ci_deconvolve-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ci_deconvolve-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 52.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ci_deconvolve-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 087f0e36ccb232af19a2cef334ca92ce4156a4da0474d449f6726d9fcf93466b
MD5 d21983f39ad7436ad9b4ce0354f30c0d
BLAKE2b-256 dcc2fe18b2a0509cf5da462c7ae560d61d4ede14a26f95f40f11d01a2e94f669

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page