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: ADEM_salience.m
    path of file: ./repos/spm12/toolbox/DEM
    
    the code of the file until where you have to start completion: function ADEM_salience
% Saccadic eye movements under active inference
%__________________________________________________________________________
% This demo illustrates exploration or visual search in terms of optimality
% principles based on straightforward ergodic or allostatic principles.
% In other words, to maintain the constancy of our external milieu, it is
% sufficient to expose ourselves to predicted and predictable stimuli.
% Being able to predict what is currently seen also enables us to predict
% fictive sensations that we will experience from another viewpoint. This
% provides a principled way in which to explore and sample the world for
% example with visual searches using saccadic eye movements. These
% theoretical considerations are remarkably consistent with a number
% of compelling heuristics; most notably the Infomax principle or the
% principle of minimum redundancy, signal detection theory and recent
% formulations of salience in terms of Bayesian surprise. The example
% here uses saliency (the posterior precision associated with fictive
% sampling of sensory data) to simulate saccadic eye movements under
% active inference.
%__________________________________________________________________________
% Copyright (C) 2011-2015 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: ADEM_salience.m 6901 2016-10-08 13:21:41Z karl $


pth = fileparts(mfilename('fullpath'));


    
function ADEM_salience
% Saccadic eye movements under active inference
%__________________________________________________________________________
% This demo illustrates exploration or visual search in terms of optimality
% principles based on straightforward ergodic or allostatic principles.
% In other words, to maintain the constancy of our external milieu, it is
% sufficient to expose ourselves to predicted and predictable stimuli.
% Being able to predict what is currently seen also enables us to predict
% fictive sensations that we will experience from another viewpoint. This
% provides a principled way in which to explore and sample the world for
% example with visual searches using saccadic eye movements. These
% theoretical considerations are remarkably consistent with a number
% of compelling heuristics; most notably the Infomax principle or the
% principle of minimum redundancy, signal detection theory and recent
% formulations of salience in terms of Bayesian surprise. The example
% here uses saliency (the posterior precision associated with fictive
% sampling of sensory data) to simulate saccadic eye movements under
% active inference.
%__________________________________________________________________________
% Copyright (C) 2011-2015 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: ADEM_salience.m 6901 2016-10-08 13:21:41Z karl $


pth = fileparts(mfilename('fullpath'));


% hidden causes and states
%==========================================================================
% x    - hidden states:
%   o(1) - oculomotor angle
%   o(2) - oculomotor angle
%   x(1) - relative amplitude of visual hypothesis 1
%   x(2) - relative amplitude of visual hypothesis 2
%   x(3) - ...
%
% v    - hidden causes
%
% g    - sensations:
%   g(1) - oculomotor angle (proprioception - x)
%   g(2) - oculomotor angle (proprioception - y)
%   g(3) - retinal input - channel 1
%   g(4) - retinal input - channel 2
%   g(5) - ...
%--------------------------------------------------------------------------



% mapp images and get hypotheses
%--------------------------------------------------------------------------
global STIM
DEMO = 0;

try
    
    STIM.H{1}   = spm_vol(fullfile(pth,'face_R.nii'));
    STIM.H{2}   = spm_vol(fullfile(pth,'face_rot_R.nii'));
    STIM.H{3}   = spm_vol(fullfile(pth,'face_inv_R.nii'));
    
    STIM.S{1}   = spm_vol(fullfile(pth,'face.nii'));
    STIM.S{2}   = spm_vol(fullfile(pth,'face_rot.nii'));
    STIM.S{3}   = spm_vol(fullfile(pth,'face_inv.nii'));
    
catch
    
    error('Images not found.');
    
end