PyFibreBundle
PyFibreBundle is a Python package for processing images captured through optical fibre bundles.
The core functionality allows fibre core patterns to be identified and removed by several methods, in addition to background subtraction, flat-fielding (normalisation), and cropping via automatical bundle localisation. Modules also allow for mosaicking and resolution enhancement.
PyFibreBundle is fast enough for live imaging as well as for offline research; frame rates of over 100 fps can be achieved on mid-level hardware, including core removal and mosaicing. The Numba just-in-time compiler is used to accelerate key portions of code (particularly triangular linear interpolation) and OpenCV is used for fast mosaicing. If the Numba package is not installed then PyFibreBundle falls back on Python interpreted code.
The package was originally developed mostly for applications in endoscopic microscopy, including fluorescence endomicroscopy and holographic endomicroscopy, but there are also potential applications in endoscopy, industrial inspection etc.
Join the mailing list to hear about releases, updates and bug fixes.
Documentation
Read the full documentation.
Example Notebooks
These can be run online on Binder:
Journal Paper
The package is described in this paper, please cite it when using PyFibreBundle for academic work, as well as providing a link to this repository:
M. Hughes, Real-timing processing of fiber bundle endomicroscopy images in Python using PyFibreBundle, Applied Optics 62(34), 9041-9050 (2023). Link
Getting Started
There are three ways to get PyFibreBundle:
- Download the latest stable release from github and unzip. This will give you all the examples, tests and test data.
- Clone the github repository using git. This will give you the latest updates but more chance of bugs.
- Install the latest stable release using:
pip install PyFibreBundle
The third option (using pip install) should find and install all the dependencies. For the other two options you will need to either manually check you have the requirements installed, or navigate to the PyFibreBundle folder on your machine and run:
pip install -r requirements.txt
to install the dependencies. You may wish to create a virtual environment using Conda/venv first to avoid conflicts with your existing python setup.
Note that the pip install doesn't include the examples and tests which still need to be downloaded from Github.
Once installed, you can try running the examples.
Feature List
Core Functions
- Supports monochrome and multi-channel (e.g. colour) images.
- Locate bundle in image.
- Crop image to only show bundle.
- Mask areas outside of bundle.
- Determine core spacing.
- Find locations of all cores in bundle.
- Core removal by Gaussian filtering.
- Core removal using custom edge filtering.
- Core removal using triangular linear interpolation following Delaunay triangulation.
Mosaicing
- Detect image to image shift using normalised cross correlation.
- Insert image into mosaic either using dead-leaf or alpha blending.
- Expand or scroll mosaic when the edge of the mosaic image is reached.
Super Resolution
- Combine multiple shifted images to improve resolution.
Fibre Bundle Analysis
- Detect fibre core locations and compute various statistics.
Requirements
Required Packages:
- Numpy
- OpenCV
- Pillow
- Scipy
Optional Packages:
- Numba (for faster linear interpolation)
- Matplotlib (to run examples and tests)
Contributions
Development is led by Mike Hughes at the Applied Optics Group, Physics & Astronomy, University of Kent.
Bug reports, contributions and pull requests are welcome. Academic collaborations are welcomed and consultancy is available for potential commercial users, get in touch
Thanks to: Cheng Yong Xin, Joseph, who contributed to triangular linear interpolation; Callum McCall who contributed to the super resolution component, Petros Giataganas who developed some of the Matlab code that parts of this library were ported from.
The work was partly funded by EPSRC (Ultrathin fluorescence microscope in a needle, EP/R019274/1), the Royal Society (Ultrathin Inline Holographic Microscopy) and University of Kent.
Metadata
Release files for PyFibreBundle 1.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyfibrebundle-1.3.6.tar.gz | 46.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyfibrebundle-1.3.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 99.1 kB
Release files / pyfibrebundle-1.3.6.tar.gz
| Download URL | pyfibrebundle-1.3.6.tar.gz |
|---|---|
| Size | 46.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
631b317e8c2bb7f991a5cc96a14c6d444406d9b5cabee5f6bb38d48c9e1d3a30
|
|
BLAKE2b-256 checksum How to use checksums |
cd641f0d821390bae84ca5e16756bf59fef29e40bbd2e1f6528eb624b86ff76f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / pyfibrebundle-1.3.6-py3-none-any.whl
| Download URL | pyfibrebundle-1.3.6-py3-none-any.whl |
|---|---|
| Size | 52.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e1ab329a3f4a02f8bb92c20d9f4c5cde3f82aade59aee3d1b78f1a2572f46e8
|
|
BLAKE2b-256 checksum How to use checksums |
7456f84f5ebe4be76aa75ac547f2020c81362f9b60a95cae3d11c789c6311429
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|