LimImageSource class¶
This class is mainly used for converting images of different formats to ND2 format. It serves as a locator for specific image frame (just filepath for most image formats, filepath + IDF for TIFF files).
This class is not a part of the base limnd2 namespace, but is instead accessible through the limnd2.tools namespace like this:
LimImageSource ¶
Abstract class for reading images of different formats. Currently supported formats are:
- TIFF and its subformats (
.ome.tiff,.btf,.tif,.tiff) - LSM (
.lsm) - CZI (
.czi) - OIF/OIB (
.oif,.oib) - PNG (
.png) - JPEG (
.jpg,.jpeg) - ND2 (
.nd2)
This class provides a common interface for reading images and converting them to ND2 format, as well as for extracting additional information from the images.
Warning
This class is not intended to be used directly, but rather as a base class for specific image source classes.
In order to correctly create object of this class, use the open()
method, which will automatically detect the file type and create the appropriate LimImageSource object.
get_file_dimensions ¶
Return dimensions inside just the file. In OME TIFF file, this will return OME dimensions within file. In multipage file, this will return unknown dimension in the file. In other file formats, this will return empty dictionary.
metadata_as_pattern_settings ¶
Return metadata as a dictionary for internal usage in QML.
nd2_attributes
abstractmethod
¶
nd2_attributes(*, sequence_count=1) -> ImageAttributes
Get ND2 attributes from the image source.
Note
If you use those attributes when converting file sequence to ND2, you need to replace the sequence count with the number of files in the sequence. You must also set component count if you use convert multichannel ND2 image.
open
staticmethod
¶
open(filename: str | Path) -> LimImageSource
Create a LimImageSource object from a filename.
This will automatically detect the file type and create the appropriate LimImageSource object (LimImageSourceTiff, LimImageSourcePng, ...).
read
abstractmethod
¶
Read the image into numpy array writeable by limnd2 library.
merge_four_fields ¶
Merge only: time_step, z_step, channels, metadata.
Rules:
- Keep A as source of truth.
- For numbers: fill A.