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: aas_checkreg_avi.m
    path of file: ./repos/automaticanalysis/aa_engine
    
    the code of the file until where you have to start completion: % Create a movie

function aas_checkreg_avi(aap, p, axisDim, suffix, slicesD)

% Check if we need to make a movie (default - yes)...
doVideo = (isfield(aap.options,'diagnostic_videos') && aap.options.diagnostic_videos) && ... % global
    isfield(aap.tasklist.currenttask.settings,'diagnostic') && ... % module-specific
    (~isstruct(aap.tasklist.currenttask.settings.d
    
function aas_checkreg_avi(aap, p, axisDim, suffix, slicesD)

% Check if we need to make a movie (default - yes)...
doVideo = (isfield(aap.options,'diagnostic_videos') && aap.options.diagnostic_videos) && ... % global
    isfield(aap.tasklist.currenttask.settings,'diagnostic') && ... % module-specific
    (~isstruct(aap.tasklist.currenttask.settings.diagnostic) && ...
    aap.tasklist.currenttask.settings.diagnostic);
if ~doVideo, aas_log(aap,false,'INFO: Diagnostic videos disabled (check aap.options.diagnostic_videos and aap.tasksettings.<module>.diagnostic)'); end

global st
for v = 1:numel(st.vols)
    if isempty(st.vols{v}), break; end
    bb(:,:,v) = spm_get_bbox(st.vols{v});
end