code: def get_sizestr(img):
      
      n_x, n_y, n_slices = img.shape[:3]
      import numpy as np
      voxel_dims = np.array(img.header.get_zooms()[:3])
      matrix_size = '{0}x{1}'.format(num_to_str(n_x), num_to_str(n_y))
      voxel_size = 'x'.join([num_to_str(s) for s in voxel_dims])
      fov = [n_x, n_y] * voxel_dims[:2]
      fov = 'x'.join([num_to_str(s) for s in fov])
      return n_slices, voxel_size, matrix_size, fov
docs: Extract and reformat voxel size, matrix size, field of view, and number of
      slices into pretty strings.
  
      Parameters
      ----------
      img : :obj:`nibabel.Nifti1Image`
          Image from scan from which to derive parameters.
  
      Returns
      -------
      n_slices : :obj:`int`
          Number of slices.
      voxel_size : :obj:`str`
          Voxel size string (e.g., '2x2x2')
      matrix_size : :obj:`str`
          Matrix size string (e.g., '128x128')
      fov : :obj:`str`
          Field of view string (e.g., '256x256')