code: def resample_and_save(
      seg_map,
      target_shape,
      output_file,
      force_separate_z=False,
      interpolation_order=1,
      interpolation_order_z=0,
      remove_seg=True,
  ):
      if isinstance(seg_map, str):
          assert os.path.isfile(
              seg_map
          ), "If isinstance(segmentation_softmax, str) then isfile(segmentation_softmax) must be True."
          del_file = deepcopy(seg_map)
          seg_map = np.load(seg_map)
          if remove_seg:
              os.remove(del_file)
  
      predicted_new_shape = resample_data_or_seg(
          seg_map,
          target_shape,
          False,
          order=interpolation_order,
          do_separate_z=force_separate_z,
          order_z=interpolation_order_z,
      )
      seg_new_shape = predicted_new_shape.argmax(0)
      np.savez_compressed(
          output_file, data=seg_new_shape.astype(np.uint8)
      )
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/utils/utils.py
imports: import os
  import pickle
  import numpy
  import SimpleITK
  from copy import deepcopy
  from typing import Union, Tuple
  from tools.preprocess_utils.preprocessing import get_do_separate_z, get_lowres_axis, resample_data_or_seg
label_desc: Use image node_id 1 for calling a global function with example usage: resample_and_save(seg_map, target_shape, output_file, force_separate_z, interpolation_order, interpolation_order_z, remove_seg) without return types