utils
¤
Utility functions for bioimage.io specifications (mostly IO).
Classes:
| Name | Description |
|---|---|
SpdxLicenseEntry |
|
SpdxLicenses |
|
Functions:
| Name | Description |
|---|---|
empty_cache |
Empty the bioimageio disk cache. |
ensure_description_is_dataset |
|
ensure_description_is_model |
Raises: |
extract_file_name |
|
get_bioimageio_json_schema |
get the bioimageio specification as a JSON schema |
get_reader |
Open a file |
get_sha256 |
|
get_spdx_licenses |
get details of the SPDX licenses known to bioimageio.spec |
identify_bioimageio_yaml_file_name |
|
interprete_file_source |
|
is_valid_bioimageio_yaml_name |
|
load_array |
load a numpy ndarray from a .npy file |
load_image |
load a single image as numpy array |
open_bioimageio_yaml |
|
read_yaml |
|
save_array |
save a numpy ndarray to a .npy file |
write_yaml |
|
Attributes:
| Name | Type | Description |
|---|---|---|
download |
|
|
get_file_name |
|
SpdxLicenseEntry
¤
Bases: TypedDict
flowchart TD
bioimageio.spec.utils.SpdxLicenseEntry[SpdxLicenseEntry]
click bioimageio.spec.utils.SpdxLicenseEntry href "" "bioimageio.spec.utils.SpdxLicenseEntry"
Attributes:
| Name | Type | Description |
|---|---|---|
isDeprecatedLicenseId |
bool
|
|
isKnownByZenodo |
bool
|
|
isOsiApproved |
bool
|
|
licenseId |
str
|
|
name |
str
|
|
reference |
str
|
|
SpdxLicenses
¤
Bases: TypedDict
flowchart TD
bioimageio.spec.utils.SpdxLicenses[SpdxLicenses]
click bioimageio.spec.utils.SpdxLicenses href "" "bioimageio.spec.utils.SpdxLicenses"
-
API Reference
utilsget_spdx_licenses
Attributes:
| Name | Type | Description |
|---|---|---|
licenseListVersion |
str
|
|
licenses |
List[SpdxLicenseEntry]
|
|
releaseDate |
str
|
|
empty_cache
¤
empty_cache()
Empty the bioimageio disk cache.
Source code in src/bioimageio/spec/utils.py
99 100 101 102 103 104 | |
ensure_description_is_dataset
¤
ensure_description_is_dataset(
rd: Union[InvalidDescr, ResourceDescr],
) -> AnyDatasetDescr
Source code in src/bioimageio/spec/_description.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
ensure_description_is_model
¤
ensure_description_is_model(
rd: Union[InvalidDescr, ResourceDescr],
) -> AnyModelDescr
Raises:
| Type | Description |
|---|---|
ValueError
|
for invalid or non-model resources |
Source code in src/bioimageio/spec/_description.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
extract_file_name
¤
extract_file_name(
src: Union[
pydantic.HttpUrl,
RootHttpUrl,
PurePath,
RelativeFilePath,
ZipPath,
FileDescr,
],
) -> FileName
-
API Reference
utilsget_file_name
Source code in src/bioimageio/spec/_internal/io.py
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 | |
get_bioimageio_json_schema
¤
get_bioimageio_json_schema() -> Dict[str, Any]
get the bioimageio specification as a JSON schema
Source code in src/bioimageio/spec/utils.py
62 63 64 65 66 67 68 69 | |
get_reader
¤
get_reader(
source: Union[PermissiveFileSource, FileDescr, ZipPath],
/,
progressbar: Union[
Progressbar, Callable[[], Progressbar], bool, None
] = None,
**kwargs: Unpack[HashKwargs],
) -> BytesReader
Open a file source (download if needed)
Source code in src/bioimageio/spec/_internal/io.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | |
get_sha256
¤
get_sha256(
source: Union[BytesReaderP, BytesReaderIntoP, Path],
) -> Sha256
Source code in src/bioimageio/spec/_internal/io_basics.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
get_spdx_licenses
¤
get_spdx_licenses() -> SpdxLicenses
get details of the SPDX licenses known to bioimageio.spec
Source code in src/bioimageio/spec/utils.py
52 53 54 55 56 57 58 59 | |
identify_bioimageio_yaml_file_name
¤
Source code in src/bioimageio/spec/_internal/io.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
interprete_file_source
¤
interprete_file_source(
file_source: PermissiveFileSource,
) -> FileSource
Source code in src/bioimageio/spec/_internal/io.py
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | |
is_valid_bioimageio_yaml_name
¤
is_valid_bioimageio_yaml_name(file_name: FileName) -> bool
Source code in src/bioimageio/spec/_internal/io.py
371 372 373 374 375 376 | |
load_array
¤
load_array(
source: Union[FileSource, FileDescr, ZipPath],
) -> NDArray[Any]
load a numpy ndarray from a .npy file
Source code in src/bioimageio/spec/_internal/io_utils.py
370 371 372 373 374 375 376 | |
load_image
¤
load_image(
source: Union[FileDescr, ZipPath, PermissiveFileSource],
) -> NDArray[Any]
load a single image as numpy array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Union[FileDescr, ZipPath, PermissiveFileSource]
|
image source |
required |
Source code in src/bioimageio/spec/utils.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
open_bioimageio_yaml
¤
open_bioimageio_yaml(
source: Union[PermissiveFileSource, ZipFile, ZipPath],
/,
**kwargs: Unpack[HashKwargs],
) -> OpenedBioimageioYaml
Source code in src/bioimageio/spec/_internal/io_utils.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
read_yaml
¤
read_yaml(
file: Union[
FilePath,
ZipPath,
IO[str],
IO[bytes],
BytesReader,
str,
],
) -> YamlValue
Source code in src/bioimageio/spec/_internal/io_utils.py
53 54 55 56 57 58 59 60 61 62 | |
save_array
¤
save_array(
path: Union[Path, ZipPath], array: NDArray[Any]
) -> None
save a numpy ndarray to a .npy file
Source code in src/bioimageio/spec/_internal/io_utils.py
379 380 381 382 383 | |
write_yaml
¤
write_yaml(
content: Union[
YamlValue, BioimageioYamlContentView, BaseModel
],
/,
file: Union[
NewPath, FilePath, IO[str], IO[bytes], ZipPath
],
)
Source code in src/bioimageio/spec/_internal/io_utils.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |