clearex.deconvolution.petakit

Typed helpers for running PyPetaKit5D deconvolution wrappers.

Functions

resolve_petakit_runtime_paths()

Resolve and validate PyPetaKit5D MCC runtime paths from env vars.

richardson_lucy(data_paths, PSFPath, ...)

Compatibility shim for existing Richardson-Lucy wrapper usage.

run_petakit_deconvolution(*, data_paths, ...)

Run a PyPetaKit5D deconvolution job.

validate_petakit_runtime(*[, mcc_mode])

Fail early when PyPetaKit5D MCC runtime assets are unavailable.

Classes

PetakitRuntimePaths(petakit5d_root, ...)

Resolved paths required for PyPetaKit5D MCC execution.

class clearex.deconvolution.petakit.PetakitRuntimePaths(petakit5d_root, matlab_runtime_root, mcc_master_launcher)

Bases: object

Resolved paths required for PyPetaKit5D MCC execution.

Parameters:
  • petakit5d_root (Path) –

  • matlab_runtime_root (Path) –

  • mcc_master_launcher (Path) –

petakit5d_root: Path
matlab_runtime_root: Path
mcc_master_launcher: Path
clearex.deconvolution.petakit.resolve_petakit_runtime_paths()

Resolve and validate PyPetaKit5D MCC runtime paths from env vars.

Returns:

Existing runtime root paths and MCC launcher path.

Return type:

PetakitRuntimePaths

Raises:

RuntimeError – If required environment variables or runtime files are missing.

clearex.deconvolution.petakit.validate_petakit_runtime(*, mcc_mode=True)

Fail early when PyPetaKit5D MCC runtime assets are unavailable.

Parameters:

mcc_mode (bool) –

Return type:

None

clearex.deconvolution.petakit.run_petakit_deconvolution(*, data_paths, channel_patterns, psf_fullpaths, xy_pixel_size_um, dz_um, dz_psf_um, hann_win_bounds=(0.8, 1.0), wiener_alpha=0.005, background=110.0, decon_iter=2, result_dir_name='decon', rl_method='omw', otf_cum_thresh=0.6, save_16bit=True, zarr_file=False, save_zarr=False, large_file=False, block_size_zyx=(256, 256, 256), batch_size_zyx=(1024, 1024, 1024), parse_cluster=False, gpu_job=False, debug=False, cpus_per_task=2, mcc_mode=True, config_file='', gpu_config_file='', psf_gen=False, overwrite=True)

Run a PyPetaKit5D deconvolution job.

Parameters:
  • data_paths (sequence of str or pathlib.Path) – Input image paths passed to XR_decon_data_wrapper.

  • channel_patterns (sequence of str) – Channel/file patterns used by the wrapper to select image content.

  • psf_fullpaths (sequence of str or pathlib.Path) – PSF file paths aligned to channel patterns.

  • xy_pixel_size_um (float) – Input image XY pixel size in microns.

  • dz_um (float) – Input image Z step size in microns.

  • dz_psf_um (float) – PSF Z step size in microns.

  • hann_win_bounds (tuple[float, float], default=(0.8, 1.0)) – OTF Hann window lower and upper bounds.

  • wiener_alpha (float, default=0.005) – Wiener regularization alpha.

  • background (float, default=110.0) – Background offset used by the deconvolution routine.

  • decon_iter (int, default=2) – Number of Richardson-Lucy iterations.

  • result_dir_name (str, default="decon") – Output directory name under each input location.

  • rl_method (str, default="omw") – Richardson-Lucy method variant.

  • otf_cum_thresh (float, default=0.6) – OTF cumulative threshold.

  • save_16bit (bool, default=True) – Whether to save 16-bit outputs.

  • zarr_file (bool, default=False) – Whether input paths should be interpreted as Zarr inputs.

  • save_zarr (bool, default=False) – Whether outputs should be saved as Zarr.

  • large_file (bool, default=False) – Enables block/batch processing for large volumes.

  • block_size_zyx (tuple[int, int, int], default=(256, 256, 256)) – Block size used when large_file is enabled.

  • batch_size_zyx (tuple[int, int, int], default=(1024, 1024, 1024)) – Batch size used when large_file is enabled.

  • parse_cluster (bool, default=False) – Enables PyPetaKit5D cluster parsing logic.

  • gpu_job (bool, default=False) – Enables GPU execution mode in PyPetaKit5D.

  • debug (bool, default=False) – Enables debug mode in PyPetaKit5D.

  • cpus_per_task (int, default=2) – CPU count passed to PyPetaKit5D for the launched job.

  • mcc_mode (bool, default=True) – Run via MATLAB-compiled runtime mode.

  • config_file (str, default="") – Optional external PyPetaKit5D config file path.

  • gpu_config_file (str, default="") – Optional GPU config file path.

  • psf_gen (bool, default=False) – Whether PyPetaKit5D should generate PSFs internally.

  • overwrite (bool, default=True) – Whether existing outputs should be overwritten.

Returns:

Wrapper side effects only.

Return type:

None

Raises:
  • RuntimeError – If PyPetaKit5D is unavailable.

  • ValueError – If required parameters are missing or malformed.

clearex.deconvolution.petakit.richardson_lucy(data_paths, PSFPath, xy_pixel, z_pixel, channel_pattern)

Compatibility shim for existing Richardson-Lucy wrapper usage.

Parameters:
  • data_paths (list[str]) – Input image paths.

  • PSFPath (str) – PSF file path.

  • xy_pixel (float) – Input image XY pixel size in microns.

  • z_pixel (float) – Input image Z step size in microns.

  • channel_pattern (list[str]) – Channel/file patterns.

Returns:

Wrapper side effects only.

Return type:

None