HCS API Documentation¶
Open a Plate¶
ngio.open_ome_zarr_plate
¶
open_ome_zarr_plate(
store: StoreOrGroup,
cache: bool = False,
mode: AccessModeLiteral = "r+",
parallel_safe: bool = True,
) -> 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+".
-
parallel_safe
(bool
, default:True
) –Whether the group handler is parallel safe.
Source code in ngio/hcs/_plate.py
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 |
|
ngio.OmeZarrPlate Class Reference¶
ngio.OmeZarrPlate
¶
OmeZarrPlate(
group_handler: ZarrGroupHandler,
table_container: TablesContainer | None = None,
)
A class to handle the Plate Collection 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 ngio/hcs/_plate.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
acquisitions_names
property
¶
Return the acquisitions in the plate.
wells_paths
¶
Return the wells paths in the plate.
Source code in ngio/hcs/_plate.py
288 289 290 |
|
images_paths_async
async
¶
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 ngio/hcs/_plate.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
images_paths
¶
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 ngio/hcs/_plate.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
well_images_paths
¶
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 ngio/hcs/_plate.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
|
get_image_acquisition_id
¶
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 ngio/hcs/_plate.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
get_well
¶
get_well(row: str, column: int | str) -> OmeZarrWell
Get a well from the plate.
Parameters:
Returns:
-
OmeZarrWell
(OmeZarrWell
) –The well.
Source code in ngio/hcs/_plate.py
359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
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 ngio/hcs/_plate.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
|
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 ngio/hcs/_plate.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
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 ngio/hcs/_plate.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
|
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 ngio/hcs/_plate.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
|
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 ngio/hcs/_plate.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
|
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 ngio/hcs/_plate.py
514 515 516 517 518 519 520 521 522 523 524 525 |
|
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 ngio/hcs/_plate.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
|
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 ngio/hcs/_plate.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 |
|
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 ngio/hcs/_plate.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
|
add_well
¶
add_well(row: str, column: int | str) -> OmeZarrWell
Add a well to an ome-zarr plate.
Source code in ngio/hcs/_plate.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
|
add_column
¶
add_column(column: int | str) -> OmeZarrPlate
Add a column to an ome-zarr plate.
Source code in ngio/hcs/_plate.py
671 672 673 674 675 676 677 678 679 |
|
add_row
¶
add_row(row: str) -> OmeZarrPlate
Add a row to an ome-zarr plate.
Source code in ngio/hcs/_plate.py
681 682 683 684 685 686 687 688 689 |
|
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:
Source code in ngio/hcs/_plate.py
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 |
|
atomic_remove_image
¶
Parallel safe version of remove_image.
Source code in ngio/hcs/_plate.py
752 753 754 755 756 757 758 759 760 761 762 763 764 |
|
remove_image
¶
Remove an image from an ome-zarr plate.
Source code in ngio/hcs/_plate.py
766 767 768 769 770 771 772 773 774 775 776 777 778 |
|
derive_plate
¶
derive_plate(
store: StoreOrGroup,
plate_name: str | None = None,
version: NgffVersions = "0.4",
keep_acquisitions: bool = False,
cache: bool = False,
overwrite: bool = False,
parallel_safe: bool = True,
) -> 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
, default:'0.4'
) –The version of 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.
-
parallel_safe
(bool
, default:True
) –Whether the group handler is parallel safe.
Source code in ngio/hcs/_plate.py
780 781 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 |
|
list_tables
¶
list_tables(
filter_types: TypedTable | str | None = None,
) -> list[str]
List all tables in the image.
Source code in ngio/hcs/_plate.py
831 832 833 |
|
list_roi_tables
¶
List all ROI tables in the image.
Source code in ngio/hcs/_plate.py
835 836 837 838 839 840 841 842 843 |
|
get_roi_table
¶
Get a ROI table from the image.
Parameters:
-
name
(str
) –The name of the table.
Source code in ngio/hcs/_plate.py
845 846 847 848 849 850 851 852 853 854 |
|
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/hcs/_plate.py
856 857 858 859 860 861 862 863 864 865 866 867 |
|
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/hcs/_plate.py
869 870 871 872 873 874 875 876 877 878 879 880 |
|
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/hcs/_plate.py
882 883 884 885 886 887 888 889 890 891 892 893 |
|
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/hcs/_plate.py
895 896 897 898 899 900 901 902 903 904 905 906 |
|
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/hcs/_plate.py
908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 |
|
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/hcs/_plate.py
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 |
|
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/hcs/_plate.py
948 949 950 951 952 953 954 955 956 957 958 |
|
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 ngio/hcs/_plate.py
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
|
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 ngio/hcs/_plate.py
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
|
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 ngio/hcs/_plate.py
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 |
|
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 ngio/hcs/_plate.py
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 1063 1064 1065 1066 1067 1068 1069 1070 1071 |
|
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 ngio/hcs/_plate.py
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 1098 1099 1100 1101 1102 1103 |
|
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 ngio/hcs/_plate.py
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 1130 1131 1132 1133 1134 1135 1136 1137 1138 |
|
Open a Well¶
ngio.open_ome_zarr_well
¶
open_ome_zarr_well(
store: StoreOrGroup,
cache: bool = False,
mode: AccessModeLiteral = "r+",
parallel_safe: bool = True,
) -> 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+".
-
parallel_safe
(bool
, default:True
) –Whether the group handler is parallel safe.
Source code in ngio/hcs/_plate.py
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 |
|
ngio.OmeZarrWell Class Reference¶
ngio.OmeZarrWell
¶
OmeZarrWell(group_handler: ZarrGroupHandler)
A class to handle the Well Collection in an OME-Zarr file.
Initialize the LabelGroupHandler.
Parameters:
-
group_handler
(ZarrGroupHandler
) –The Zarr group handler that contains the Well.
Source code in ngio/hcs/_plate.py
72 73 74 75 76 77 78 79 |
|
paths
¶
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 ngio/hcs/_plate.py
100 101 102 103 104 105 106 107 108 109 |
|
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 ngio/hcs/_plate.py
111 112 113 114 115 116 117 |
|
get_image_acquisition_id
¶
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 ngio/hcs/_plate.py
119 120 121 122 123 124 125 126 127 128 |
|
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 ngio/hcs/_plate.py
130 131 132 133 134 135 136 137 138 139 140 |
|
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 ngio/hcs/_plate.py
166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
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 acquision in a well that does not exist at the plate level.
Source code in ngio/hcs/_plate.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|