code: def resampleImage(
      refer_image,
      out_size,
      out_spacing=None,
      interpolator=sitk.sitkLinear,
  ):
      # 根据输出图像，对SimpleITK 的数据进行重新采样。重新设置spacing和shape
      if out_spacing is None:
          out_spacing = tuple(
              (refer_image.GetSize() / np.array(out_size))
              * refer_image.GetSpacing()
          )
  
      resampler = sitk.ResampleImageFilter()
      resampler.SetReferenceImage(refer_image)
      resampler.SetSize(out_size)
      resampler.SetOutputSpacing(out_spacing)
      resampler.SetTransform(sitk.Transform(3, sitk.sitkIdentity))
      resampler.SetInterpolator(interpolator)
      return resampler.Execute(refer_image), out_spacing
  
imports: import numpy
  import SimpleITK
label_desc: Use image node_id 1 for calling a global function with example usage: resampleImage(refer_image, out_size, out_spacing, interpolator) and returns: resampler,  out_spacing