code: def zoom(image, factor, dimension, hdr=False, order=3):
      """
      Zooms the provided image by the supplied factor in the supplied dimension.
      The factor is an integer determining how many slices should be put between each
      existing pair.
      If an image header (hdr) is supplied, its voxel spacing gets updated.
      Returns the image and the updated header or false.
      """
      # check if supplied dimension is valid
      if dimension >= image.ndim:
          raise argparse.ArgumentError(
              "The supplied zoom-dimension {} exceeds the image dimensionality of 0 to {}.".format(
                  dimension, image.ndim - 1
              )
          )
  
      # get logger
      logger = Logger.getInstance()
  
      logger.debug("Old shape = {}.".format(image.shape))
  
      # perform the zoom
      zoom = [1] * image.ndim
      zoom[dimension] = (
          image.shape[dimension] + (image.shape[dimension] - 1) * factor
      ) / float(image.shape[dimension])
      logger.debug("Reshaping with = {}.".format(zoom))
      image = interpolation.zoom(image, zoom, order=order)
  
      logger.debug("New shape = {}.".format(image.shape))
  
      if hdr:
          new_spacing = list(header.get_pixel_spacing(hdr))
          new_spacing[dimension] = new_spacing[dimension] / float(
              factor + 1
          )
          logger.debug(
              "Setting pixel spacing from {} to {}....".format(
                  header.get_pixel_spacing(hdr), new_spacing
              )
          )
          header.set_pixel_spacing(hdr, tuple(new_spacing))
  
      return image, hdr
  
file_path: medpy/bin/medpy_zoom_image.py
imports: import argparse
  import logging
  import os
  from scipy.ndimage import interpolation
  from medpy.core import Logger
  from medpy.io import load, save, header
label_desc: Use image node_id 2 for calling a global function with example usage: zoom(image, factor, dimension, hdr, order) and returns: image,  hdr