code: def half_to_full_qspace(data, gtab):
      """Half to full Cartesian grid mapping
  
      Useful when dMRI data are provided in one qspace hemisphere as
      DiffusionSpectrum expects data to be in full qspace.
  
      Parameters
      ----------
      data : array, shape (X, Y, Z, W)
          where (X, Y, Z) volume size and W number of gradient directions
      gtab : GradientTable
          container for b-values and b-vectors (gradient directions)
  
      Returns
      -------
      new_data : array, shape (X, Y, Z, 2 * W -1)
      new_gtab : GradientTable
  
      Notes
      -----
      We assume here that only on b0 is provided with the initial data. If that
      is not the case then you will need to write your own preparation function
      before providing the gradients and the data to the DiffusionSpectrumModel
      class.
      """
      bvals = gtab.bvals
      bvecs = gtab.bvecs
      bvals = np.append(bvals, bvals[1:])
      bvecs = np.append(bvecs, -bvecs[1:], axis=0)
      data = np.append(data, data[..., 1:], axis=-1)
      gtab.bvals = bvals.copy()
      gtab.bvecs = bvecs.copy()
      return data, gtab
  
imports: import numpy
  from scipy.ndimage import map_coordinates
  from scipy.fftpack import fftn, fftshift, ifftshift
  from dipy.reconst.odf import OdfModel, OdfFit
  from dipy.reconst.cache import Cache
  from dipy.reconst.multi_voxel import multi_voxel_fit
label_desc: Use image node_id 6 for calling a global function with example usage: half_to_full_qspace(data, gtab) and returns: data,  gtab