code: def dicom_series_to_nifti(original_dicom_directory, output_file=None, reorient_nifti=True):
      
      # copy files so we can can modify without altering the original
      temp_directory = tempfile.mkdtemp()
      try:
          dicom_directory = os.path.join(temp_directory, 'dicom')
          shutil.copytree(original_dicom_directory, dicom_directory)
  
          dicom_input = common.read_dicom_directory(dicom_directory)
  
          return dicom_array_to_nifti(dicom_input, output_file, reorient_nifti)
  
      except AttributeError as exception:
          reraise(
              tp=ConversionError,
              value=ConversionError(str(exception)),
              tb=sys.exc_info()[2])
  
      finally:
          # remove the copied data
          shutil.rmtree(temp_directory)
docs: Converts dicom single series (see pydicom) to nifty, mimicking SPM
  
      Examples: See unit test
  
  
      will return a dictionary containing
      - the NIFTI under key 'NIFTI'
      - the NIFTI file path under 'NII_FILE'
      - the BVAL file path under 'BVAL_FILE' (only for dti)
      - the BVEC file path under 'BVEC_FILE' (only for dti)
  
      IMPORTANT:
      If no specific sequence type can be found it will default to anatomical and try to convert.
      You should check that the data you are trying to convert is supported by this code
  
      Inspired by http://nipy.sourceforge.net/nibabel/dicom/spm_dicom.html
      Inspired by http://code.google.com/p/pydicom/source/browse/source/dicom/contrib/pydicom_series.py
  
      :param reorient_nifti: if True the nifti affine and data will be updated so the data is stored LAS oriented
      :param output_file: file path to write to if not set to None
      :param original_dicom_directory: directory with the dicom files for a single series/scan
      :return nibabel image