original_docstring: 
          Load the file in file dir, preprocess it and save it to the directory.
          
docstring: Load the file in file dir, preprocess it and save it to the directory.
docstring_tokens: Load the file in file dir preprocess it and save it to the directory .
code: def load_save(self,
                    file_dir,
                    load_type=np.float32,
                    savepath=None,
                    preprocess=None,
                    tag="image"):
          """
          Load the file in file dir, preprocess it and save it to the directory.
          """
          files = list_files(file_dir)
          assert len(files) != 0, print(
              "The data directory you assigned is wrong, there is no file in it."
          )
  
          for f in files:
              filename = f.split("/")[-1].split(".")[0]
              nii_np = nib.load(f).get_fdata(dtype=load_type)
  
              if preprocess is not None:
                  for op in preprocess:
                      nii_np = op(nii_np)
  
              np.save(os.path.join(savepath, filename), nii_np)
  
          print("Sucessfully convert medical images to numpy array!")
code_tokens: def load_save ( self , file_dir , load_type = np . float32 , savepath = None , preprocess = None , tag = "image" ) : files = list_files ( file_dir ) assert len ( files ) != 0 , print ( "The data directory you assigned is wrong, there is no file in it." ) for f in files : filename = f . split ( "/" ) [ - 1 ] . split ( "." ) [ 0 ] nii_np = nib . load ( f ) . get_fdata ( dtype = load_type ) if preprocess is not None : for op in preprocess : nii_np = op ( nii_np ) np . save ( os . path . join ( savepath , filename ) , nii_np ) print ( "Sucessfully convert medical images to numpy array!" )
short_docstring: Load the file in file dir, preprocess it and save it to the directory.
short_docstring_tokens: Load the file in file dir preprocess it and save it to the directory .
comment: """
          Load the file in file dir, preprocess it and save it to the directory.
          """