@@ -523,7 +523,7 @@ def read(self, data: Sequence[PathLike] | PathLike, **kwargs):
523523 series_slcs = [slc for slc in glob .glob (os .path .join (name , "*" )) if re .match (self .fname_regex , slc )]
524524 else :
525525 series_slcs = [slc for slc in glob .glob (os .path .join (name , "*" )) if pydicom .misc .is_dicom (slc )]
526- self .filenames [i ] = series_slcs
526+ self .filenames [i ] = series_slcs # type: ignore
527527 slices = []
528528 for slc in series_slcs :
529529 try :
@@ -640,7 +640,7 @@ def get_data(self, data) -> tuple[np.ndarray, dict]:
640640 # a list of list, each inner list represents a dicom series
641641 else :
642642 for i , series in enumerate (data ):
643- dicom_data .append (self ._combine_dicom_series (series , self .filenames [i ]))
643+ dicom_data .append (self ._combine_dicom_series (series , self .filenames [i ])) # type: ignore
644644 else :
645645 # a single pydicom dataset object
646646 if not isinstance (data , list ):
@@ -934,8 +934,7 @@ def _get_array_data_from_gpu(self, img, filename):
934934 if pixel_data_tag not in img :
935935 raise ValueError (f"dicom data: { filename } does not have pixel data." )
936936
937- pixel_data_element = img [pixel_data_tag ]
938- offset = pixel_data_element .value_tell ()
937+ offset = img .get_item (pixel_data_tag , keep_deferred = True ).value_tell
939938
940939 with kvikio .CuFile (filename , "r" ) as f :
941940 buffer = cp .empty (expected_pixel_data_length , dtype = cp .int8 )
@@ -975,6 +974,8 @@ def _get_array_data(self, img, filename):
975974
976975 if rescale_flag :
977976 if self .to_gpu :
977+ slope = cp .asarray (slope , dtype = cp .float32 )
978+ offset = cp .asarray (offset , dtype = cp .float32 )
978979 data = data .astype (cp .float32 ) * slope + offset
979980 else :
980981 data = data .astype (np .float32 ) * slope + offset
0 commit comments