@@ -1031,7 +1031,7 @@ def _get_array_data(self, img):
1031
1031
1032
1032
"""
1033
1033
return np .asanyarray (img .dataobj , order = "C" )
1034
-
1034
+
1035
1035
1036
1036
@require_pkg (pkg_name = "nibabel" )
1037
1037
@require_pkg (pkg_name = "cupy" )
@@ -1053,12 +1053,12 @@ def _gds_load(self, file_path):
1053
1053
compressed_data = cp .asnumpy (image )
1054
1054
with gzip .GzipFile (fileobj = io .BytesIO (compressed_data )) as gz_file :
1055
1055
decompressed_data = gz_file .read ()
1056
-
1056
+
1057
1057
file_size = len (decompressed_data )
1058
1058
image = cp .asarray (np .frombuffer (decompressed_data , dtype = np .uint8 ))
1059
1059
1060
1060
return image
1061
-
1061
+
1062
1062
def read (self , data : Sequence [PathLike ] | PathLike , ** kwargs ):
1063
1063
"""
1064
1064
Read image data from specified file or files, it can read a list of images
@@ -1078,7 +1078,7 @@ def read(self, data: Sequence[PathLike] | PathLike, **kwargs):
1078
1078
img = self ._gds_load (name )
1079
1079
img_ .append (img ) # type: ignore
1080
1080
return img_ if len (filenames ) > 1 else img_ [0 ]
1081
-
1081
+
1082
1082
def get_data (self , img ):
1083
1083
"""
1084
1084
Extract data array and metadata from loaded image and return them.
@@ -1121,7 +1121,7 @@ def get_data(self, img):
1121
1121
_copy_compatible_dict (header , compatible_meta )
1122
1122
1123
1123
return self ._stack_images (img_array , compatible_meta ), compatible_meta
1124
-
1124
+
1125
1125
def _get_header (self , img ):
1126
1126
"""
1127
1127
Get the all the metadata of the image and convert to dict type.
@@ -1138,7 +1138,7 @@ def _get_header(self, img):
1138
1138
except ValueError :
1139
1139
pass
1140
1140
return header
1141
-
1141
+
1142
1142
def _stack_images (self , image_list : list , meta_dict : dict ):
1143
1143
if len (image_list ) <= 1 :
1144
1144
return image_list [0 ]
0 commit comments