Code reference¶
This section does not cover the base classes, methods, and constants of qpimage, which can be found here.
module level aliases¶
For user convenience, the following objects are available at the module level.
- class flimage.FLImage¶
alias of
flimage.core.FLImage
- class flimage.FLSeries¶
alias of
flimage.series.FLSeries
- flimage.META_KEYS_FL¶
alias of
flimage.meta.META_KEYS_FL
core (FLImage)¶
Classes¶
- class flimage.core.FLImage(data=None, meta_data={}, h5file=None, h5mode='a', h5dtype='float32')[source]¶
Fluorescence image manipulation
This class makes available fluorescence microscopy data in a manner similar to
qpimage.QPImage
.- Parameters
data (2d ndarray (float or complex) or list) – The experimental fluorescence image.
meta_data (dict) – Meta data associated with the input data. see
flimage.meta.META_KEYS
h5file (str, pathlib.Path, h5py.Group, h5py.File, or None) – A path to an hdf5 data file where all data is cached. If set to None (default), all data will be handled in memory using the “core” driver of the
h5py
’sFile
class. If the file does not exist, it is created. If the file already exists, it is opened with the file mode defined by hdf5_mode. If this is an instance of h5py.Group or h5py.File, then this will be used to internally store all data.h5mode (str) –
Valid file modes are (only applies if h5file is a path)
”r”: Readonly, file must exist
”r+”: Read/write, file must exist
”w”: Create file, truncate if exists
”w-” or “x”: Create file, fail if exists
”a”: Read/write if exists, create otherwise (default)
h5dtype (str) – The datatype in which to store the image data. The default is “float32” which is sufficient for 2D image analysis and consumes only half the disk space of the numpy default “float64”.
- property bg_fl¶
background fluorescence image
- property fl¶
background-corrected fluorescence image
- property dtype¶
dtype of the fluorescence data array
- property info¶
list of tuples with FLImage meta data
- property meta¶
dictionary with imaging meta data
- property raw_fl¶
raw fluorescence image
- property shape¶
size of image dimensions
image_data (basic image management)¶
Classes¶
- class flimage.image_data.Fluorescence(h5, h5dtype='float32')[source]¶
Bases:
qpimage.image_data.Phase
Dedicated class for fluorescence data
For fluorescence data, background correction is defined by subtracting the background image from the raw image.
- Parameters
h5 (h5py.Group) – HDF5 group where all data is kept
h5dtype (str) – The datatype in which to store the image data. The default is “float32” which is sufficient for 2D image analysis and consumes only half the disk space of the numpy default “float64”.
meta (definitions for FLImage meta data)¶
Constants¶
- flimage.meta.META_KEYS_FL = ['pixel size', 'time', 'flimage version', 'identifier', 'qpimage version', 'sim center', 'sim model', 'sim radius']¶
valid
flimage.core.FLImage
meta data keys
series (FLSeries)¶
Classes¶
- class flimage.series.FLSeries(flimage_list=[], meta_data={}, h5file=None, h5mode='a', identifier=None)[source]¶
Fluorescence microscopy series data
- Parameters
flimage_list (list) – A list of instances of
flimage.FLImage
.meta_data (dict) – Meta data associated with the input data (see
flimage.META_KEYS
). This overrides the meta data of the FLImages in flimage_list and, if h5file is given and h5mode is not “r”, overrides the meta data in h5file.h5file (str, h5py.Group, h5py.File, or None) – A path to an hdf5 data file where all data is cached. If set to None (default), all data will be handled in memory using the “core” driver of the
h5py
’sFile
class. If the file does not exist, it is created. If the file already exists, it is opened with the file mode defined by hdf5_mode. If this is an instance of h5py.Group or h5py.File, then this will be used to internally store all data. If h5file is given and flimage_list is not empty, all FLImages in flimage_list are appended to h5file in the given order.h5mode (str) –
Valid file modes are (only applies if h5file is a path):
”r”: Readonly, file must exist
”r+”: Read/write, file must exist
”w”: Create file, truncate if exists
”w-” or “x”: Create file, fail if exists
”a”: Read/write if exists, create otherwise (default)
- property identifier¶
unique identifier of the series
- add_flimage(fli, identifier=None)[source]¶
Add a FLImage instance to the FLSeries
- Parameters
fli (flimage.FLImage) – The FLImage that is added to the series
identifier (str) – Identifier key for fli
- bleach_correction(h5out=None, border_px=20, flscorr=None, count=None, max_count=None)[source]¶
Perform a correction for photobleaching
Bleaching is modeled with an exponential and an offset.
- Parameters
h5out (path or h5py.Group) – A new FLSeries will be written to this HDF5 file or h5py group.
border_px (int) – Number of border pixels to include for background estimation.
flscorr (flimage.series.FLSeries) – Apply the background correction to this FLSeries instead of the current instance. Use this in combination with filtered versions of the same series.
- Returns
bg (float) – Background value subtracted from each image
flint (1d ndarray) – Fluorescence intensity trace extracted from the series
decay (1d ndarray) – Exponential fit to flint
times (1d ndarray) – Recording times corresponding to the indices in flint and decay
Notes
It is recommended to first denoise the fluorescence data with FLSeries.denoise do avoid an amplification of the background noise.