code: def collect_cv_niftis(
      cv_folder: str,
      output_folder: str,
      validation_folder_name: str = "validation_raw",
      folds: tuple = (0, 1, 2, 3, 4),
  ):
      validation_raw_folders = [
          os.path.join(cv_folder, "fold_%d" % i, validation_folder_name)
          for i in folds
      ]
      exist = [os.path.isdir(i) for i in validation_raw_folders]
  
      if not all(exist):
          raise RuntimeError(
              "some folds are missing. Please run the full 5-fold cross-validation. "
              "The following folds seem to be missing: %s"
              % [i for j, i in enumerate(folds) if not exist[j]]
          )
  
      if not os.path.exists(output_folder):
          os.makedirs(output_folder, exist_ok=True)
      for f in folds:
          folder = validation_raw_folders[f]
          niftis = [
              os.path.join(folder, i)
              for i in os.listdir(folder)
              if os.path.isfile(os.path.join(folder, i))
              and i.endswith(".nii.gz")
          ]
          for n in niftis:
              shutil.copy(n, output_folder)
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/all_folds_eval.py
imports: import argparse
  import os
  import sys
  import json
  import shutil
  from typing import Tuple
  from nnunet.utils import aggregate_scores, determine_postprocessing
label_desc: Use image node_id 1 for calling a global function with example usage: collect_cv_niftis(cv_folder, output_folder, validation_folder_name, folds) without return types