You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ft_read_mri.m
    path of file: ./repos/CBIG/external_packages/matlab/default_packages/cifti-matlab/private
    
    the code of the file until where you have to start completion: function [mri] = ft_read_mri(filename, varargin)

% FT_READ_MRI reads anatomical and functional MRI data from different
% file formats. The output data is structured in such a way that it is
% comparable to a FieldTrip source reconstruction.
%
% Use as
%   [mri] = ft_read_mri(filename)
%
% Additional options should be specified in key-value pairs and can be
%   'dataformat' =  string specifying the file format, determining the low-
%                   level reading routine to be used. If no format is given,
%                   it is determined automatically from the file.
%                   The following formats can be specified:
%                        'afni_head'/'afni_brik'      uses afni
%                        'analyze_img'/'analyze_hdr'  uses spm
%                        'analyze_old'                uses Darren Webber's code
%                        'asa_mri'
%                        'ctf_mri'
%                        'ctf_mri4'
%                        'ctf_svl'
%                        'dicom'             uses freesurfer
%                        'dicom_old'         uses own code
%                        'freesurfer_mgh'    uses freesurfer
%                        'freesurfer_mgz'    uses freesurfer
%                        'minc'              uses spm (<= version spm5)
%                        'nifti'             uses freesurfer
%                        'nifti_fsl'         uses freesurfer
%                        'nifti_spm'         uses spm
%                        'neuromag_fif'      uses mne toolbox
%                        'neuromag_fif_old'  uses meg-pd toolbox
%                        'yokogawa_mri'
%                        'matlab'            assumes a MATLAB *.mat file containing a mri structure
%                                            according FieldTrip standards
%
% The following MRI file formats are supported
%   CTF - VSM MedTech (*.svl, *.mri version 4 and 5)
%   NIFTi (*.nii) and zipped NIFTi (*.nii.gz)
%   Analyze (*.img, *.hdr)
%   DICOM (*.dcm, *.ima)
%   AFNI (*.head, *.brik)
%   FreeSurfer (*.mgz, *.mgh)
%   MINC (*.mnc)

    
function [mri] = ft_read_mri(filename, varargin)

% FT_READ_MRI reads anatomical and functional MRI data from different
% file formats. The output data is structured in such a way that it is
% comparable to a FieldTrip source reconstruction.
%
% Use as
%   [mri] = ft_read_mri(filename)
%
% Additional options should be specified in key-value pairs and can be
%   'dataformat' =  string specifying the file format, determining the low-
%                   level reading routine to be used. If no format is given,
%                   it is determined automatically from the file.
%                   The following formats can be specified:
%                        'afni_head'/'afni_brik'      uses afni
%                        'analyze_img'/'analyze_hdr'  uses spm
%                        'analyze_old'                uses Darren Webber's code
%                        'asa_mri'
%                        'ctf_mri'
%                        'ctf_mri4'
%                        'ctf_svl'
%                        'dicom'             uses freesurfer
%                        'dicom_old'         uses own code
%                        'freesurfer_mgh'    uses freesurfer
%                        'freesurfer_mgz'    uses freesurfer
%                        'minc'              uses spm (<= version spm5)
%                        'nifti'             uses freesurfer
%                        'nifti_fsl'         uses freesurfer
%                        'nifti_spm'         uses spm
%                        'neuromag_fif'      uses mne toolbox
%                        'neuromag_fif_old'  uses meg-pd toolbox
%                        'yokogawa_mri'
%                        'matlab'            assumes a MATLAB *.mat file containing a mri structure
%                                            according FieldTrip standards
%
% The following MRI file formats are supported
%   CTF - VSM MedTech (*.svl, *.mri version 4 and 5)
%   NIFTi (*.nii) and zipped NIFTi (*.nii.gz)
%   Analyze (*.img, *.hdr)
%   DICOM (*.dcm, *.ima)
%   AFNI (*.head, *.brik)
%   FreeSurfer (*.mgz, *.mgh)
%   MINC (*.mnc)
%   Neuromag - Elekta (*.fif)
%   ANT - Advanced Neuro Technology (*.mri)
%   Yokogawa (*.mrk, incomplete)
%
% If you have a series of DICOM files, please provide the name of any of the files 
% in the series (e.g. the first one). The other files will be found automatically.
%
% The output MRI may have a homogenous transformation matrix that converts
% the coordinates of each voxel (in xgrid/ygrid/zgrid) into head
% coordinates.
%
% See also FT_WRITE_MRI, FT_READ_DATA, FT_READ_HEADER, FT_READ_EVENT

% Copyright (C) 2008-2013, Robert Oostenveld & Jan-Mathijs Schoffelen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

% optionally get the data from the URL and make a temporary local copy
filename = fetch_url(filename);

% get the options
dataformat = ft_getopt(varargin, 'dataformat');

% the following is added for backward compatibility of using 'format' rather than 'dataformat'
format    = ft_getopt(varargin, 'format');
if ~isempty(format)
  warning('the option ''format'' will be deprecated soon, please use ''dataformat'' instead');
  if isempty(dataformat)
    dataformat  = format;
  end