code: def run(
      self,
      target_spacings,
      input_folder_with_cropped_npz,
      output_folder,
      data_identifier,
      num_threads=1,
      force_separate_z=None,
  ):
      print("Initializing to run preprocessing")
      print("npz folder:", input_folder_with_cropped_npz)
      print("output_folder:", output_folder)
      list_of_cropped_npz_files = [
          join_paths(input_folder_with_cropped_npz, file_name)
          for file_name in os.listdir(input_folder_with_cropped_npz)
          if os.path.isfile(
              join_paths(input_folder_with_cropped_npz, file_name)
          )
          and file_name.endswith(".npz")
      ]
      list_of_cropped_npz_files.sort()
      os.makedirs(output_folder, exist_ok=True)
      num_stages = len(target_spacings)
      if not isinstance(num_threads, (list, tuple, np.ndarray)):
          num_threads = [num_threads] * num_stages
  
      assert len(num_threads) == num_stages
      with open(
          join_paths(
              input_folder_with_cropped_npz, "dataset_properties.pkl"
          ),
          "rb",
      ) as f:
          all_classes = pickle.load(f)["all_classes"]
  
      for i in range(num_stages):
          all_args = []
          output_folder_stage = join_paths(
              output_folder, data_identifier + "_stage%d" % i
          )
          os.makedirs(output_folder_stage, exist_ok=True)
          spacing = target_spacings[i]
          for j, case in enumerate(list_of_cropped_npz_files):
              case_identifier = get_case_identifier_from_npz(case)
              args = (
                  spacing,
                  case_identifier,
                  output_folder_stage,
                  input_folder_with_cropped_npz,
                  force_separate_z,
                  all_classes,
              )
              all_args.append(args)
          p = Pool(num_threads[i])
          p.starmap(self._run_internal, all_args)
          p.close()
          p.join()
  
imports: import pickle
  import os
  import numpy
  from collections import OrderedDict
  from scipy.ndimage.interpolation import map_coordinates
  from multiprocessing.pool import Pool
  from skimage.transform import resize
  from .image_crop import get_case_identifier_from_npz, ImageCropper
  from .path_utils import join_paths
label_desc: Use image node_id 6 for calling the GenericPreprocessor obj's underlying member method code with example usage: obj.run(target_spacings, input_folder_with_cropped_npz, output_folder, data_identifier, num_threads, force_separate_z) without return types