code: def split_4d(
      input_folder,
      output_folder="./",
      data_json="dataset.json",
      train_images_dir="imagesTr",
      train_labels_dir="labelsTr",
      test_images_dir="imagesTs",
      num_processes=8,
  ):
      assert (
          os.path.isdir(join_paths(input_folder, train_images_dir))
          and os.path.isdir(join_paths(input_folder, train_labels_dir))
          and os.path.isfile(join_paths(input_folder, data_json))
      ), (
          "The input folder must be a valid Task folder from the Medical Segmentation Decathlon with at least the "
          "{} and {} subdirs and the {} file.".format(
              train_images_dir, train_labels_dir, test_images_dir
          )
      )
      if os.path.isdir(output_folder):
          shutil.rmtree(output_folder)
      shutil.copytree(
          join_paths(input_folder, train_labels_dir),
          join_paths(output_folder, train_labels_dir),
      )
      shutil.copy(join_paths(input_folder, data_json), output_folder)
  
      files = []
      output_dirs = []
      os.makedirs(output_folder, exist_ok=True)
      for subdir in [train_images_dir, test_images_dir]:
          curr_out_dir = join_paths(output_folder, subdir)
          if not os.path.isdir(curr_out_dir):
              os.mkdir(curr_out_dir)
          curr_dir = join_paths(input_folder, subdir)
          nii_files = [
              join_paths(curr_dir, i)
              for i in os.listdir(curr_dir)
              if i.endswith(".nii.gz")
          ]
          nii_files.sort()
          for n in nii_files:
              files.append(n)
              output_dirs.append(curr_out_dir)
  
      p = Pool(num_processes)
      p.starmap(split_4d_nifti, zip(files, output_dirs))
      p.close()
      p.join()
  
file_path: PaddleSeg/contrib/MedicalSeg/tools/preprocess_utils/convert_to_decathlon.py
imports: import os
  import shutil
  import numpy
  import SimpleITK
  from multiprocessing import Pool
  from .path_utils import join_paths
label_desc: Use image node_id 5 for calling a global function with example usage: split_4d(input_folder, output_folder, data_json, train_images_dir, train_labels_dir, test_images_dir, num_processes) without return types