code: def augment_linear_downsampling_scipy(
      data_sample,
      zoom_range=(0.5, 1),
      per_channel=True,
      p_per_channel=1,
      channels=None,
      order_downsample=1,
      order_upsample=0,
      ignore_axes=None,
  ):
      if not isinstance(zoom_range, (list, tuple, np.ndarray)):
          zoom_range = [zoom_range]
  
      shp = np.array(data_sample.shape[1:])
      dim = len(shp)
  
      if not per_channel:
          if isinstance(zoom_range[0], (tuple, list, np.ndarray)):
              assert len(zoom_range) == dim
              zoom = np.array(
                  [np.random.uniform(i[0], i[1]) for i in zoom_range]
              )
          else:
              zoom = np.random.uniform(zoom_range[0], zoom_range[1])
  
          target_shape = np.round(shp * zoom).astype(int)
  
          if ignore_axes is not None:
              for i in ignore_axes:
                  target_shape[i] = shp[i]
  
      if channels is None:
          channels = list(range(data_sample.shape[0]))
  
      for c in channels:
          if np.random.uniform() < p_per_channel:
              if per_channel:
                  if isinstance(
                      zoom_range[0], (tuple, list, np.ndarray)
                  ):
                      assert len(zoom_range) == dim
                      zoom = np.array(
                          [
                              np.random.uniform(i[0], i[1])
                              for i in zoom_range
                          ]
                      )
                  else:
                      zoom = np.random.uniform(
                          zoom_range[0], zoom_range[1]
                      )
  
                  target_shape = np.round(shp * zoom).astype(int)
                  if ignore_axes is not None:
                      for i in ignore_axes:
                          target_shape[i] = shp[i]
  
              downsampled = resize(
                  data_sample[c].astype(float),
                  target_shape,
                  order=order_downsample,
                  mode="edge",
                  anti_aliasing=False,
              )
              data_sample[c] = resize(
                  downsampled,
                  shp,
                  order=order_upsample,
                  mode="edge",
                  anti_aliasing=False,
              )
  
      return data_sample
  
imports: from typing import List, Tuple, Union, Callable
  import collections
  import numbers
  import random
  import numpy
  import scipy
  import scipy.ndimage
  import SimpleITK
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
  from skimage.transform import resize
label_desc: Use image node_id 14 for calling a global function with example usage: augment_linear_downsampling_scipy(data_sample, zoom_range, per_channel, p_per_channel, channels, order_downsample, order_upsample, ignore_axes) and returns: data_sample