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: snpm_bch_ui.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/SnPM13/config
    
    the code of the file until where you have to start completion: function [snpmui] = snpm_bch_ui(DesignName,DesignFile,DesignHelp,DesignItems,removeScansNode,checkFunctionHandle)
%  Set up common parameters to be set for all analyses.
% INPUT
%  DesignName  - Short, one-line description of design (string)
%  DesignFile  - Filename of the design configuration file (string)
%  DesignHelp  - Help to be displayed with this design (cell array of strings)
%  DesignItems - Design-specific menu items (cell array of Matlabbatch menu items)
% 
% OUTPUT
%  snpmui      - Design menu structure, with common menu items set before
%                and after design-specific ones.
%
%_______________________________________________________________________
% Thomas Nichols, Emma Thomas
% $Id$

% Based on Volkmar Glauche's MatlabBatch example code (Rev 1716)

% ---------------------------------------------------------------------
% Record internal information on the design
% ---------------------------------------------------------------------
DesNm         = cfg_const;
DesNm.tag     = 'DesignName';
DesNm.name    = 'DesignName';
DesNm.val     = {DesignName};
DesNm.help    = {['One-line descritption of the design.']};
DesNm.hidden  = true;

DesFile        = cfg_const;
DesFile.tag   = 'DesignFile';
DesFile.name   = 'DesignFile';
DesFile.val    = {DesignFile};
DesFile.help   = {['Filename of design configuration used.']};
DesFile.hidden = true;

DesignTag = spm_str_manip(DesignFile,'rt');
DesignTag = strrep(DesignTag,'snpm_bch_ui_','');


% ---------------------------------------------------------------------
% dir - Directory for analysis results
% ---------------------------------------------------------------------
dir         = cfg_files; % This is the generic data entry item
dir.name    = 'Analysis Directory'; % The displayed name
dir.tag     = 'dir';       % The name appearing in the harvested job structure. This name must be unique among all items in the val field of the superior node
dir.filter  = 'dir';
dir.ufilter = '.*';
dir.num     = [1 1];     % Number of inputs required (2D-array with exactly one row and one column)
dir.help    = {'','This sets the SnPM anlaysis directory.','All results will appear in this directory.'}; % help text displayed

% ---------------------------------------------------------------------
% scans Scans
% ---------------------------------------------------------------------
scans         = cfg_files; % This is the generic data entry item
scans.name    = 'Images to analyze'; % The displayed name
scans.tag     = 'P';       % The name appearing in the harvested job structure. This name must be unique among all items in the val field of the superior node
scans.filter  = 'image';      
scans.num     = [1 Inf];     % Number of inputs required (2D-array with exactly one row and one column)
scans.help    = {'','Model will be fit to these images.'}; % help text displayed

% SnPM specific options
% ---------------------------------------------------------------------

%Number of Permutations
nPerm            = cfg_entry;
nPerm.name       = 'Number of Permutations';

    
function [snpmui] = snpm_bch_ui(DesignName,DesignFile,DesignHelp,DesignItems,removeScansNode,checkFunctionHandle)
%  Set up common parameters to be set for all analyses.
% INPUT
%  DesignName  - Short, one-line description of design (string)
%  DesignFile  - Filename of the design configuration file (string)
%  DesignHelp  - Help to be displayed with this design (cell array of strings)
%  DesignItems - Design-specific menu items (cell array of Matlabbatch menu items)
% 
% OUTPUT
%  snpmui      - Design menu structure, with common menu items set before
%                and after design-specific ones.
%
%_______________________________________________________________________
% Thomas Nichols, Emma Thomas
% $Id$

% Based on Volkmar Glauche's MatlabBatch example code (Rev 1716)

% ---------------------------------------------------------------------
% Record internal information on the design
% ---------------------------------------------------------------------
DesNm         = cfg_const;
DesNm.tag     = 'DesignName';
DesNm.name    = 'DesignName';
DesNm.val     = {DesignName};
DesNm.help    = {['One-line descritption of the design.']};
DesNm.hidden  = true;

DesFile        = cfg_const;
DesFile.tag   = 'DesignFile';
DesFile.name   = 'DesignFile';
DesFile.val    = {DesignFile};
DesFile.help   = {['Filename of design configuration used.']};
DesFile.hidden = true;

DesignTag = spm_str_manip(DesignFile,'rt');
DesignTag = strrep(DesignTag,'snpm_bch_ui_','');


% ---------------------------------------------------------------------
% dir - Directory for analysis results
% ---------------------------------------------------------------------
dir         = cfg_files; % This is the generic data entry item
dir.name    = 'Analysis Directory'; % The displayed name
dir.tag     = 'dir';       % The name appearing in the harvested job structure. This name must be unique among all items in the val field of the superior node
dir.filter  = 'dir';
dir.ufilter = '.*';
dir.num     = [1 1];     % Number of inputs required (2D-array with exactly one row and one column)
dir.help    = {'','This sets the SnPM anlaysis directory.','All results will appear in this directory.'}; % help text displayed

% ---------------------------------------------------------------------
% scans Scans
% ---------------------------------------------------------------------
scans         = cfg_files; % This is the generic data entry item
scans.name    = 'Images to analyze'; % The displayed name
scans.tag     = 'P';       % The name appearing in the harvested job structure. This name must be unique among all items in the val field of the superior node
scans.filter  = 'image';      
scans.num     = [1 Inf];     % Number of inputs required (2D-array with exactly one row and one column)
scans.help    = {'','Model will be fit to these images.'}; % help text displayed

% SnPM specific options
% ---------------------------------------------------------------------

%Number of Permutations
nPerm            = cfg_entry;
nPerm.name       = 'Number of Permutations';
nPerm.tag        = 'nPerm';
nPerm.strtype    = 'e';
nPerm.def        = @(val)snpm_get_defaults('nPerm', val{:});
nPerm.num        = [1 1];
nPerm.help       = {'',...
		    'This sets the maximum number of permutations to use.  Actual number of permutations used may be smaller depend