OmeZarrContainer: API Documentation¶
Open an OME-Zarr Container¶
ngio.open_ome_zarr_container
¶
open_ome_zarr_container(
store: StoreOrGroup,
cache: bool = False,
mode: AccessModeLiteral = "r+",
axes_setup: AxesSetup | None = None,
validate_arrays: bool = True,
) -> OmeZarrContainer
Open an OME-Zarr image.
Source code in ngio/images/_ome_zarr_container.py
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | |
Create an OME-Zarr Container¶
ngio.create_empty_ome_zarr
¶
create_empty_ome_zarr(
store: StoreOrGroup,
shape: Sequence[int],
pixelsize: float | tuple[float, float] | None = None,
z_spacing: float = 1.0,
time_spacing: float = 1.0,
scaling_factors: Sequence[float]
| Literal["auto"] = "auto",
levels: int | list[str] = 5,
translation: Sequence[float] | None = None,
space_unit: SpaceUnits = DefaultSpaceUnit,
time_unit: TimeUnits = DefaultTimeUnit,
axes_names: Sequence[str] | None = None,
channels_meta: Sequence[str | Channel] | None = None,
name: str | None = None,
axes_setup: AxesSetup | None = None,
ngff_version: NgffVersions = DefaultNgffVersion,
chunks: ChunksLike = "auto",
shards: ShardsLike | None = None,
dtype: str = "uint16",
dimension_separator: Literal[".", "/"] = "/",
compressors: CompressorLike = "auto",
extra_array_kwargs: Mapping[str, Any] | None = None,
overwrite: bool = False,
xy_pixelsize: float | None = None,
xy_scaling_factor: float | None = None,
z_scaling_factor: float | None = None,
channel_labels: list[str] | None = None,
channel_wavelengths: list[str] | None = None,
channel_colors: Sequence[str] | None = None,
channel_active: Sequence[bool] | None = None,
) -> OmeZarrContainer
Create an empty OME-Zarr image with the given shape and metadata.
Parameters:
-
store(StoreOrGroup) –The Zarr store or group to create the image in.
-
shape(Sequence[int]) –The shape of the image.
-
pixelsize(float | tuple[float, float] | None, default:None) –The pixel size in x and y dimensions.
-
z_spacing(float, default:1.0) –The spacing between z slices. Defaults to 1.0.
-
time_spacing(float, default:1.0) –The spacing between time points. Defaults to 1.0.
-
scaling_factors(Sequence[float] | Literal['auto'], default:'auto') –The down-scaling factors for the pyramid levels. Defaults to "auto".
-
levels(int | list[str], default:5) –The number of levels in the pyramid or a list of level names. Defaults to 5.
-
translation(Sequence[float] | None, default:None) –The translation for each axis. at the highest resolution level. Defaults to None.
-
space_unit(SpaceUnits, default:DefaultSpaceUnit) –The unit of space. Defaults to DefaultSpaceUnit.
-
time_unit(TimeUnits, default:DefaultTimeUnit) –The unit of time. Defaults to DefaultTimeUnit.
-
axes_names(Sequence[str] | None, default:None) –The names of the axes. If None the canonical names are used. Defaults to None.
-
channels_meta(Sequence[str | Channel] | None, default:None) –The channels metadata. Defaults to None.
-
name(str | None, default:None) –The name of the image. Defaults to None.
-
axes_setup(AxesSetup | None, default:None) –Axes setup to create ome-zarr with non-standard axes configurations. Defaults to None.
-
ngff_version(NgffVersions, default:DefaultNgffVersion) –The version of the OME-Zarr specification. Defaults to DefaultNgffVersion.
-
chunks(ChunksLike, default:'auto') –The chunk shape. Defaults to "auto".
-
shards(ShardsLike | None, default:None) –The shard shape. Defaults to None.
-
dtype(str, default:'uint16') –The data type of the image. Defaults to "uint16".
-
dimension_separator(Literal['.', '/'], default:'/') –The dimension separator to use. Defaults to "/".
-
compressors(CompressorLike, default:'auto') –The compressor to use. Defaults to "auto".
-
extra_array_kwargs(Mapping[str, Any] | None, default:None) –Extra arguments to pass to the zarr array creation. Defaults to None.
-
overwrite(bool, default:False) –Whether to overwrite an existing image. Defaults to False.
-
xy_pixelsize(float | None, default:None) –Deprecated. Use pixelsize instead.
-
xy_scaling_factor(float | None, default:None) –Deprecated. Use scaling_factors instead.
-
z_scaling_factor(float | None, default:None) –Deprecated. Use scaling_factors instead.
-
channel_labels(list[str] | None, default:None) –Deprecated. Use channels_meta instead.
-
channel_wavelengths(list[str] | None, default:None) –Deprecated. Use channels_meta instead.
-
channel_colors(Sequence[str] | None, default:None) –Deprecated. Use channels_meta instead.
-
channel_active(Sequence[bool] | None, default:None) –Deprecated. Use channels_meta instead.
Source code in ngio/images/_ome_zarr_container.py
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | |
ngio.create_ome_zarr_from_array
¶
create_ome_zarr_from_array(
store: StoreOrGroup,
array: ndarray,
pixelsize: float | tuple[float, float] | None = None,
z_spacing: float = 1.0,
time_spacing: float = 1.0,
scaling_factors: Sequence[float]
| Literal["auto"] = "auto",
levels: int | list[str] = 5,
translation: Sequence[float] | None = None,
space_unit: SpaceUnits = DefaultSpaceUnit,
time_unit: TimeUnits = DefaultTimeUnit,
axes_names: Sequence[str] | None = None,
channels_meta: Sequence[str | Channel] | None = None,
percentiles: tuple[float, float] = (0.1, 99.9),
name: str | None = None,
axes_setup: AxesSetup | None = None,
ngff_version: NgffVersions = DefaultNgffVersion,
chunks: ChunksLike = "auto",
shards: ShardsLike | None = None,
dimension_separator: Literal[".", "/"] = "/",
compressors: CompressorLike = "auto",
extra_array_kwargs: Mapping[str, Any] | None = None,
overwrite: bool = False,
xy_pixelsize: float | None = None,
xy_scaling_factor: float | None = None,
z_scaling_factor: float | None = None,
channel_labels: list[str] | None = None,
channel_wavelengths: list[str] | None = None,
channel_colors: Sequence[str] | None = None,
channel_active: Sequence[bool] | None = None,
) -> OmeZarrContainer
Create an OME-Zarr image from a numpy array.
Parameters:
-
store(StoreOrGroup) –The Zarr store or group to create the image in.
-
array(ndarray) –The image data.
-
pixelsize(float | tuple[float, float] | None, default:None) –The pixel size in x and y dimensions.
-
z_spacing(float, default:1.0) –The spacing between z slices. Defaults to 1.0.
-
time_spacing(float, default:1.0) –The spacing between time points. Defaults to 1.0.
-
scaling_factors(Sequence[float] | Literal['auto'], default:'auto') –The down-scaling factors for the pyramid levels. Defaults to "auto".
-
levels(int | list[str], default:5) –The number of levels in the pyramid or a list of level names. Defaults to 5.
-
translation(Sequence[float] | None, default:None) –The translation for each axis. at the highest resolution level. Defaults to None.
-
space_unit(SpaceUnits, default:DefaultSpaceUnit) –The unit of space. Defaults to DefaultSpaceUnit.
-
time_unit(TimeUnits, default:DefaultTimeUnit) –The unit of time. Defaults to DefaultTimeUnit.
-
axes_names(Sequence[str] | None, default:None) –The names of the axes. If None the canonical names are used. Defaults to None.
-
channels_meta(Sequence[str | Channel] | None, default:None) –The channels metadata. Defaults to None.
-
percentiles(tuple[float, float], default:(0.1, 99.9)) –The percentiles of the channels for computing display ranges. Defaults to (0.1, 99.9).
-
name(str | None, default:None) –The name of the image. Defaults to None.
-
axes_setup(AxesSetup | None, default:None) –Axes setup to create ome-zarr with non-standard axes configurations. Defaults to None.
-
ngff_version(NgffVersions, default:DefaultNgffVersion) –The version of the OME-Zarr specification. Defaults to DefaultNgffVersion.
-
chunks(ChunksLike, default:'auto') –The chunk shape. Defaults to "auto".
-
shards(ShardsLike | None, default:None) –The shard shape. Defaults to None.
-
dimension_separator(Literal['.', '/'], default:'/') –The separator to use for dimensions. Defaults to "/".
-
compressors(CompressorLike, default:'auto') –The compressors to use. Defaults to "auto".
-
extra_array_kwargs(Mapping[str, Any] | None, default:None) –Extra arguments to pass to the zarr array creation. Defaults to None.
-
overwrite(bool, default:False) –Whether to overwrite an existing image. Defaults to False.
-
xy_pixelsize(float | None, default:None) –Deprecated. Use pixelsize instead.
-
xy_scaling_factor(float | None, default:None) –Deprecated. Use scaling_factors instead.
-
z_scaling_factor(float | None, default:None) –Deprecated. Use scaling_factors instead.
-
channel_labels(list[str] | None, default:None) –Deprecated. Use channels_meta instead.
-
channel_wavelengths(list[str] | None, default:None) –Deprecated. Use channels_meta instead.
-
channel_colors(Sequence[str] | None, default:None) –Deprecated. Use channels_meta instead.
-
channel_active(Sequence[bool] | None, default:None) –Deprecated. Use channels_meta instead.
Source code in ngio/images/_ome_zarr_container.py
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | |
OmeZarrContainer Class¶
ngio.OmeZarrContainer
¶
OmeZarrContainer(
group_handler: ZarrGroupHandler,
table_container: TablesContainer | None = None,
label_container: LabelsContainer | None = None,
axes_setup: AxesSetup | None = None,
validate_paths: bool = False,
)
This class is an object representation of an OME-Zarr image.
It provides methods to access
- The multiscale image metadata
- To open images at different levels of resolution
- To access labels and tables associated with the image.
- To derive new images, labels, and add tables to the image.
- To modify the image metadata, such as axes units and channel metadata.
Attributes:
-
images_container(ImagesContainer) –The container for the images.
-
labels_container(LabelsContainer) –The container for the labels.
-
tables_container(TablesContainer) –The container for the tables.
Initialize the OmeZarrContainer.
Parameters:
-
group_handler(ZarrGroupHandler) –The Zarr group handler.
-
table_container(TablesContainer | None, default:None) –The tables container.
-
label_container(LabelsContainer | None, default:None) –The labels container.
-
axes_setup(AxesSetup | None, default:None) –Axes setup to load ome-zarr with non-standard axes configurations.
-
validate_paths(bool, default:False) –Whether to validate the paths of the image multiscale
Source code in ngio/images/_ome_zarr_container.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
images_container
property
¶
images_container: ImagesContainer
wavelength_ids
property
¶
wavelength_ids: list[str | None]
Return the list of wavelength of the image.
get_channel_idx
¶
get_channel_idx(
channel_label: str | None = None,
wavelength_id: str | None = None,
) -> int
Get the index of a channel by its label or wavelength ID.
Source code in ngio/images/_ome_zarr_container.py
295 296 297 298 299 300 301 | |
set_channel_meta
¶
set_channel_meta(
channel_meta: ChannelsMeta | None = None,
labels: Sequence[str | None] | int | None = None,
wavelength_id: Sequence[str | None] | None = None,
start: Sequence[float | None] | None = None,
end: Sequence[float | None] | None = None,
percentiles: tuple[float, float] | None = None,
colors: Sequence[str | None] | None = None,
active: Sequence[bool | None] | None = None,
**omero_kwargs: dict,
) -> None
Create a ChannelsMeta object with the default unit.
Parameters:
-
channel_meta(ChannelsMeta | None, default:None) –The channels metadata to set. If none, it will fall back to the deprecated parameters.
-
labels(Sequence[str | None] | int, default:None) –Deprecated. The list of channels names in the image. If an integer is provided, the channels will be named "channel_i".
-
wavelength_id(Sequence[str | None], default:None) –Deprecated. The wavelength ID of the channel. If None, the wavelength ID will be the same as the channel name.
-
start(Sequence[float | None], default:None) –Deprecated. The start value for each channel. If None, the start value will be computed from the image.
-
end(Sequence[float | None], default:None) –Deprecated. The end value for each channel. If None, the end value will be computed from the image.
-
percentiles(tuple[float, float] | None, default:None) –Deprecated. The start and end percentiles for each channel. If None, the percentiles will not be computed.
-
colors(Sequence[str | None], default:None) –Deprecated. The list of colors for the channels. If None, the colors will be random.
-
active(Sequence[bool | None], default:None) –Deprecated. Whether the channel should be shown by default.
-
omero_kwargs(dict, default:{}) –Deprecated. Extra fields to store in the omero attributes.
Source code in ngio/images/_ome_zarr_container.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
set_channel_labels
¶
set_channel_labels(labels: Sequence[str]) -> None
Update the labels of the channels.
Parameters:
-
labels(Sequence[str]) –The new labels for the channels.
Source code in ngio/images/_ome_zarr_container.py
352 353 354 355 356 357 358 359 360 361 | |
set_channel_colors
¶
set_channel_colors(colors: Sequence[str]) -> None
Update the colors of the channels.
Parameters:
-
colors(Sequence[str]) –The new colors for the channels.
Source code in ngio/images/_ome_zarr_container.py
363 364 365 366 367 368 369 370 371 372 | |
set_channel_percentiles
¶
set_channel_percentiles(
start_percentile: float = 0.1,
end_percentile: float = 99.9,
) -> None
Deprecated: Update the channel windows using percentiles.
Parameters:
-
start_percentile(float, default:0.1) –The start percentile.
-
end_percentile(float, default:99.9) –The end percentile.
Source code in ngio/images/_ome_zarr_container.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |
set_channel_windows
¶
set_channel_windows(
starts_ends: Sequence[tuple[float, float]],
min_max: Sequence[tuple[float, float]] | None = None,
) -> None
Update the channel windows.
These values are used by viewers to set the display range of each channel.
Parameters:
-
starts_ends(Sequence[tuple[float, float]]) –The start and end values for each channel.
-
min_max(Sequence[tuple[float, float]] | None, default:None) –The min and max values for each channel. If None, the min and max values will not be updated.
Source code in ngio/images/_ome_zarr_container.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
set_channel_windows_with_percentiles
¶
set_channel_windows_with_percentiles(
percentiles: tuple[float, float]
| list[tuple[float, float]] = (0.1, 99.9),
) -> None
Update the channel windows using percentiles.
Parameters:
-
percentiles(tuple[float, float] | list[tuple[float, float]], default:(0.1, 99.9)) –The start and end percentiles for each channel. If a single tuple is provided, the same percentiles will be used for all channels.
Source code in ngio/images/_ome_zarr_container.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
set_axes_units
¶
set_axes_units(
space_unit: SpaceUnits = DefaultSpaceUnit,
time_unit: TimeUnits = DefaultTimeUnit,
set_labels: bool = True,
) -> None
Set the units of the image.
Parameters:
-
space_unit(SpaceUnits, default:DefaultSpaceUnit) –The unit of space.
-
time_unit(TimeUnits, default:DefaultTimeUnit) –The unit of time.
-
set_labels(bool, default:True) –Whether to set the units for the labels as well.
Source code in ngio/images/_ome_zarr_container.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
set_axes_names
¶
set_axes_names(axes_names: Sequence[str]) -> None
Set the axes names of the image.
Parameters:
-
axes_names(Sequence[str]) –The axes names of the image.
Source code in ngio/images/_ome_zarr_container.py
449 450 451 452 453 454 455 456 457 458 | |
set_name
¶
set_name(name: str) -> None
Set the name of the image in the metadata.
This does not change the group name or any paths.
Parameters:
-
name(str) –The name of the image.
Source code in ngio/images/_ome_zarr_container.py
460 461 462 463 464 465 466 467 468 469 470 471 | |
get_image
¶
get_image(
path: str | None = None,
pixel_size: PixelSize | None = None,
strict: bool = False,
) -> Image
Get an image at a specific level.
Parameters:
-
path(str | None, default:None) –The path to the image in the ome_zarr file.
-
pixel_size(PixelSize | None, default:None) –The pixel size of the image.
-
strict(bool, default:False) –Only used if the pixel size is provided. If True, the pixel size must match the image pixel size exactly. If False, the closest pixel size level will be returned.
Source code in ngio/images/_ome_zarr_container.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
get_masked_image
¶
get_masked_image(
masking_label_name: str | None = None,
masking_table_name: str | None = None,
path: str | None = None,
pixel_size: PixelSize | None = None,
strict: bool = False,
) -> MaskedImage
Get a masked image at a specific level.
Parameters:
-
masking_label_name(str | None, default:None) –The name of the masking label to use. If None, the masking table must be provided.
-
masking_table_name(str | None, default:None) –The name of the masking table to use. If None, the masking label must be provided.
-
path(str | None, default:None) –The path to the image in the ome_zarr file. If None, the first level will be used.
-
pixel_size(PixelSize | None, default:None) –The pixel size of the image. This is only used if path is None.
-
strict(bool, default:False) –Only used if the pixel size is provided. If True, the pixel size must match the image pixel size exactly. If False, the closest pixel size level will be returned.
Source code in ngio/images/_ome_zarr_container.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | |
derive_image
¶
derive_image(
store: StoreOrGroup,
ref_path: str | None = None,
shape: Sequence[int] | None = None,
pixelsize: float | tuple[float, float] | None = None,
z_spacing: float | None = None,
time_spacing: float | None = None,
name: str | None = None,
translation: Sequence[float] | None = None,
channels_policy: Literal["squeeze", "same", "singleton"]
| int = "same",
channels_meta: Sequence[str | Channel] | None = None,
ngff_version: NgffVersions | None = None,
chunks: ChunksLike | None = None,
shards: ShardsLike | None = None,
dtype: str = "uint16",
dimension_separator: Literal[".", "/"] = "/",
compressors: CompressorLike = "auto",
extra_array_kwargs: Mapping[str, Any] | None = None,
overwrite: bool = False,
copy_labels: bool = False,
copy_tables: bool = False,
labels: Sequence[str] | None = None,
pixel_size: PixelSize | None = None,
) -> OmeZarrContainer
Derive a new OME-Zarr container from the current image.
If a kwarg is not provided, the value from the reference image will be used.
Parameters:
-
store(StoreOrGroup) –The Zarr store or group to create the image in.
-
ref_path(str | None, default:None) –The path to the reference image in the image container.
-
shape(Sequence[int] | None, default:None) –The shape of the new image.
-
pixelsize(float | tuple[float, float] | None, default:None) –The pixel size of the new image.
-
z_spacing(float | None, default:None) –The z spacing of the new image.
-
time_spacing(float | None, default:None) –The time spacing of the new image.
-
name(str | None, default:None) –The name of the new image.
-
translation(Sequence[float] | None, default:None) –The translation for each axis at the highest resolution level. Defaults to None.
-
channels_policy(Literal['squeeze', 'same', 'singleton'] | int, default:'same') –Possible policies: - If "squeeze", the channels axis will be removed (no matter its size). - If "same", the channels axis will be kept as is (if it exists). - If "singleton", the channels axis will be set to size 1. - If an integer is provided, the channels axis will be changed to have that size.
-
channels_meta(Sequence[str | Channel] | None, default:None) –The channels metadata of the new image.
-
ngff_version(NgffVersions | None, default:None) –The NGFF version to use.
-
chunks(ChunksLike | None, default:None) –The chunk shape of the new image.
-
shards(ShardsLike | None, default:None) –The shard shape of the new image.
-
dtype(str, default:'uint16') –The data type of the new image. Defaults to "uint16".
-
dimension_separator(Literal['.', '/'], default:'/') –The separator to use for dimensions. Defaults to "/".
-
compressors(CompressorLike, default:'auto') –The compressors to use. Defaults to "auto".
-
extra_array_kwargs(Mapping[str, Any] | None, default:None) –Extra arguments to pass to the zarr array creation.
-
overwrite(bool, default:False) –Whether to overwrite an existing image. Defaults to False.
-
copy_labels(bool, default:False) –Whether to copy the labels from the current image. Defaults to False.
-
copy_tables(bool, default:False) –Whether to copy the tables from the current image. Defaults to False.
-
labels(Sequence[str] | None, default:None) –Deprecated. This argument is deprecated, please use channels_meta instead.
-
pixel_size(PixelSize | None, default:None) –Deprecated. The pixel size of the new image. This argument is deprecated, please use pixelsize, z_spacing, and time_spacing instead.
Returns:
-
OmeZarrContainer(OmeZarrContainer) –The new derived OME-Zarr container.
Source code in ngio/images/_ome_zarr_container.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
list_tables
¶
list_tables(
filter_types: TypedTable | str | None = None,
) -> list[str]
List all tables in the image.
Source code in ngio/images/_ome_zarr_container.py
695 696 697 698 699 700 701 702 703 | |
list_roi_tables
¶
list_roi_tables() -> list[str]
List all ROI tables in the image.
Source code in ngio/images/_ome_zarr_container.py
705 706 707 708 709 710 711 712 713 | |
get_roi_table
¶
get_roi_table(name: str) -> RoiTable
Get a ROI table from the image.
Parameters:
-
name(str) –The name of the table.
Source code in ngio/images/_ome_zarr_container.py
715 716 717 718 719 720 721 722 723 724 | |
get_masking_roi_table
¶
get_masking_roi_table(name: str) -> MaskingRoiTable
Get a masking ROI table from the image.
Parameters:
-
name(str) –The name of the table.
Source code in ngio/images/_ome_zarr_container.py
726 727 728 729 730 731 732 733 734 735 736 737 | |
get_feature_table
¶
get_feature_table(name: str) -> FeatureTable
Get a feature table from the image.
Parameters:
-
name(str) –The name of the table.
Source code in ngio/images/_ome_zarr_container.py
739 740 741 742 743 744 745 746 747 748 749 750 | |
get_generic_roi_table
¶
get_generic_roi_table(name: str) -> GenericRoiTable
Get a generic ROI table from the image.
Parameters:
-
name(str) –The name of the table.
Source code in ngio/images/_ome_zarr_container.py
752 753 754 755 756 757 758 759 760 761 762 763 | |
get_condition_table
¶
get_condition_table(name: str) -> ConditionTable
Get a condition table from the image.
Parameters:
-
name(str) –The name of the table.
Source code in ngio/images/_ome_zarr_container.py
765 766 767 768 769 770 771 772 773 774 775 776 | |
get_table
¶
get_table(
name: str, check_type: TypedTable | None = None
) -> Table
Get a table from the image.
Parameters:
-
name(str) –The name of the table.
-
check_type(TypedTable | None, default:None) –Deprecated. Please use 'get_table_as' instead, or one of the type specific get_*table() methods.
Source code in ngio/images/_ome_zarr_container.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | |
get_table_as
¶
get_table_as(
name: str,
table_cls: type[TableType],
backend: TableBackend | None = None,
) -> TableType
Get a table from the image as a specific type.
Parameters:
-
name(str) –The name of the table.
-
table_cls(type[TableType]) –The type of the table.
-
backend(TableBackend | None, default:None) –The backend to use. If None, the default backend is used.
Source code in ngio/images/_ome_zarr_container.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | |
build_image_roi_table
¶
build_image_roi_table(
name: str | None = "image",
) -> RoiTable
Compute the ROI table for an image.
Source code in ngio/images/_ome_zarr_container.py
816 817 818 | |
build_masking_roi_table
¶
build_masking_roi_table(label: str) -> MaskingRoiTable
Compute the masking ROI table for a label.
Source code in ngio/images/_ome_zarr_container.py
820 821 822 | |
add_table
¶
add_table(
name: str,
table: Table,
backend: TableBackend = DefaultTableBackend,
overwrite: bool = False,
) -> None
Add a table to the image.
Source code in ngio/images/_ome_zarr_container.py
824 825 826 827 828 829 830 831 832 833 834 | |
delete_table
¶
delete_table(name: str, missing_ok: bool = False) -> None
Delete a table from the group.
Parameters:
-
name(str) –The name of the table to delete.
-
missing_ok(bool, default:False) –If True, do not raise an error if the table does not exist.
Source code in ngio/images/_ome_zarr_container.py
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | |
list_labels
¶
list_labels() -> list[str]
List all labels in the image.
Source code in ngio/images/_ome_zarr_container.py
855 856 857 858 859 860 | |
get_label
¶
get_label(
name: str,
path: str | None = None,
pixel_size: PixelSize | None = None,
strict: bool = False,
) -> Label
Get a label from the group.
Parameters:
-
name(str) –The name of the label.
-
path(str | None, default:None) –The path to the image in the ome_zarr file.
-
pixel_size(PixelSize | None, default:None) –The pixel size of the image.
-
strict(bool, default:False) –Only used if the pixel size is provided. If True, the pixel size must match the image pixel size exactly. If False, the closest pixel size level will be returned.
Source code in ngio/images/_ome_zarr_container.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | |
get_masked_label
¶
get_masked_label(
label_name: str,
masking_label_name: str | None = None,
masking_table_name: str | None = None,
path: str | None = None,
pixel_size: PixelSize | None = None,
strict: bool = False,
) -> MaskedLabel
Get a masked image at a specific level.
Parameters:
-
label_name(str) –The name of the label.
-
masking_label_name(str | None, default:None) –The name of the masking label.
-
masking_table_name(str | None, default:None) –The name of the masking table.
-
path(str | None, default:None) –The path to the image in the ome_zarr file.
-
pixel_size(PixelSize | None, default:None) –The pixel size of the image.
-
strict(bool, default:False) –Only used if the pixel size is provided. If True, the pixel size must match the image pixel size exactly. If False, the closest pixel size level will be returned.
Source code in ngio/images/_ome_zarr_container.py
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | |
delete_label
¶
delete_label(name: str, missing_ok: bool = False) -> None
Delete a label from the group.
Parameters:
-
name(str) –The name of the label to delete.
-
missing_ok(bool, default:False) –If True, do not raise an error if the label does not exist.
Source code in ngio/images/_ome_zarr_container.py
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | |
derive_label
¶
derive_label(
name: str,
ref_image: Image | Label | None = None,
shape: Sequence[int] | None = None,
pixelsize: float | tuple[float, float] | None = None,
z_spacing: float | None = None,
time_spacing: float | None = None,
translation: Sequence[float] | None = None,
channels_policy: Literal["same", "squeeze", "singleton"]
| int = "squeeze",
ngff_version: NgffVersions | None = None,
chunks: ChunksLike | None = None,
shards: ShardsLike | None = None,
dtype: str | None = None,
dimension_separator: Literal[".", "/"] | None = None,
compressors: CompressorLike | None = None,
extra_array_kwargs: Mapping[str, Any] | None = None,
overwrite: bool = False,
labels: Sequence[str] | None = None,
pixel_size: PixelSize | None = None,
) -> Label
Derive a new label from an existing image or label.
If a kwarg is not provided, the value from the reference image will be used.
Parameters:
-
name(str) –The name of the new label.
-
ref_image(Image | Label | None, default:None) –The reference image to derive the new label from. If None, the first level image will be used.
-
shape(Sequence[int] | None, default:None) –The shape of the new label.
-
pixelsize(float | tuple[float, float] | None, default:None) –The pixel size of the new label.
-
z_spacing(float | None, default:None) –The z spacing of the new label.
-
time_spacing(float | None, default:None) –The time spacing of the new label.
-
translation(Sequence[float] | None, default:None) –The translation for each axis at the highest resolution level. Defaults to None.
-
channels_policy(Literal['same', 'squeeze', 'singleton'] | int, default:'squeeze') –Possible policies: - If "squeeze", the channels axis will be removed (no matter its size). - If "same", the channels axis will be kept as is (if it exists). - If "singleton", the channels axis will be set to size 1. - If an integer is provided, the channels axis will be changed to have that size. Defaults to "squeeze".
-
ngff_version(NgffVersions | None, default:None) –The NGFF version to use.
-
chunks(ChunksLike | None, default:None) –The chunk shape of the new label.
-
shards(ShardsLike | None, default:None) –The shard shape of the new label.
-
dtype(str | None, default:None) –The data type of the new label.
-
dimension_separator(Literal['.', '/'] | None, default:None) –The separator to use for dimensions.
-
compressors(CompressorLike | None, default:None) –The compressors to use.
-
extra_array_kwargs(Mapping[str, Any] | None, default:None) –Extra arguments to pass to the zarr array creation.
-
overwrite(bool, default:False) –Whether to overwrite an existing label. Defaults to False.
-
labels(Sequence[str] | None, default:None) –Deprecated. This argument is deprecated, please use channels_meta instead.
-
pixel_size(PixelSize | None, default:None) –Deprecated. The pixel size of the new label. This argument is deprecated, please use pixelsize, z_spacing, and time_spacing instead.
Returns:
-
Label(Label) –The new derived label.
Source code in ngio/images/_ome_zarr_container.py
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | |