MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / is_supported_format

Function is_supported_format

monai/data/utils.py:1112–1129  ·  view source on GitHub ↗

Verify whether the specified file or files format match supported suffixes. If supported suffixes is None, skip the verification and return True. Args: filename: file name or a list of file names to read. if a list of files, verify all the suffixes. suffixes

(filename: Sequence[PathLike] | PathLike, suffixes: Sequence[str])

Source from the content-addressed store, hash-verified

1110
1111
1112def is_supported_format(filename: Sequence[PathLike] | PathLike, suffixes: Sequence[str]) -> bool:
1113 """
1114 Verify whether the specified file or files format match supported suffixes.
1115 If supported suffixes is None, skip the verification and return True.
1116
1117 Args:
1118 filename: file name or a list of file names to read.
1119 if a list of files, verify all the suffixes.
1120 suffixes: all the supported image suffixes of current reader, must be a list of lower case suffixes.
1121
1122 """
1123 filenames: Sequence[PathLike] = ensure_tuple(filename)
1124 for name in filenames:
1125 full_suffix = "".join(map(str.lower, PurePath(name).suffixes))
1126 if all(f".{s.lower()}" not in full_suffix for s in suffixes):
1127 return False
1128
1129 return True
1130
1131
1132def partition_dataset(

Callers 8

verify_suffixMethod · 0.90
verify_suffixMethod · 0.90
verify_suffixMethod · 0.90
verify_suffixMethod · 0.90
verify_suffixMethod · 0.90
verify_suffixMethod · 0.90
__call__Method · 0.90
test_valueMethod · 0.90

Calls 1

ensure_tupleFunction · 0.90

Tested by 1

test_valueMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…