code: def predict_from_folder(
      predictor,
      input_folder: str,
      output_folder: str,
      save_npz: bool,
      num_threads_preprocessing: int,
      num_threads_nifti_save: int,
      lowres_segmentations,
      tta: bool,
      mixed_precision: bool = True,
      overwrite_existing: bool = True,
      mode: str = "normal",
      step_size: float = 0.5,
      segmentation_export_kwargs: dict = None,
      disable_postprocessing: bool = False,
      plan_path=None,
      postprocessing_json_path=None,
  ):
      os.makedirs(output_folder, exist_ok=True)
  
      assert os.path.exists(
          plan_path
      ), "plan file path: {} not exists.".format(plan_path)
      shutil.copy(plan_path, output_folder)
  
      with open(plan_path, "rb") as f:
          expected_num_modalities = pickle.load(f)["num_modalities"]
      case_ids = check_input_folder_and_return_caseIDs(
          input_folder, expected_num_modalities
      )
      output_files = [
          os.path.join(output_folder, i + ".nii.gz") for i in case_ids
      ]
      all_files = [
          file
          for file in os.listdir(input_folder)
          if os.path.isfile(os.path.join(input_folder, file))
          and file.endswith(".nii.gz")
      ]
      all_files.sort()
      list_of_lists = [
          [
              os.path.join(input_folder, i)
              for i in all_files
              if i[: len(j)].startswith(j) and len(i) == (len(j) + 12)
          ]
          for j in case_ids
      ]
  
      if lowres_segmentations is not None:
          assert os.path.isdir(
              lowres_segmentations
          ), "if lowres_segmentations is not None then it must point to a directory"
          lowres_segmentations = [
              os.path.join(lowres_segmentations, i + ".nii.gz")
              for i in case_ids
          ]
          assert all(
              [os.path.isfile(i) for i in lowres_segmentations]
          ), (
              "not all lowres_segmentations files are present. "
              "(I was searching for case_id.nii.gz in that folder)"
          )
      else:
          lowres_segmentations = None
  
      if mode == "normal":
          return predict_cases(
              predictor=predictor,
              list_of_lists=list_of_lists,
              output_filenames=output_files,
              save_npz=save_npz,
              num_threads_preprocessing=num_threads_preprocessing,
              num_threads_nifti_save=num_threads_nifti_save,
              segs_from_prev_stage=lowres_segmentations,
              do_tta=tta,
              mixed_precision=mixed_precision,
              overwrite_existing=overwrite_existing,
              step_size=step_size,
              segmentation_export_kwargs=segmentation_export_kwargs,
              disable_postprocessing=disable_postprocessing,
              postprocessing_json_path=postprocessing_json_path,
          )
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/predict.py
imports: import argparse
  import os
  import sys
  import pickle
  import shutil
  import numpy
  from copy import deepcopy
  from medicalseg.models import NNUNet
  from nnunet.utils import predict_cases, MultiFoldsPredictor
label_desc: Use image node_id 3 for calling a global function with example usage: predict_from_folder(predictor, input_folder, output_folder, save_npz, num_threads_preprocessing, num_threads_nifti_save, lowres_segmentations, tta, mixed_precision, overwrite_existing, mode, step_size, segmentation_export_kwargs, disable_postprocessing, plan_path, postprocessing_json_path) and returns: predict_cases