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
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
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
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 | |
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
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 | |
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
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 694 695 696 697 698 699 | |
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
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
interprete_file_source
¤
interprete_file_source(
file_source: PermissiveFileSource,
) -> FileSource
Source code in src/bioimageio/spec/_internal/io.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | |
is_valid_bioimageio_yaml_name
¤
is_valid_bioimageio_yaml_name(file_name: FileName) -> bool
Source code in src/bioimageio/spec/_internal/io.py
365 366 367 368 369 370 | |
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
365 366 367 368 369 370 371 | |
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
374 375 376 377 378 | |
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 | |