..
  This file is generated by setup.py

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: 2025.9.18
: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.7, 3.14.0rc 64-bit
- `NumPy <https://pypi.org/project/numpy>`_ 2.3.3
- `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.10.6 (optional)
- `Tifffile <https://pypi.org/project/tifffile/>`_ 2025.9.9 (optional)
- `Click <https://pypi.python.org/pypi/click>`_ 8.2.1
  (optional, for command line apps)
- `Cython <https://pypi.org/project/cython/>`_ 3.1.4 (build)

Revisions
---------

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:

.. code-block:: python

    >>> with FbdFile('tests/data/flimbox$CBCO.fbd') as fbd:
    ...     bins, times, markers = fbd.decode()
    ...
    >>> 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(numpy.argmax(hist[0]))
    53
    >>> image = fbd.asimage((bins, times, markers))
    >>> image.shape
    (1, 2, 256, 256, 64)

View the histogram and metadata in a FLIMbox data file from the console::

    $ python -m fbdfile tests/data/flimbox$CBCO.fbd