docs: def _mosaic_4d_to_nifti(dicom_input, output_file):
      """
      This function will convert siemens 4d series to a nifti
      Some inspiration on which fields can be used was taken from
      http://slicer.org/doc/html/DICOMDiffusionVolumePlugin_8py_source.html
      """
      # Get the sorted mosaics
      logger.info('Sorting dicom slices')
      sorted_mosaics = _get_sorted_mosaics(dicom_input)
      common.validate_orientation(sorted_mosaics)
  
      # Create mosaic block
      logger.info('Creating data block')
      full_block = _mosaic_get_full_block(sorted_mosaics)
  
      logger.info('Creating affine')
      # Create the nifti header info
      affine = _create_affine_siemens_mosaic(dicom_input)
      logger.info('Creating nifti')
      # Convert to nifti
      nii_image = nibabel.Nifti1Image(full_block, affine)
      common.set_tr_te(nii_image, float(sorted_mosaics[0].RepetitionTime), float(sorted_mosaics[0].EchoTime))
      logger.info('Saving nifti to disk')
      # Save to disk
      if output_file is not None:
          nii_image.to_filename(output_file)
  
      if _is_diffusion_imaging(dicom_input[0]):
          # Create the bval en bvec files
          logger.info('Creating bval en bvec')
          bval_file = None
          bvec_file = None
          if output_file is not None:
              base_path = os.path.dirname(output_file)
              base_name = os.path.splitext(os.path.splitext(os.path.basename(output_file))[0])[0]
              logger.info('Saving bval en bvec files')
              bval_file = '%s/%s.bval' % (base_path, base_name)
              bvec_file = '%s/%s.bvec' % (base_path, base_name)
          bvals = _create_bvals(sorted_mosaics, bval_file)
          bvecs = _create_bvecs(sorted_mosaics, bvec_file)
  
          return {'NII_FILE': output_file,
                  'BVAL_FILE': bval_file,
                  'BVEC_FILE': bvec_file,
                  'NII': nii_image,
                  'BVAL': bvals,
                  'BVEC': bvecs}
  
      return {'NII_FILE': output_file,
              'NII': nii_image}