docstr: preprocess files, transfer to the correct type, and save it to the directory.
docstr_tok: ["preprocess","files",",","transfer","to","the","correct","type",",","and","save","it","to","the","directory","."]
code: def load_save(self):
      """
      preprocess files, transfer to the correct type, and save it to the directory.
      """
      print(
          "Start convert images to numpy array using {}, please wait patiently".format(
              self.gpu_tag
          )
      )
      tic = time.time()
      process_files = (self.image_files, self.label_files)
      process_tuple = ("images", "labels")
      save_tuple = (self.image_path, self.label_path)
      for i, files in enumerate(process_files):
          pre = self.preprocess[process_tuple[i]]
          savepath = save_tuple[i]
          for f in tqdm(
              files,
              total=len(files),
              desc="preprocessing the {}".format(
                  ["images", "labels", "images_test"][i]
              ),
          ):
              # load data will transpose the image from "zyx" to "xyz"
              spacing = (1, 1, 1)
              f_nps = self.load_medical_data(f)
              for volume_idx, f_np in enumerate(f_nps):
                  for op in pre:
                      if op.__name__ == "resample":
                          f_np, new_spacing = op(
                              f_np, spacing=spacing
                          )  # (960, 15, 960) if transpose
                      else:
                          f_np = op(f_np)
                  f_np = (
                      f_np.astype("float32")
                      if i == 0
                      else f_np.astype("int32")
                  )
                  volume_idx = (
                      "" if len(f_nps) == 1 else f"-{volume_idx}"
                  )
                  np.save(
                      join_paths(
                          savepath,
                          osp.basename(f).split(".")[0] + volume_idx,
                      ),
                      f_np,
                  )
      print(
          "The preprocess time on {} is {}".format(
              self.gpu_tag, time.time() - tic
          )
      )
  
file_path: PaddleSeg/contrib/MedicalSeg/tools/prepare_msd_brain_seg.py
imports: import os
  import os.path
  import sys
  import time
  import numpy
  import nibabel
  import SimpleITK
  from tqdm import tqdm
  from prepare import Prep
  from tools.preprocess_utils import join_paths
label_desc: Use image node_id 5 for calling the PrepMSDBrain obj's underlying member method code with example usage: obj.load_save() without return types