Skip to main content

Python package for holographic microscopy.

Project description

Tests Documentation Status License: MIT

PyHoloscope Logo

PyHoloscope: Fast Holographic Microscopy for Python

PyHoloscope is a Python package for holographic microscopy, providing performant reconstruction of inline and off-axis holograms, as well as autofocus and phase visualisation.

PyHoloscope is designed to be:

  • Fast (for Python) - optimised for CPU using Numpy, Scipy and Numba, with GPU support via CuPy
  • Easy to Use - a simple object-oriented API gives high performance without low-level tweaks
  • Suitable for Live Imaging - can be used as the back-end of holographic microscopy GUIs as well as for offline processing

Full documentation is on Read the docs.

Installation

pip install pyholoscope

Minimal Example

To numerically refocus an inline hologram:

import pyholoscope as pyh
hologram = pyh.load_image(holoFile)
holo = pyh.Holo(
    mode=pyh.INLINE,  # For inline holography
    wavelength=630e-9,  # Light wavelength, m
    pixel_size=1e-6,  # Hologram physical pixel size, m
    depth=0.0130,  # Distance to refocus, m
)
recon = holo.process(hologram)

Live Demos and Examples

You can try PyHoloscope in your browser with these tutorials hosted on Binder:

  • Tutorial 01: Inline Holography Binder

  • Tutorial 02: Off-Axis Holography Binder

  • Tutorial 03: Off-Axis Holography with Refocusing Binder

  • Tutorial 04: Auto-focusing Binder

There are more example scripts in the examples folder.

Contributions

Contributions to the package (new features, tests or documentation) are very welcome, please see the roadmap below and post in the discussion if you are working on something, or get in touch.

Development is co-ordinated by Mike Hughes' lab in the Applied Optics Group, Physics & Astronomy, University of Kent.

If you are interested in academic applications we are happy to help, post in the discussion. If you would like help using PyHoloscope for commercial purposes, consultancy is available, please contact Mike Hughes in the first instance.

Features

General

  • Object-oriented interface
  • Choice of single or double precision
  • Support for CUDA compatible GPUs
  • Optional use of Numba JIT compiler
  • Supports non-square holograms

Off Axis Holography

  • Quantitative phase and amplitude recovery from off-axis hologram
  • Auto detect off-axis modulation frequency
  • Predict tilt angle from modulation frequency

Numerical Refocusing (Inline and Off-axis Holography)

  • Refocus holograms or complex fields using the angular spectrum method
  • Choice of cosine windows to reduce edge effects
  • Generate stack of images at different refocus depths
  • Apply focus metrics (Brenner, Sobel, Peak Intensity, DarkFocus, SobelVariance)
  • Auto focus whole image or ROI by optimising focus metric, through fast bounded search and (optionally) initial coarse search to narrow search range.
  • Generate LUT of propagators for faster auto-focus or repeated generation of focus stacks.

Phase Visualisation

  • Remove background phase
  • Remove phase tilt
  • Show phase relative to region of interest
  • Generate phase contrast image
  • Generate synthetic DIC image

Roadmap of Planned Developments (help welcome!)

  • Phase recovery for inline holography
  • Improved optimisation for speed/multiple back-ends
  • Support phase-shifting holography
  • Support coded aperture/multi-depth phase recovery
  • Support forward scattering and inference
  • Support particle tracking
  • Deep learning for focusing
  • Targeted support for edge computing (e.g. Raspberry Pi)

Requirements

  • Numpy
  • Scipy
  • PIL
  • OpenCV
  • Scikit-Image
  • Matplotlib
  • Numba (optional, for JIT acceleration)
  • CuPy (optional, for GPU)

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

pyholoscope-1.1.1.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

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

pyholoscope-1.1.1-py3-none-any.whl (43.6 kB view details)

Uploaded Python 3

File details

Details for the file pyholoscope-1.1.1.tar.gz.

File metadata

  • Download URL: pyholoscope-1.1.1.tar.gz
  • Upload date:
  • Size: 35.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyholoscope-1.1.1.tar.gz
Algorithm Hash digest
SHA256 eace37ca994012fc423c803b179f4306b4cd50f59e687a653249d9969e4efd30
MD5 5a65aea250d8fbd8b44ca6b79712c7e4
BLAKE2b-256 2eba2c2014dccb1e22ecb5a771979223f73d86901c590aecd2e5e9dbc3643c80

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyholoscope-1.1.1.tar.gz:

Publisher: pypi.yml on MikeHughesKent/PyHoloscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyholoscope-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyholoscope-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 43.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyholoscope-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6f2ecdc9c0135464a8ae3cb16c218b32e582dfe3f8c74fc10e986821ebd6836
MD5 4fdad00ab90b499eb4fcea7e19611ed3
BLAKE2b-256 8ef1679196ad2641080a90d4441b99f0368b0008f4fd8a5a3df7510209477350

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyholoscope-1.1.1-py3-none-any.whl:

Publisher: pypi.yml on MikeHughesKent/PyHoloscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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