code: def do_split(self):
      splits_file = os.path.join(
          self.dataset_directory, "splits_final.pkl"
      )
      if not os.path.isfile(splits_file):
          print("Creating new split...")
          splits = []
          all_keys_sorted = np.sort(list(self.dataset.keys()))
          kfold = KFold(n_splits=5, shuffle=True, random_state=12345)
          for i, (train_idx, test_idx) in enumerate(
              kfold.split(all_keys_sorted)
          ):
              train_keys = np.array(all_keys_sorted)[train_idx]
              test_keys = np.array(all_keys_sorted)[test_idx]
              splits.append(OrderedDict())
              splits[-1]["train"] = train_keys
              splits[-1]["val"] = test_keys
          with open(splits_file, "wb") as f:
              pickle.dump(splits, f)
  
      with open(splits_file, "rb") as f:
          splits = pickle.load(f)
  
      if self.fold == "all":
          tr_keys = val_keys = list(self.dataset.keys())
      else:
          tr_keys = splits[self.fold]["train"]
          val_keys = splits[self.fold]["val"]
  
      tr_keys.sort()
      val_keys.sort()
  
      self.dataset_tr = OrderedDict()
      for i in tr_keys:
          self.dataset_tr[i] = self.dataset[i]
  
      self.dataset_val = OrderedDict()
      for i in val_keys:
          self.dataset_val[i] = self.dataset[i]
  
      # cascade stage 2
      if self.stage == 1 and self.cascade:
          for k in self.dataset:
              self.dataset[k][
                  "seg_from_prev_stage_file"
              ] = os.path.join(
                  self.folder_with_segs_from_prev_stage,
                  k + "_segFromPrevStage.npz",
              )
  
      print(
          "dataset split over! dataset mode: {}, keys: {}".format(
              self.mode, tr_keys if self.mode == "train" else val_keys
          )
      )
  
imports: import os
  import pickle
  import glob
  import json
  import numpy
  from multiprocessing import Pool
  from collections import OrderedDict
  from sklearn.model_selection import KFold
  from typing import List
  from medicalseg.datasets import MedicalDataset
  from medicalseg.cvlibs import manager
  from nnunet.transforms import get_moreDA_augmentation, default_2D_augmentation_params, default_3D_augmentation_params
  from nnunet.transforms import rotate_coords_3d, rotate_coords_2d, NumpyToTensor
  from .dataloader import DataLoader2D, DataLoader3D
  from tools.preprocess_utils import verify_dataset_integrity, convert_to_decathlon, crop, ExperimentPlanner2D_v21, ExperimentPlanner3D_v21, DatasetAnalyzer
label_desc: Use image node_id 11 for calling the MSDDataset obj's underlying member method code with example usage: obj.do_split() without return types