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

Method __init__

monai/data/image_reader.py:1021–1043  ·  view source on GitHub ↗
(
        self,
        channel_dim: str | int | None = None,
        as_closest_canonical: bool = False,
        squeeze_non_spatial_dims: bool = False,
        to_gpu: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

1019 """
1020
1021 def __init__(
1022 self,
1023 channel_dim: str | int | None = None,
1024 as_closest_canonical: bool = False,
1025 squeeze_non_spatial_dims: bool = False,
1026 to_gpu: bool = False,
1027 **kwargs,
1028 ):
1029 super().__init__()
1030 self.channel_dim = float("nan") if channel_dim == "no_channel" else channel_dim
1031 self.as_closest_canonical = as_closest_canonical
1032 self.squeeze_non_spatial_dims = squeeze_non_spatial_dims
1033 if to_gpu and (not has_cp or not has_kvikio):
1034 warnings.warn(
1035 "NibabelReader: CuPy and/or Kvikio not installed for GPU loading, falling back to CPU loading."
1036 )
1037 to_gpu = False
1038
1039 if to_gpu:
1040 self.warmup_kvikio()
1041
1042 self.to_gpu = to_gpu
1043 self.kwargs = kwargs
1044
1045 def warmup_kvikio(self):
1046 """

Callers

nothing calls this directly

Calls 2

warmup_kvikioMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected