iaf.io.readers¶
Custom image readers.
- class iaf.io.readers.HuygensHDF5Reader(filename: Path | str = None)[source]¶
Bases:
objectHuygens HDF5 Reader.
Example:
from iaf.io.readers import HuygensHDF5Reader # Initialize the reader reader = HuygensHDF5Reader("file.h5") # To load a specific (timepoint, channel) image or stack: stack = reader.load(timepoint=0, channel=0)
Stacks are lazily loaded only on access.
The reader exposes metadata information via properties:
Property
Explanation
reader.channel_namesTuple of names for each of the acquisition channels.
reader.filenameFull file name of the opened file.
reader.num_channelsNumber of channels.
reader.num_planesNumber of planes (z levels).
reader.num_timepointsNumber of time points.
reader.voxel_sizesVoxel sizes in units (nm)
(x, y, z).reader.metadataDictionary of microscopy parameters.
reader.hdf5_datasetHDF5 dataset for advanced use.
- property channel_names: tuple¶
Return the names of the channels.
- Returns:
channel_names – Names of the channels
- Return type:
- property filename: str¶
Return the file name with full path.
- Returns:
filename – Full file name, or empty string if not set.
- Return type:
- property hdf5_dataset: Dataset | None¶
Return the underlying HDF5 dataset.
- Returns:
hdf5_dataset – HD5 dataset if a file is open, or None otherwise.
- Return type:
h5py.Dataset
- property metadata: dict¶
Return the metadata dictionary.
- Returns:
metadata – Metadata dictionary.
- Return type:
- property num_channels: int¶
Return the number of channels.
- Returns:
num_channels – Number of channels per series in the file. If no file is open, num_channels is 0.
- Return type:
- property num_planes: int¶
Return the number of planes.
- Returns:
num_planes – Number of planes per series in the file. If no file is open, num_planes is 0.
- Return type:
- property num_timepoints: int¶
Return the number of timepoints.
- Returns:
num_timepoints – Number of timepoints per series in the file. If no file is open, num_timepoints is 0.
- Return type:
- class iaf.io.readers.ImarisReader(filename: Path | str = None)[source]¶
Bases:
objectImaris Reader.
Example:
from iaf.io.readers import ImarisReader # Initialize the reader reader = ImarisReader("file.ims") # To load a specific (timepoint, channel) image or stack: stack = reader.load(timepoint=0, channel=0)
Stacks are lazily loaded only on access.
The reader exposes metadata information via properties:
Property
Explanation
reader.channel_namesTuple of names for each of the acquisition channels.
reader.filenameFull file name of the opened file.
reader.num_channelsNumber of channels.
reader.num_planesNumber of planes (z levels).
reader.num_timepointsNumber of time points.
reader.voxel_sizesVoxel sizes in units (µm)
(x, y, z).reader.extendsExtents in units (µm)
(minX, maxX, minY, maxY, minZ, maxZ).- property channel_names: tuple¶
Return the names of the channels.
- Returns:
channel_names – Names of the channels
- Return type:
- property extends: tuple¶
Return the dataset extends.
- Returns:
extends – Dataset extends: (extMinX, extMaxX, extMinY, extMaxY, extMinZ, extMaxZ)
- Return type:
- property filename: str¶
Return the file name with full path.
- Returns:
filename – Full file name, or empty string if not set.
- Return type:
- load(timepoint: int = 0, channel: int = 0, resolution_level: int = 0)[source]¶
Load specific timepoint and channel.
- Parameters:
- Returns:
dataset – Dataset at the requested timepoint and channel.
- Return type:
Union[None, DataSet, np.ndarray]
- property num_channels: int¶
Return the number of channels.
- Returns:
num_channels – Number of channels per series in the file. If no file is open, num_channels is 0.
- Return type:
- property num_planes: int¶
Return the number of planes.
- Returns:
num_planes – Number of planes per series in the file. If no file is open, num_planes is 0.
- Return type:
- property num_timepoints: int¶
Return the number of timepoints.
- Returns:
num_timepoints – Number of timepoints per series in the file. If no file is open, num_timepoints is 0.
- Return type:
- class iaf.io.readers.NikonND2Reader(filename: Path | str = None)[source]¶
Bases:
object- Nikon ND2 reader that internally uses [nd2reader](https://open-science-tools.github.io/nd2reader/) by
Ruben Verweij.
Example:
from iaf.io.readers import NikonND2Reader # Initialize the reader reader = NikonND2Reader("file.nd2") # To iterate over all series (or timepoints): for img in reader: pass # To access a specific series (or timepoint): stack = reader[0]
Series (or timepoints) are lazily loaded only on access.
The reader exposes metadata information via properties:
Property
Explanation
reader.channel_namesTuple of names for each of the acquisition channels.
reader.filenameFull file name of the opened file.
reader.geometryGeometry for each series.
reader.iter_axisAxis over which the iteration occurs (one of
"v"or"t").reader.metadataProcessed file metadata (dictionary).
reader.num_channelsNumber of channels.
reader.num_planesNumber of planes (z levels).
reader.num_seriesNumber of series (acquisitions) in the file.
reader.num_timepointsNumber of time points.
reader.voxel_sizesVoxel sizes in units (µm)
(x, y, z).If a file contains several series,
iter_axiswill be"v": that is, the iterator will return one series at a time. If there is only one series, however,iter_axiswill point to the next dimension, that is"t". In this case, the iterator will return one time point at a time. No more granularity is supported. In all cases, the geometry property will indicate the dimensionality of the array returned by the iterator (e.g.,"czyx").- property channel_names: tuple¶
Return the names of the channels.
- Returns:
channel_names – Voxel sizes (x, y, z)
- Return type:
- property filename: str¶
Return the file name with full path.
- Returns:
filename – Full file name, or empty string if not set.
- Return type:
- property geometry: str¶
Return the geometry of the individual image or stack.
- Returns:
geometry – Geometry of the individual image or stack. If no file is open, geometry is “”.
- Return type:
- property iter_axis: str¶
Return the axis used for iterating over individual images or stacks.
- Returns:
iter_axis – Axis used for iterating over individual images of stacks. If no file is open, iter_axis is “”.
- Return type:
- property metadata: dict¶
Return the processed file metadata.
- Returns:
matadata – Metadata dictionary. If no file is open, metadata is {}.
- Return type:
- property num_channels: int¶
Return the number of channels.
- Returns:
num_channels – Number of channels per series in the file. If no file is open, num_channels is 0.
- Return type:
- property num_planes: int¶
Return the number of planes.
- Returns:
num_planes – Number of planes per series in the file. If no file is open, num_planes is 0.
- Return type:
- property num_series: int¶
Return the number of series.
- Returns:
num_series – Number of series in the file. If no file is open, num_series is 0.
- Return type:
- property num_timepoints: int¶
Return the number of timepoints.
- Returns:
num_timepoints – Number of timepoints per series in the file. If no file is open, num_timepoints is 0.
- Return type:
- property raw_metadata: None | dict¶
Return the raw file metadata.
- Returns:
raw_metadata – If no file is open, raw_metadata is None.
- Return type:
object of type [RawMetadata](https://open-science-tools.github.io/nd2reader/nd2reader.html#module-nd2reader.raw_metadata).