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

Class SqueezeDimd

monai/transforms/utility/dictionary.py:770–795  ·  view source on GitHub ↗

Dictionary-based wrapper of :py:class:`monai.transforms.SqueezeDim`.

Source from the content-addressed store, hash-verified

768
769
770class SqueezeDimd(MapTransform):
771 """
772 Dictionary-based wrapper of :py:class:`monai.transforms.SqueezeDim`.
773 """
774
775 backend = SqueezeDim.backend
776
777 def __init__(
778 self, keys: KeysCollection, dim: int = 0, update_meta: bool = True, allow_missing_keys: bool = False
779 ) -> None:
780 """
781 Args:
782 keys: keys of the corresponding items to be transformed.
783 See also: :py:class:`monai.transforms.compose.MapTransform`
784 dim: dimension to be squeezed. Default: 0 (the first dimension)
785 update_meta: whether to update the meta info if the input is a metatensor. Default is ``True``.
786 allow_missing_keys: don't raise exception if key is missing.
787 """
788 super().__init__(keys, allow_missing_keys)
789 self.converter = SqueezeDim(dim=dim, update_meta=update_meta)
790
791 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
792 d = dict(data)
793 for key in self.key_iterator(d):
794 d[key] = self.converter(d[key])
795 return d
796
797
798class DataStatsd(MapTransform):

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…