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: view_image_reg.m
    path of file: ./repos/brainstorm3/toolbox/gui
    
    the code of the file until where you have to start completion: function [hFig, iDS, iFig] = view_image_reg(Data, Labels, iDims, DimLabels, FileName, hFig, ColormapType, ShowLabels, PageName, DisplayUnits)
% VIEW_IMAGE_REG: Display an image, with possible variations in time and frequencies.
%
% USAGE: [hFig, iDS, iFig] = view_image_reg(Data, Labels=[], iDims=[1,2], DimLabels=[], FileName=[], hFig=[], ColormapType='image', ShowLabels=0, PageName=[first], DisplayUnits=[])
%
% INPUT: 
%     - Data         : [N1 x N2 x Ntime x Nfreq] numeric matrix to display
%     - Labels       : [1x4] cell array with the labels of the entries of each dimentions
%     - iDims        : Indices of the dimensions that are displayed along axes x and y
%     - DimLabels    : [1x4] cell array with the description of each dimension
%     - FileName     : Relative path to the file to display

    
function [hFig, iDS, iFig] = view_image_reg(Data, Labels, iDims, DimLabels, FileName, hFig, ColormapType, ShowLabels, PageName, DisplayUnits)
% VIEW_IMAGE_REG: Display an image, with possible variations in time and frequencies.
%
% USAGE: [hFig, iDS, iFig] = view_image_reg(Data, Labels=[], iDims=[1,2], DimLabels=[], FileName=[], hFig=[], ColormapType='image', ShowLabels=0, PageName=[first], DisplayUnits=[])
%
% INPUT: 
%     - Data         : [N1 x N2 x Ntime x Nfreq] numeric matrix to display
%     - Labels       : [1x4] cell array with the labels of the entries of each dimentions
%     - iDims        : Indices of the dimensions that are displayed along axes x and y
%     - DimLabels    : [1x4] cell array with the description of each dimension
%     - FileName     : Relative path to the file to display
%     - hFig         : Re-use an existing figure
%     - ColormapType : Name of the colormap to use for this figure
%     - ShowLabels   : If 1, show the labels on the Y axis
%     - PageName     : Name of the page that is currently displayed in the file
%                      Set to '$freq' to link the 4th dimension of the data to the frequency slider
%     - DisplayUnits : Units to display below the colorbar
%
% OUTPUT : 
%     - hFig : Matlab handle to the figure that was created or updated
%     - iDS  : DataSet index in the GlobalData variable
%     - iFig : Indice of returned figure in the GlobalData(iDS).Figure array

% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
% 
% Copyright (c) University of Southern California & McGill University
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPLv3
% license can be found at http://www.gnu.org/copyleft/gpl.html.
% 
% FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
% UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
% WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
% LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
%
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2014-2016


%% ===== INITIALIZATION =====
global GlobalData;
% Parse inputs
if (nargin < 10) || isempty(DisplayUnits)
    DisplayUnits = [];
end