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

Method __init__

monai/transforms/utility/dictionary.py:266–281  ·  view source on GitHub ↗

Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` strict_check: whether to raise an error when the meta information is insufficient. allow_missing_keys: don't raise e

(
        self, keys: KeysCollection, strict_check: bool = True, allow_missing_keys: bool = False, channel_dim=None
    )

Source from the content-addressed store, hash-verified

264 backend = EnsureChannelFirst.backend
265
266 def __init__(
267 self, keys: KeysCollection, strict_check: bool = True, allow_missing_keys: bool = False, channel_dim=None
268 ) -> None:
269 """
270 Args:
271 keys: keys of the corresponding items to be transformed.
272 See also: :py:class:`monai.transforms.compose.MapTransform`
273 strict_check: whether to raise an error when the meta information is insufficient.
274 allow_missing_keys: don't raise exception if key is missing.
275 channel_dim: This argument can be used to specify the original channel dimension (integer) of the input array.
276 It overrides the `original_channel_dim` from provided MetaTensor input.
277 If the input array doesn't have a channel dim, this value should be ``'no_channel'``.
278 If this is set to `None`, this class relies on `img` or `meta_dict` to provide the channel dimension.
279 """
280 super().__init__(keys, allow_missing_keys)
281 self.adjuster = EnsureChannelFirst(strict_check=strict_check, channel_dim=channel_dim)
282
283 def __call__(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]:
284 d = dict(data)

Callers

nothing calls this directly

Calls 2

EnsureChannelFirstClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected