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
106 107 108 109 110 111 | |
ensure_description_is_dataset
¤
ensure_description_is_dataset(
rd: InvalidDescr | ResourceDescr,
) -> AnyDatasetDescr
Source code in src/bioimageio/spec/_description.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
ensure_description_is_model
¤
ensure_description_is_model(
rd: InvalidDescr | ResourceDescr,
) -> AnyModelDescr
Raises:
| Type | Description |
|---|---|
ValueError
|
for invalid or non-model resources |
Source code in src/bioimageio/spec/_description.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
extract_file_name
¤
extract_file_name(
src: ZarrSource | FileSource | FileDescr | ZipPath,
) -> FileName
-
API Reference
utilsget_file_name
Source code in src/bioimageio/spec/_internal/io.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | |
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
64 65 66 67 68 69 70 71 | |
get_reader
¤
get_reader(
source: PermissiveFileSource | FileDescr | ZipPath,
/,
progressbar: ProgressbarLike
| Callable[[], ProgressbarLike]
| bool
| None = None,
**kwargs: Unpack[HashKwargs],
) -> BytesReader
Open a file source (download if needed)
Source code in src/bioimageio/spec/_internal/io.py
776 777 778 779 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 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | |
get_sha256
¤
get_sha256(
source: BytesReaderP | BytesReaderIntoP | Path,
) -> Sha256
Source code in src/bioimageio/spec/_internal/io_basics.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
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
54 55 56 57 58 59 60 61 | |
identify_bioimageio_yaml_file_name
¤
Source code in src/bioimageio/spec/_internal/io.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
interprete_file_source
¤
interprete_file_source(
file_source: str | pydantic.AnyUrl,
allow_zarr: Literal[False] = False,
) -> FileSource
interprete_file_source(
file_source: str | pydantic.AnyUrl,
allow_zarr: Literal[True] = True,
) -> FileSource | ZarrSource
interprete_file_source(
file_source: str | pydantic.AnyUrl,
allow_zarr: bool = False,
) -> FileSource | ZarrSource
Source code in src/bioimageio/spec/_internal/io.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | |
is_valid_bioimageio_yaml_name
¤
is_valid_bioimageio_yaml_name(file_name: FileName) -> bool
Source code in src/bioimageio/spec/_internal/io.py
414 415 416 417 418 419 | |
load_array
¤
load_array(source: PermissiveFileSource) -> NDArray[Any]
load a numpy ndarray from a .npy file
Source code in src/bioimageio/spec/_internal/io_utils.py
397 398 399 400 401 402 403 | |
load_image
¤
load_image(
source: FileDescr | ZipPath | PermissiveFileSource,
) -> NDArray[Any]
load a single image as numpy array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FileDescr | ZipPath | PermissiveFileSource
|
image source |
required |
Source code in src/bioimageio/spec/utils.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
open_bioimageio_yaml
¤
open_bioimageio_yaml(
source: PermissiveFileSource | ZipFile | ZipPath,
/,
progressbar: bool
| ProgressbarLike
| Callable[[], ProgressbarLike]
| None = None,
**kwargs: Unpack[HashKwargs],
) -> OpenedBioimageioYaml
Source code in src/bioimageio/spec/_internal/io_utils.py
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 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
read_yaml
¤
read_yaml(
file: FilePath
| ZipPath
| IO[str]
| IO[bytes]
| BytesReader
| str,
) -> YamlValue
Source code in src/bioimageio/spec/_internal/io_utils.py
57 58 59 60 61 62 63 64 65 66 | |
save_array
¤
save_array(
path: Path | ZipPath, array: NDArray[Any]
) -> None
save a numpy ndarray to a .npy file
Source code in src/bioimageio/spec/_internal/io_utils.py
406 407 408 409 410 | |
write_yaml
¤
write_yaml(
content: YamlValue
| BioimageioYamlContentView
| BaseModel,
/,
file: NewPath
| FilePath
| IO[str]
| IO[bytes]
| ZipPath,
)
Source code in src/bioimageio/spec/_internal/io_utils.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |