code: def _vol_split(train, vol_idx):
      """Split the 3D volumes into the train and test set.
  
      Parameters
      ----------
      train : ndarray
          Array of all 3D patches flattened out to be 2D.
  
      vol_idx: int
          The volume number that needs to be held out for training.
  
      Returns
      -------
      cur_x : 2D-array (nvolumes*patch_size) x (nvoxels)
          Array of patches corresponding to all the volumes except for the
          held-out volume.
  
      y : 1D-array
          Array of patches corresponding to the volume that is used a target for
          denoising.
      """
      # Hold-out the target volume
      mask = np.zeros(train.shape[0])
      mask[vol_idx] = 1
      cur_x = train[mask == 0]
      cur_x = cur_x.reshape(
          ((train.shape[0] - 1) * train.shape[1], train.shape[2])
      )
  
      # Center voxel of the selected block
      y = train[vol_idx, train.shape[1] // 2, :]
      return cur_x, y
  
file_path: dipy/dipy/denoise/patch2self.py
imports: import numpy
  from warnings import warn
  import time
  from dipy.utils.optpkg import optional_package
  import dipy.core.optimize
label_desc: Use image node_id 1 for calling a global function with example usage: _vol_split(train, vol_idx) and returns: cur_x,  y