HCS API Documentation¶
Open a Plate¶
ngio.open_ome_zarr_plate
¶
open_ome_zarr_plate(
store: StoreOrGroup,
cache: bool = False,
mode: AccessModeLiteral = "r+",
) -> OmeZarrPlate
Open an OME-Zarr plate.
Parameters:
-
store(StoreOrGroup) –The Zarr store or group that stores the plate.
-
cache(bool, default:False) –Whether to use a cache for the zarr group metadata.
-
mode(AccessModeLiteral, default:'r+') –The access mode for the image. Defaults to "r+".
Source code in src/ngio/hcs/_plate.py
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | |
ngio.OmeZarrPlate Class Reference¶
ngio.OmeZarrPlate
¶
OmeZarrPlate(
group_handler: ZarrGroupHandler,
table_container: TablesContainer | None = None,
)
A class to handle the Plate Sequence in an OME-Zarr file.
Initialize the LabelGroupHandler.
Parameters:
-
group_handler(ZarrGroupHandler) –The Zarr group handler that contains the Plate.
-
table_container(TablesContainer | None, default:None) –The tables container that contains plate level tables.
Source code in src/ngio/hcs/_plate.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
acquisitions_names
property
¶
acquisitions_names: list[str | None]
Return the acquisitions in the plate.
wells_paths
¶
wells_paths() -> list[str]
Return the wells paths in the plate.
Source code in src/ngio/hcs/_plate.py
305 306 307 | |
images_paths_async
async
¶
images_paths_async(
acquisition: int | None = None,
) -> list[str]
Return the images paths in the plate asynchronously.
If acquisition is None, return all images paths in the plate. Else, return the images paths in the plate for the given acquisition.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Source code in src/ngio/hcs/_plate.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
images_paths
¶
images_paths(acquisition: int | None = None) -> list[str]
Return the images paths in the plate.
If acquisition is None, return all images paths in the plate. Else, return the images paths in the plate for the given acquisition.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Source code in src/ngio/hcs/_plate.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
well_images_paths
¶
well_images_paths(
row: str,
column: int | str,
acquisition: int | None = None,
) -> list[str]
Return the images paths in a well.
If acquisition is None, return all images paths in the well. Else, return the images paths in the well for the given acquisition.
Parameters:
-
row(str) –The row of the well.
-
column(int | str) –The column of the well.
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Source code in src/ngio/hcs/_plate.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
get_image_acquisition_id
¶
get_image_acquisition_id(
row: str, column: int | str, image_path: str
) -> int | None
Get the acquisition id of an image in a well.
Parameters:
-
row(str) –The row of the well.
-
column(int | str) –The column of the well.
-
image_path(str) –The path of the image.
Returns:
-
int | None–int | None: The acquisition id of the image.
Source code in src/ngio/hcs/_plate.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
get_well
¶
get_well(row: str, column: int | str) -> OmeZarrWell
Get a well from the plate.
Parameters:
-
row(str) –The row of the well.
-
column(int | str) –The column of the well.
Returns:
-
OmeZarrWell(OmeZarrWell) –The well.
Source code in src/ngio/hcs/_plate.py
394 395 396 397 398 399 400 401 402 403 404 405 | |
get_wells_async
async
¶
get_wells_async() -> dict[str, OmeZarrWell]
Get all wells in the plate asynchronously.
This method processes wells in parallel for improved performance when working with a large number of wells.
Returns:
-
dict[str, OmeZarrWell]–dict[str, OmeZarrWell]: A dictionary of wells, where the key is the well path and the value is the well object.
Source code in src/ngio/hcs/_plate.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
get_wells
¶
get_wells() -> dict[str, OmeZarrWell]
Get all wells in the plate.
Returns:
-
dict[str, OmeZarrWell]–dict[str, OmeZarrWell]: A dictionary of wells, where the key is the well path and the value is the well object.
Source code in src/ngio/hcs/_plate.py
430 431 432 433 434 435 436 437 438 439 440 | |
get_images_async
async
¶
get_images_async(
acquisition: int | None = None,
) -> dict[str, OmeZarrContainer]
Get all images in the plate asynchronously.
This method processes images in parallel for improved performance when working with a large number of images.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Returns:
-
dict[str, OmeZarrContainer]–dict[str, OmeZarrContainer]: A dictionary of images, where the key is the image path and the value is the image object.
Source code in src/ngio/hcs/_plate.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
get_images
¶
get_images(
acquisition: int | None = None,
) -> dict[str, OmeZarrContainer]
Get all images in the plate.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Source code in src/ngio/hcs/_plate.py
486 487 488 489 490 491 492 493 494 495 496 497 | |
get_image
¶
get_image(
row: str, column: int | str, image_path: str
) -> OmeZarrContainer
Get an image from the plate.
Parameters:
-
row(str) –The row of the well.
-
column(int | str) –The column of the well.
-
image_path(str) –The path of the image.
Returns:
-
OmeZarrContainer(OmeZarrContainer) –The image.
Source code in src/ngio/hcs/_plate.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
get_image_store
¶
get_image_store(
row: str, column: int | str, image_path: str
) -> StoreOrGroup
Get the image store from the plate.
Parameters:
-
row(str) –The row of the well.
-
column(int | str) –The column of the well.
-
image_path(str) –The path of the image.
Source code in src/ngio/hcs/_plate.py
515 516 517 518 519 520 521 522 523 524 525 526 | |
get_well_images
¶
get_well_images(
row: str,
column: str | int,
acquisition: int | None = None,
) -> dict[str, OmeZarrContainer]
Get all images in a well.
Parameters:
-
row(str) –The row of the well.
-
column(str | int) –The column of the well.
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Source code in src/ngio/hcs/_plate.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |
atomic_add_image
¶
atomic_add_image(
row: str,
column: int | str,
image_path: str,
acquisition_id: int | None = None,
acquisition_name: str | None = None,
) -> str
Parallel safe version of add_image.
Source code in src/ngio/hcs/_plate.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
add_image
¶
add_image(
row: str,
column: int | str,
image_path: str,
acquisition_id: int | None = None,
acquisition_name: str | None = None,
) -> str
Add an image to an ome-zarr plate.
Source code in src/ngio/hcs/_plate.py
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
add_well
¶
add_well(row: str, column: int | str) -> OmeZarrWell
Add a well to an ome-zarr plate.
Source code in src/ngio/hcs/_plate.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | |
add_column
¶
add_column(column: int | str) -> OmeZarrPlate
Add a column to an ome-zarr plate.
Source code in src/ngio/hcs/_plate.py
673 674 675 676 677 678 679 680 681 | |
add_row
¶
add_row(row: str) -> OmeZarrPlate
Add a row to an ome-zarr plate.
Source code in src/ngio/hcs/_plate.py
683 684 685 686 687 688 689 690 691 | |
add_acquisition
¶
add_acquisition(
acquisition_id: int, acquisition_name: str
) -> OmeZarrPlate
Add an acquisition to an ome-zarr plate.
Be aware that this is not a parallel safe operation.
Parameters:
-
acquisition_id(int) –The acquisition id.
-
acquisition_name(str) –The acquisition name.
Source code in src/ngio/hcs/_plate.py
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | |
atomic_remove_image
¶
atomic_remove_image(
row: str, column: int | str, image_path: str
)
Parallel safe version of remove_image.
Source code in src/ngio/hcs/_plate.py
754 755 756 757 758 759 760 761 762 763 764 765 766 | |
remove_image
¶
remove_image(row: str, column: int | str, image_path: str)
Remove an image from an ome-zarr plate.
Source code in src/ngio/hcs/_plate.py
768 769 770 771 772 773 774 775 776 777 778 779 780 | |
derive_plate
¶
derive_plate(
store: StoreOrGroup,
plate_name: str | None = None,
version: NgffVersions | None = None,
ngff_version: NgffVersions = DefaultNgffVersion,
keep_acquisitions: bool = False,
cache: bool = False,
overwrite: bool = False,
) -> OmeZarrPlate
Derive a new OME-Zarr plate from an existing one.
Parameters:
-
store(StoreOrGroup) –The Zarr store or group that stores the plate.
-
plate_name(str | None, default:None) –The name of the new plate.
-
version(NgffVersion | None, default:None) –Deprecated. Please use 'ngff_version' instead.
-
ngff_version(NgffVersion, default:DefaultNgffVersion) –The NGFF version to use for the new plate.
-
keep_acquisitions(bool, default:False) –Whether to keep the acquisitions in the new plate.
-
cache(bool, default:False) –Whether to use a cache for the zarr group metadata.
-
overwrite(bool, default:False) –Whether to overwrite the existing plate.
Source code in src/ngio/hcs/_plate.py
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | |
list_tables
¶
list_tables(
filter_types: TypedTable | str | None = None,
) -> list[str]
List all tables in the image.
Source code in src/ngio/hcs/_plate.py
834 835 836 837 838 839 | |
list_roi_tables
¶
list_roi_tables() -> list[str]
List all ROI tables in the image.
Source code in src/ngio/hcs/_plate.py
841 842 843 844 845 846 847 848 849 | |
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 src/ngio/hcs/_plate.py
851 852 853 854 855 856 857 858 859 860 | |
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 src/ngio/hcs/_plate.py
862 863 864 865 866 867 868 869 870 871 872 873 | |
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 src/ngio/hcs/_plate.py
875 876 877 878 879 880 881 882 883 884 885 886 | |
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 src/ngio/hcs/_plate.py
888 889 890 891 892 893 894 895 896 897 898 899 | |
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 src/ngio/hcs/_plate.py
901 902 903 904 905 906 907 908 909 910 911 912 | |
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 src/ngio/hcs/_plate.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | |
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 src/ngio/hcs/_plate.py
934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | |
add_table
¶
add_table(
name: str,
table: Table,
backend: TableBackend = DefaultTableBackend,
overwrite: bool = False,
) -> None
Add a table to the image.
Source code in src/ngio/hcs/_plate.py
954 955 956 957 958 959 960 961 962 963 964 | |
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 src/ngio/hcs/_plate.py
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | |
list_image_tables
¶
list_image_tables(
acquisition: int | None = None,
filter_types: str | None = None,
mode: Literal["common", "all"] = "common",
) -> list[str]
List all image tables in the image.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
-
filter_types(str | None, default:None) –The type of tables to filter. If None, return all tables. Defaults to None.
-
mode(Literal['common', 'all'], default:'common') –The mode to use for listing the tables. If 'common', return only common tables between all images. If 'all', return all tables. Defaults to 'common'.
Source code in src/ngio/hcs/_plate.py
985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | |
list_image_tables_async
async
¶
list_image_tables_async(
acquisition: int | None = None,
filter_types: str | None = None,
mode: Literal["common", "all"] = "common",
) -> list[str]
List all image tables in the image asynchronously.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
-
filter_types(str | None, default:None) –The type of tables to filter. If None, return all tables. Defaults to None.
-
mode(Literal['common', 'all'], default:'common') –The mode to use for listing the tables. If 'common', return only common tables between all images. If 'all', return all tables. Defaults to 'common'.
Source code in src/ngio/hcs/_plate.py
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | |
concatenate_image_tables
¶
concatenate_image_tables(
name: str,
acquisition: int | None = None,
strict: bool = True,
index_key: str | None = None,
mode: Literal["eager", "lazy"] = "eager",
) -> Table
Concatenate tables from all images in the plate.
Parameters:
-
name(str) –The name of the table to concatenate.
-
index_key(str | None, default:None) –The key to use for the index of the concatenated table.
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
-
strict(bool, default:True) –If True, raise an error if the table is not found in the image.
-
index_key(str | None, default:None) –If a string is provided, a new index column will be created new_index_pattern = {row}{column}{path_in_well}_{label}
-
mode(Literal['eager', 'lazy'], default:'eager') –The mode to use for concatenation. Can be 'eager' or 'lazy'. if 'eager', the table will be loaded into memory. if 'lazy', the table will be loaded as a lazy frame.
Source code in src/ngio/hcs/_plate.py
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | |
concatenate_image_tables_as
¶
concatenate_image_tables_as(
name: str,
table_cls: type[TableType],
acquisition: int | None = None,
index_key: str | None = None,
strict: bool = True,
mode: Literal["eager", "lazy"] = "eager",
) -> TableType
Concatenate tables from all images in the plate as a specific type.
Parameters:
-
name(str) –The name of the table to concatenate.
-
table_cls(type[TableType]) –The type of the table to concatenate.
-
index_key(str | None, default:None) –The key to use for the index of the concatenated table.
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
-
index_key(str | None, default:None) –If a string is provided, a new index column will be created new_index_pattern = {row}{column}{path_in_well}_{label}
-
strict(bool, default:True) –If True, raise an error if the table is not found in the image.
-
mode(Literal['eager', 'lazy'], default:'eager') –The mode to use for concatenation. Can be 'eager' or 'lazy'. if 'eager', the table will be loaded into memory. if 'lazy', the table will be loaded as a lazy frame.
Source code in src/ngio/hcs/_plate.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | |
concatenate_image_tables_async
async
¶
concatenate_image_tables_async(
name: str,
acquisition: int | None = None,
index_key: str | None = None,
strict: bool = True,
mode: Literal["eager", "lazy"] = "eager",
) -> Table
Concatenate tables from all images in the plate asynchronously.
Parameters:
-
name(str) –The name of the table to concatenate.
-
index_key(str | None, default:None) –The key to use for the index of the concatenated table.
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
-
index_key(str | None, default:None) –If a string is provided, a new index column will be created new_index_pattern = {row}{column}{path_in_well}_{label}
-
strict(bool, default:True) –If True, raise an error if the table is not found in the image.
-
mode(Literal['eager', 'lazy'], default:'eager') –The mode to use for concatenation. Can be 'eager' or 'lazy'. if 'eager', the table will be loaded into memory. if 'lazy', the table will be loaded as a lazy frame.
Source code in src/ngio/hcs/_plate.py
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | |
concatenate_image_tables_as_async
async
¶
concatenate_image_tables_as_async(
name: str,
table_cls: type[TableType],
acquisition: int | None = None,
index_key: str | None = None,
strict: bool = True,
mode: Literal["eager", "lazy"] = "eager",
) -> TableType
Concatenate tables from all images in the plate as a specific type.
Parameters:
-
name(str) –The name of the table to concatenate.
-
table_cls(type[TableType]) –The type of the table to concatenate.
-
index_key(str | None, default:None) –The key to use for the index of the concatenated table.
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
-
index_key(str | None, default:None) –If a string is provided, a new index column will be created new_index_pattern = {row}{column}{path_in_well}_{label}
-
strict(bool, default:True) –If True, raise an error if the table is not found in the image.
-
mode(Literal['eager', 'lazy'], default:'eager') –The mode to use for concatenation. Can be 'eager' or 'lazy'. if 'eager', the table will be loaded into memory. if 'lazy', the table will be loaded as a lazy frame.
Source code in src/ngio/hcs/_plate.py
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 | |
Open a Well¶
ngio.open_ome_zarr_well
¶
open_ome_zarr_well(
store: StoreOrGroup,
cache: bool = False,
mode: AccessModeLiteral = "r+",
) -> OmeZarrWell
Open an OME-Zarr well.
Parameters:
-
store(StoreOrGroup) –The Zarr store or group that stores the plate.
-
cache(bool, default:False) –Whether to use a cache for the zarr group metadata.
-
mode(AccessModeLiteral, default:'r+') –The access mode for the image. Defaults to "r+".
Source code in src/ngio/hcs/_plate.py
1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | |
ngio.OmeZarrWell Class Reference¶
ngio.OmeZarrWell
¶
OmeZarrWell(group_handler: ZarrGroupHandler)
A class to handle the Well Sequence in an OME-Zarr file.
Initialize the LabelGroupHandler.
Parameters:
-
group_handler(ZarrGroupHandler) –The Zarr group handler that contains the Well.
Source code in src/ngio/hcs/_plate.py
83 84 85 86 87 88 89 90 | |
paths
¶
paths(acquisition: int | None = None) -> list[str]
Return the images paths in the well.
If acquisition is None, return all images paths in the well. Else, return the images paths in the well for the given acquisition.
Parameters:
-
acquisition(int | None, default:None) –The acquisition id to filter the images.
Source code in src/ngio/hcs/_plate.py
111 112 113 114 115 116 117 118 119 120 | |
get_image_store
¶
get_image_store(image_path: str) -> StoreOrGroup
Get the image store from the well.
Parameters:
-
image_path(str) –The path of the image.
Source code in src/ngio/hcs/_plate.py
122 123 124 125 126 127 128 | |
get_image_acquisition_id
¶
get_image_acquisition_id(image_path: str) -> int | None
Get the acquisition id of an image in the well.
Parameters:
-
image_path(str) –The path of the image.
Returns:
-
int | None–int | None: The acquisition id of the image.
Source code in src/ngio/hcs/_plate.py
130 131 132 133 134 135 136 137 138 139 | |
get_image
¶
get_image(image_path: str) -> OmeZarrContainer
Get an image from the well.
Parameters:
-
image_path(str) –The path of the image.
Returns:
-
OmeZarrContainer(OmeZarrContainer) –The image.
Source code in src/ngio/hcs/_plate.py
141 142 143 144 145 146 147 148 149 150 151 | |
atomic_add_image
¶
atomic_add_image(
image_path: str,
acquisition_id: int | None = None,
strict: bool = True,
) -> StoreOrGroup
Parallel safe version of add_image.
Source code in src/ngio/hcs/_plate.py
177 178 179 180 181 182 183 184 185 186 187 188 189 | |
add_image
¶
add_image(
image_path: str,
acquisition_id: int | None = None,
strict: bool = True,
) -> StoreOrGroup
Add an image to an ome-zarr well.
Parameters:
-
image_path(str) –The path of the image.
-
acquisition_id(int | None, default:None) –The acquisition id to filter the images.
-
strict(bool, default:True) –Whether to check if the acquisition id is already exists in the well. Defaults to True. If False this might lead to acquisition in a well that does not exist at the plate level.
Source code in src/ngio/hcs/_plate.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |