(
self,
channel_dim: str | int | None = None,
as_closest_canonical: bool = False,
squeeze_non_spatial_dims: bool = False,
to_gpu: bool = False,
**kwargs,
)
| 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 | """ |
nothing calls this directly
no test coverage detected