code: def resize_segmentation(segmentation, new_shape, order=3):
      tpe = segmentation.dtype
      unique_labels = np.unique(segmentation)
      assert len(segmentation.shape) == len(
          new_shape
      ), "New shape must have same dimensionality as segmentation, but got {} and {}.".format(
          segmentation.shape, new_shape
      )
      if order == 0:
          return resize(
              segmentation.astype(float),
              new_shape,
              order,
              mode="edge",
              clip=True,
              anti_aliasing=False,
          ).astype(tpe)
      else:
          reshaped = np.zeros(new_shape, dtype=segmentation.dtype)
  
          for i, c in enumerate(unique_labels):
              mask = segmentation == c
              reshaped_multihot = resize(
                  mask.astype(float),
                  new_shape,
                  order,
                  mode="edge",
                  clip=True,
                  anti_aliasing=False,
              )
              reshaped[reshaped_multihot >= 0.5] = c
          return reshaped
  
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 1 for calling a global function with example usage: resize_segmentation(segmentation, new_shape, order) and returns: resize, reshaped