zarr
insert_omero_metadata #
insert_omero_metadata(src, window_max=None, window_min=None, window_start=None, window_end=None, id=None, name=None)
Insert or update missing omero transitional metadata into .zattrs metadata of parent group for the input zarr array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src |
str
|
Path to Zarr array. |
required |
window_max |
int
|
Max view window value. Defaults to None. |
None
|
window_min |
int
|
Min view window value. Defaults to None. |
None
|
window_start |
int
|
Contrast min value. Defaults to None. |
None
|
window_end |
int
|
Contrast max value. Defaults to None. |
None
|
id |
int
|
Defaults to None. |
None
|
name |
str
|
Name of the dataset. Defaults to None. |
None
|
Source code in src/cellmap_utils/zarr/metadata.py
get_single_scale_metadata #
get_single_scale_metadata(ds_name, voxel_size, translation, name, units='nanometer', axes=['z', 'y', 'x'])
Returns multiscales ngff metadata with a single level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds_name |
str
|
name of the dataset that contains the data. |
required |
voxel_size |
list[float]
|
scale. Example: [1.0, 1.0, 1.0] |
required |
translation |
list[float]
|
offset. Example: [0.0, 0.0, 0.0] |
required |
name |
str
|
Name of a multiscale set. |
required |
units |
str
|
Physical units. Defaults to 'nanometer'. |
'nanometer'
|
axes |
list[str]
|
Axes labeling. Defaults to ['z', 'y', 'x']. |
['z', 'y', 'x']
|
Returns:
Name | Type | Description |
---|---|---|
_type_ |
description |
Source code in src/cellmap_utils/zarr/metadata.py
get_multiscale_metadata #
get_multiscale_metadata(voxel_size, translation, levels, units='nanometer', axes=['z', 'y', 'x'], name='')
Generates a multiscale metadata from specified voxel size, offset and multi-scale pyramid levels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
voxel_size |
list[float]
|
physical size of the voxel |
required |
translation |
list[float]
|
physical translation of the center of the voxel. |
required |
levels |
int
|
how many levels are present in the multis-scale pyramid. |
required |
units |
str
|
Physical units. Defaults to 'nanometer'. |
'nanometer'
|
axes |
list[str]
|
Axis order. Defaults to ['z', 'y', 'x']. |
['z', 'y', 'x']
|
name |
str
|
Name of the dataset that would utilize multi-scale metadata. Defaults to ''. |
''
|
Returns:
Name | Type | Description |
---|---|---|
_type_ |
description |
Source code in src/cellmap_utils/zarr/metadata.py
ome_ngff_only #
Delete all attrs from .zattrs that are not part of the OME-NGFF Zarr spec and CellMap metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zg |
Group
|
zarr group that contains multiscale metadata. |
required |
Source code in src/cellmap_utils/zarr/metadata.py
round_decimals #
Round scale and translation metadata
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group |
Group
|
zarr group with ome-zarr metadata |
required |
decimals |
int
|
number of decimals to round |
required |
Source code in src/cellmap_utils/zarr/metadata.py
access_parent #
Get the parent (zarr.Group) of an input zarr array(ds).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Array or Group
|
description |
required |
Raises:
Type | Description |
---|---|
RuntimeError
|
returned if the node array is in the parent group, |
Returns:
Type | Description |
---|---|
zarr.hierarchy.Group : parent group that contains input group/array |
Source code in src/cellmap_utils/zarr/node.py
repair_zarr_branch #
A recursive methond that adds missing .zgroup file in any parent zarr group between input zarr group and root of the zarr container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_zarr_path |
str
|
description |
required |
Source code in src/cellmap_utils/zarr/node.py
recalibrate_offset #
The offset of the roi at multiscale level with scale=grid_spacing must be divisible by grid_spacing. This method would recalibrate offset, if roi grid does not align with grid {scale : grid_spacing, translation : [0.0, 0.0, 0.0]}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
roi |
Group
|
roi zarr group with multiscale pyramid |
required |
grid_spacing |
list[float]
|
grid spacing, with assumption that translation=[0.0, 0.0, 0.0] |
required |
Returns:
Type | Description |
---|---|
Tuple[list[float], list[float]]
|
Tuple[list[float], list[float]]: returns (ROI s0 scale, recalibrated offset) |
Source code in src/cellmap_utils/zarr/roi.py
separate_store_path #
sometimes you can pass a total os path to node, leading to an empty('') node.path attribute. the correct way is to separate path to container(.n5, .zarr) from path to array within a container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
store |
string
|
path to store |
required |
path |
string
|
path array/group (.n5 or .zarr) |
required |
Returns:
Type | Description |
---|---|
(string, string)
|
returns regularized store and group/array path |
Source code in src/cellmap_utils/zarr/store.py
validate_ome #
thin wrapper method for ngff_zarr.validate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zg |
Group
|
the input zarr group with a json schema to validate. |
required |