fbdfile 2026.2.6
Read FLIMbox data and related files (FBD, FBF, and FBS.XML)
License: BSD-3-Clause
Requires Python: >=3.11

Read FLIMbox data and related files (FBD, FBF, and FBS.XML)
===========================================================

Fbdfile is a Python library to read FLIMbox data (FBD), firmware (FBF), and
setting (FBS.XML) files. The FLIMbox is an FPGA-based device for high
bandwidth, multi-channel data collection for fluorescence lifetime-resolved
imaging (FLIM) from a pulsed laser scanning confocal microscope.
The files are written by SimFCS and ISS VistaVision software.

:Author: `Christoph Gohlke <https://www.cgohlke.com>`_
:License: BSD-3-Clause
:Version: 2026.2.6
:DOI: `10.5281/zenodo.17136073 <https://doi.org/10.5281/zenodo.17136073>`_

Quickstart
----------

Install the fbdfile package and all dependencies from the
`Python Package Index <https://pypi.org/project/fbdfile/>`_::

    python -m pip install -U fbdfile[all]

See `Examples`_ for using the programming interface.

Source code and support are available on
`GitHub <https://github.com/cgohlke/fbdfile>`_.

Requirements
------------

This revision was tested with the following requirements and dependencies
(other versions may work):

- `CPython <https://www.python.org>`_ 3.11.9, 3.12.10, 3.13.12, 3.14.3 64-bit
- `NumPy <https://pypi.org/project/numpy>`_ 2.4.2
- `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.10.8 (optional)
- `Tifffile <https://pypi.org/project/tifffile/>`_ 2026.1.28 (optional)
- `Click <https://pypi.python.org/pypi/click>`_ 8.3.1
  (optional, for command line apps)
- `Cython <https://pypi.org/project/cython/>`_ 3.2.4 (build)

Revisions
---------

2026.2.6

- Fix code review issues.

2026.1.14

- Improve code quality.

2025.12.12

- Add attrs property to FbdFile.
- Improve code quality.

2025.11.8

- Allow to override FbdFile decoder, firmware, and settings.
- Always try to load settings from .fbs.xml file.
- Factor out BinaryFile base class.
- Derive FbdFileError from ValueError.
- Build ABI3 wheels.

2025.9.18

- Fix reading FBF and FBS files from streams.

2025.9.17

- Make frame_markers a numpy array.
- Add options to specify number of OpenMP threads.

2025.9.16

- Initial alpha release based on lfdfiles 2025.7.31.

Notes
-----

The API is not stable yet and might change between revisions.

Python <= 3.10 is no longer supported. 32-bit versions are deprecated.

The latest Microsoft Visual C++ Redistributable for Visual Studio 2015-2022
is required on Windows.

The FLIMbox formats are not documented and might change arbitrarily.
This implementation is based on reverse engineering existing files.
No guarantee can be made as to the correctness of code and documentation.

`SimFCS <https://www.lfd.uci.edu/globals/>`_, a.k.a. Globals for Images,
is software for fluorescence image acquisition, analysis, and simulation,
developed by Enrico Gratton at UCI.

`VistaVision <http://www.iss.com/microscopy/software/vistavision.html>`_
is commercial software for instrument control, data acquisition, and data
processing by ISS Inc (Champaign, IL).

Examples
--------

Read a FLIM lifetime image and metadata from an FBD file:

>>> with FbdFile('tests/data/flimbox_data$CBCO.fbd') as fbd:
...     bins, times, markers = fbd.decode()
...     image = fbd.asimage()
...
>>> image.shape
(1, 2, 256, 256, 64)
>>> print(bins[0, :2], times[:2], markers[:2])
[50 58] [ 0 32] [1944097 2024815]
>>> import numpy
>>> hist = [numpy.bincount(b[b >= 0]) for b in bins]
>>> int(hist[0].argmax())
53

View the histogram and metadata in a FLIMbox data file from the console::

    $ python -m fbdfile tests/data/flimbox_data$CBCO.fbd