code: def load_remove_save(
      input_file: str,
      output_file: str,
      for_which_classes: list,
      minimum_valid_object_size: dict = None,
  ):
      img_in = sitk.ReadImage(input_file)
      img_npy = sitk.GetArrayFromImage(img_in)
      volume_per_voxel = float(
          np.prod(img_in.GetSpacing(), dtype=np.float64)
      )
      (
          image,
          largest_removed,
          kept_size,
      ) = remove_all_but_the_largest_connected_component(
          img_npy,
          for_which_classes,
          volume_per_voxel,
          minimum_valid_object_size,
      )
      img_out_itk = sitk.GetImageFromArray(image)
      img_out_itk = copy_geometry(img_out_itk, img_in)
      sitk.WriteImage(img_out_itk, output_file)
      return largest_removed, kept_size
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/utils/postprocessing.py
imports: import os
  import shutil
  import json
  import numpy
  import SimpleITK
  from multiprocessing.pool import Pool
  from scipy.ndimage import label
  from copy import deepcopy
  from .evaluator import aggregate_scores
label_desc: Use image node_id 3 for calling a global function with example usage: load_remove_save(input_file, output_file, for_which_classes, minimum_valid_object_size) and returns: largest_removed,  kept_size