Readers¶
Read multi-FOV datasets¶
read_images(path, data_type=None)
¶
Read image arrays and metadata from a Micro-Manager dataset. Supported formats are Micro-Manager-acquired TIFF datasets (single-page TIFF, multi-page OME-TIFF, NDTIFF), and converted OME-Zarr (v0.1/v0.4 HCS layout assuming a linear structure).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
StrOrBytesPath
|
File path, directory path to ome-tiff series, or Zarr root path |
required |
data_type
|
Literal['singlepagetiff', 'ometiff', 'ndtiff', 'omezarr']
|
|
None
|
Literal
|
Dataset format, by default None |
required |
Returns:
| Type | Description |
|---|---|
ReaderBase | BaseFOVMapping
|
Image collection object for the dataset |
MMStack OME-TIFF¶
MMStack
¶
Bases: MicroManagerFOVMapping
Micro-Manager multi-file OME-TIFF (MMStack) reader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_path
|
StrOrBytesPath
|
Path to the directory containing OME-TIFF files or the path to the first OME-TIFF file in the series |
required |
root
property
¶
Root directory of the dataset.
micromanager_summary
property
¶
Micro-manager summary metadata.
hcs_position_labels
property
¶
Parse plate position labels generated by the HCS position generator and split them into (row, column, FOV) components.
This method supports multiple label formats commonly produced by
micromanager. The returned values are a 3-part tuple with the
following interpretation:
- row: usually a letter (e.g. 'A'), or '0' if not explicitly given
- column: the well column number or site index
- fov: the field-of-view index, typically zero-padded
Supported label formats and their outputs:
================ ======================== Format Output ================ ======================== "A1-Site_0" ('A', '1', '0') "1-Pos000_000" ('0', '1', '000000') "2-Pos000_001" ('0', '2', '000001') "1-Pos001" ('0', '1', '001000') "Pos-5-000_005" ('0', '5', '000005') ================ ========================
Returns:
| Type | Description |
|---|---|
list[tuple[str, str, str]]
|
A list of (row, column, fov) tuples corresponding to parsed label components in a uniform format. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If stage position metadata is missing or labels are not found. |
close()
¶
Close file handles
read_image_metadata(p, t, c, z)
¶
Read image plane metadata from the OME-TIFF file.
MMOmeTiffFOV
¶
NDTiff¶
NDTiffDataset
¶
Bases: MicroManagerFOVMapping
Reader for ND-TIFF datasets acquired with Micro/Pycro-Manager,
effectively a wrapper of the ndtiff.Dataset class.
str_position_axis
property
¶
Position axis is string-valued
str_channel_axis
property
¶
Channel axis is string-valued
root
property
¶
Root directory of the dataset.
micromanager_summary
property
¶
Micro-manager summary metadata.
hcs_position_labels
property
¶
Parse plate position labels generated by the HCS position generator and split them into (row, column, FOV) components.
This method supports multiple label formats commonly produced by
micromanager. The returned values are a 3-part tuple with the
following interpretation:
- row: usually a letter (e.g. 'A'), or '0' if not explicitly given
- column: the well column number or site index
- fov: the field-of-view index, typically zero-padded
Supported label formats and their outputs:
================ ======================== Format Output ================ ======================== "A1-Site_0" ('A', '1', '0') "1-Pos000_000" ('0', '1', '000000') "2-Pos000_001" ('0', '2', '000001') "1-Pos001" ('0', '1', '001000') "Pos-5-000_005" ('0', '5', '000005') ================ ========================
Returns:
| Type | Description |
|---|---|
list[tuple[str, str, str]]
|
A list of (row, column, fov) tuples corresponding to parsed label components in a uniform format. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If stage position metadata is missing or labels are not found. |
get_image_metadata(p, t, c, z)
¶
Return image plane metadata at the requested PTCZ coordinates
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
int or str
|
position index |
required |
t
|
int
|
time index |
required |
c
|
int or str
|
channel index |
required |
z
|
int
|
slice/z index |
required |
Returns:
| Type | Description |
|---|---|
dict | None
|
Image plane metadata. None if not available. |
ClearControl¶
ClearControlFOV
¶
Bases: BaseFOV
Reader class for Clear Control dataset https://github.com/royerlab/opensimview.
It provides an array-like API for the Clear Control dataset thats loads the volumes lazily.
It assumes the channels and volumes have the same shape, when that is not the case the minimum value from each dimension is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_path
|
StrOrBytesPath
|
Clear Control dataset path. |
required |
missing_value
|
Optional[int]
|
If provided this class won't raise an error when missing a volume and it will return an array with the provided value. |
None
|
cache
|
bool
|
When true caches the last array using the first two indices as key. |
False
|
shape
property
¶
Reads Clear Control index data of every data and returns the element-wise minimum shape.
channel_names
property
¶
Return sorted channels name.
scale
property
¶
Dataset temporal, channel and spacial scales.
zyx_scale
property
¶
Helper function for FOV spatial scale (micrometer).
t_scale
property
¶
Helper function for FOV time scale (seconds).
__getitem__(key)
¶
Lazily load array as indexed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
ArrayIndex | tuple[ArrayIndex, ...]
|
An indexing key as in numpy, but a bit more limited. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Output array. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Not all numpy array of indexing are implemented. |
metadata()
¶
Summarizes Clear Control metadata into a dictionary.
channel_index(key)
¶
Return index of given channel.
MM TIFF Sequence (deprecated)¶
MicromanagerSequenceReader
¶
Bases: ReaderBase
shape
property
¶
Get the underlying data shape as a tuple.
Returns:
| Type | Description |
|---|---|
tuple
|
(frames, slices, channels, height, width) |
hcs_position_labels
property
¶
Parse plate position labels generated by the HCS position generator, e.g. 'A1-Site_0' or '1-Pos000_000', and split into row, column, and FOV names.
Returns:
| Type | Description |
|---|---|
list[tuple[str, str, str]]
|
FOV name paths, e.g. ('A', '1', '0') or ('0', '1', '000000') |
get_zarr(position)
¶
return a zarr array for a given position
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
position |
array
|
|
get_array(position)
¶
return a numpy array for a given position
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
position |
ndarray
|
|
get_num_positions()
¶
get total number of scenes referenced in ome-tiff metadata
Returns:
| Type | Description |
|---|---|
number of positions (int)
|
|
read_tiff_series(folder)
¶
given a folder containing position subfolders, each of which contains single-page-tiff series acquired using micro-manager, parse the metadata to map image coordinates to filepaths/names
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str
|
project folder containing all position subfolders |
required |
Returns:
| Type | Description |
|---|---|
coord_filename_map(dict)
|
keys are coordinates and values are filenames. Coordinates follow (p, t, c, z) indexing. |
PTI TIFF (deprecated)¶
UPTIReader
¶
Bases: ReaderBase
Reader for UPTI raw data. Accepts both new live UPTI and older UPTI format.
hcs_position_labels
property
¶
Parse plate position labels generated by the HCS position generator, e.g. 'A1-Site_0' or '1-Pos000_000', and split into row, column, and FOV names.
Returns:
| Type | Description |
|---|---|
list[tuple[str, str, str]]
|
FOV name paths, e.g. ('A', '1', '0') or ('0', '1', '000000') |
get_zarr(position)
¶
return a zarr array for a given position. Allows for only one position
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
position |
array
|
|
get_array(position)
¶
return a numpy array for a given position. Allows for only one position
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
position |
ndarray
|
|
get_image(p, t, c, z)
¶
Get the image slice at dimension P, T, C, Z.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
int
|
index of the position dimension |
required |
t
|
int
|
index of the time dimension |
required |
c
|
int
|
index of the channel dimension |
required |
z
|
int
|
index of the z dimension |
required |
Returns:
| Type | Description |
|---|---|
NDArray
|
2D image frame |