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))

        preprocess files, transfer to the correct type, and save it to the directory.
        
contrib/MedicalSeg/tools/prepare_msd_brain_seg.py