MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / WriteFileMappingd

Class WriteFileMappingd

monai/transforms/io/dictionary.py:323–345  ·  view source on GitHub ↗

Dictionary-based wrapper of :py:class:`monai.transforms.WriteFileMapping`. Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` mapping_file_path: Path to the JSON file where the mapping

Source from the content-addressed store, hash-verified

321
322
323class WriteFileMappingd(MapTransform):
324 """
325 Dictionary-based wrapper of :py:class:`monai.transforms.WriteFileMapping`.
326
327 Args:
328 keys: keys of the corresponding items to be transformed.
329 See also: :py:class:`monai.transforms.compose.MapTransform`
330 mapping_file_path: Path to the JSON file where the mappings will be saved.
331 Defaults to "mapping.json".
332 allow_missing_keys: don't raise exception if key is missing.
333 """
334
335 def __init__(
336 self, keys: KeysCollection, mapping_file_path: Path | str = "mapping.json", allow_missing_keys: bool = False
337 ) -> None:
338 super().__init__(keys, allow_missing_keys)
339 self.mapping = WriteFileMapping(mapping_file_path)
340
341 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
342 d = dict(data)
343 for key in self.key_iterator(d):
344 d[key] = self.mapping(d[key])
345 return d
346
347
348LoadImageD = LoadImageDict = LoadImaged

Callers 1

run_testMethod · 0.90

Calls

no outgoing calls

Tested by 1

run_testMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…