class_docstr: Simple interface to trim a few volumes from a 4d fmri nifti file
  
  Examples
  --------
  >>> from nipype.interfaces.nipy.preprocess import Trim
  >>> trim = Trim()
  >>> trim.inputs.in_file = 'functional.nii'
  >>> trim.inputs.begin_index = 3 # remove 3 first volumes
  >>> res = trim.run() # doctest: +SKIP
code: def _run_interface(self, runtime):
      out_file = self._list_outputs()["out_file"]
      nii = nb.load(self.inputs.in_file)
      if self.inputs.end_index == 0:
          s = slice(self.inputs.begin_index, nii.shape[3])
      else:
          s = slice(self.inputs.begin_index, self.inputs.end_index)
      nii2 = nb.Nifti1Image(nii.dataobj[..., s], nii.affine, nii.header)
      nb.save(nii2, out_file)
      return runtime
  
imports: import os
  import nibabel
  import numpy
  from ...utils.filemanip import split_filename, fname_presuffix
  from .base import NipyBaseInterface, have_nipy
  from ..base import TraitedSpec, traits, BaseInterfaceInputSpec, isdefined, File, InputMultiPath, OutputMultiPath
label_desc: Use image node_id 1 for calling the Trim obj's underlying member method code with example usage: obj._run_interface(runtime) and returns: runtime