Python package for holographic microscopy.
Project description
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:
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyholoscope-1.1.0.tar.gz.
File metadata
- Download URL: pyholoscope-1.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875c3861b7b2252243c43eff061d9a52f7cfb66225ad2d5d7567c61e8608cfbe
|
|
| MD5 |
043cc5d546f5c8b73efbb4cef461a575
|
|
| BLAKE2b-256 |
039215802614ae230b3667cb9c3a49625eda1c959022f939c6e44caddaf6bfa5
|
Provenance
The following attestation bundles were made for pyholoscope-1.1.0.tar.gz:
Publisher:
pypi.yml on MikeHughesKent/PyHoloscope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyholoscope-1.1.0.tar.gz -
Subject digest:
875c3861b7b2252243c43eff061d9a52f7cfb66225ad2d5d7567c61e8608cfbe - Sigstore transparency entry: 1161723122
- Sigstore integration time:
-
Permalink:
MikeHughesKent/PyHoloscope@cb61499c5df75d98986b7eb29e67dbfeda808688 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/MikeHughesKent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@cb61499c5df75d98986b7eb29e67dbfeda808688 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyholoscope-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pyholoscope-1.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76aede9aa22341ba05eaa54b1804c965b88eacb9b53d432db2334a1820557941
|
|
| MD5 |
ba9d61a5ca4f9f5dfea49c2556487580
|
|
| BLAKE2b-256 |
7d1227fadaf2735983b2fd725c359aeec3ca734e31030f090af53be22e1292b0
|
Provenance
The following attestation bundles were made for pyholoscope-1.1.0-py3-none-any.whl:
Publisher:
pypi.yml on MikeHughesKent/PyHoloscope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyholoscope-1.1.0-py3-none-any.whl -
Subject digest:
76aede9aa22341ba05eaa54b1804c965b88eacb9b53d432db2334a1820557941 - Sigstore transparency entry: 1161723183
- Sigstore integration time:
-
Permalink:
MikeHughesKent/PyHoloscope@cb61499c5df75d98986b7eb29e67dbfeda808688 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/MikeHughesKent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@cb61499c5df75d98986b7eb29e67dbfeda808688 -
Trigger Event:
release
-
Statement type: