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()
        with open(self.dataset_json_path, 'r', encoding='utf-8') as f:
            dataset_json_dict = json.load(f)

        if self.image_files_test:
            process_files = (self.image_files, self.label_files,
                             self.image_files_test)
            process_tuple = ("images", "labels", "images_test")
            save_tuple = (self.image_path, self.label_path,
                          self.image_path_test)
        else:
            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 = dataset_json_dict["training"][osp.basename(f).split(
                    ".")[0]]["spacing"] if i == 0 else None
                f_nps = Prep.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)

                if i == 0:
                    dataset_json_dict["training"][osp.basename(f).split(".")[
                        0]]["spacing_resample"] = new_spacing

        with open(self.dataset_json_path, 'w', encoding='utf-8') as f:
            json.dump(dataset_json_dict, f, ensure_ascii=False, indent=4)

        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.py