%kxvregister ' '
% This MatLab function was automatically generated by a converter (KhorosToMatLab) from the Khoros xvregister.pane file
%
% Parameters:
% Toggle: dummy 'Dummy Flag Variable', default: 0: 'A dummy variable since the CLUI cannot be empty'
%
% Example: kxvregister( {'dummy',0})
%
% Khoros helpfile follows below:
%
%  PROGRAM
% xvregister -
%
%  DESCRIPTION
%
% \fBxvregister" is used to gather information about the customer's of
% Khoros so that Khoral Research can continually provide service, support,
% and updates of Khoros and Khoros based products.  Whenever users of
% Khoros execute any interactive Khoros program, they will be prompted
% to register and license their version of Khoros.  Registration involves
% providing contact information as well as answering a few simple questions.
% After filling out the form, if the "Register" button is selected, the
% user will have the opportunity to either email the registration to Khoral
% Research or save it to a file where it could then be later submitted to
% KRI.
%
% Users are not required to register their version.  If the "Do Not Register"
% button is selected, the user will be marked as unregistered and the
% interactive application will run anyway.  Note however that as long as
% a user is unregistered, they will be prompted to register each time a
% Khoros interactive application is run.
%
% After the registration process is completed, the user will then be presented
% with the Khoros license agreement.  Similar to registration, if the license
% is not agreed to, it will be presented each time an Khoros application is
% run until the user agrees to the license.
%
% Note that xvregister can also be run from the command line.
%
%
%
%  EXAMPLES
%
%  "SEE ALSO"
%
%  RESTRICTIONS
%
%  REFERENCES
%
%  COPYRIGHT
% Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI")  All rights reserved.
%

function varargout = kxvregister(varargin)
Inputs={};
if nargin ==0
  arglist={'',''};
elseif nargin ==1
  arglist=varargin{1};
else error('Usage: [out1,..] = kxvregister(arglist).');
end
if size(arglist,2)~=2
  error('arglist must be of form {''ParameterTag1'',value1;''ParameterTag2'',value2}')
 end
narglist={'dummy', 0};
maxval={0};
minval={0};
istoggle=[1];
was_set=istoggle * 0;
paramtype={'Toggle'};
% identify the input arrays and assign them to the arguments as stated by the user
if ~iscell(Inputs)
Inputs = {Inputs};
end
NumReqOutputs=0; nextinput=1; nextoutput=1;
  for ii=1:size(arglist,1)
  wasmatched=0;
  for jj=1:size(narglist,1)
   if strcmp(arglist{ii,1},narglist{jj,1})  % a given argument was matched to the possible arguments
     wasmatched = 1;
     was_set(jj) = 1;
     if strcmp(narglist{jj,2}, '__input')
      if (nextinput > length(Inputs))
        error(['Input ' narglist{jj,1} ' has no corresponding input!']);
      end
      narglist{jj,2} = 'OK_in';
      nextinput = nextinput + 1;
     elseif strcmp(narglist{jj,2}, '__output')
      if (nextoutput > nargout)
        error(['Output nr. ' narglist{jj,1} ' is not present in the assignment list of outputs !']);
      end
      if (isempty(arglist{ii,2}))
        narglist{jj,2} = 'OK_out';
      else
        narglist{jj,2} = arglist{ii,2};
      end

      nextoutput = nextoutput + 1;
      if (minval{jj} == 0)
         NumReqOutputs = NumReqOutputs - 1;
      end
     elseif isstr(arglist{ii,2})
      narglist{jj,2} = arglist{ii,2};
     else
        if strcmp(paramtype{jj}, 'Integer') & (round(arglist{ii,2}) ~= arglist{ii,2})
            error(['Argument ' arglist{ii,1} ' is of integer type but non-integer number ' arglist{ii,2} ' was supplied']);
        end
        if (minval{jj} ~= 0 | maxval{jj} ~= 0)
          if (minval{jj} == 1 & maxval{jj} == 1 & arglist{ii,2} < 0)
            error(['Argument ' arglist{ii,1} ' must be bigger or equal to zero!']);
          elseif (minval{jj} == -1 & maxval{jj} == -1 & arglist{ii,2} > 0)
            error(['Argument ' arglist{ii,1} ' must be smaller or equal to zero!']);
          elseif (minval{jj} == 2 & maxval{jj} == 2 & arglist{ii,2} <= 0)
            error(['Argument ' arglist{ii,1} ' must be bigger than zero!']);
          elseif (minval{jj} == -2 & maxval{jj} == -2 & arglist{ii,2} >= 0)
            error(['Argument ' arglist{ii,1} ' must be smaller than zero!']);
          elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} < minval{jj})
            error(['Argument ' arglist{ii,1} ' must be bigger than ' num2str(minval{jj})]);
          elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} > maxval{jj})
            error(['Argument ' arglist{ii,1} ' must be smaller than ' num2str(maxval{jj})]);
          end
        end
     end
     if ~strcmp(narglist{jj,2},'OK_out') &  ~strcmp(narglist{jj,2},'OK_in')
       narglist{jj,2} = arglist{ii,2};
     end
   end
   end
   if (wasmatched == 0 & ~strcmp(arglist{ii,1},''))
        error(['Argument ' arglist{ii,1} ' is not a valid argument for this function']);
   end
end
% match the remaining inputs/outputs to the unused arguments and test for missing required inputs
 for jj=1:size(narglist,1)
     if  strcmp(paramtype{jj}, 'Toggle')
        if (narglist{jj,2} ==0)
          narglist{jj,1} = '';
        end;
        narglist{jj,2} = '';
     end;
     if  ~strcmp(narglist{jj,2},'__input') && ~strcmp(narglist{jj,2},'__output') && istoggle(jj) && ~ was_set(jj)
          narglist{jj,1} = '';
          narglist{jj,2} = '';
     end;
     if strcmp(narglist{jj,2}, '__input')
      if (minval{jj} == 0)  % meaning this input is required
        if (nextinput > size(Inputs))
           error(['Required input ' narglist{jj,1} ' has no corresponding input in the list!']);
        else
          narglist{jj,2} = 'OK_in';
          nextinput = nextinput + 1;
        end
      else  % this is an optional input
        if (nextinput <= length(Inputs))
          narglist{jj,2} = 'OK_in';
          nextinput = nextinput + 1;
        else
          narglist{jj,1} = '';
          narglist{jj,2} = '';
        end;
      end;
     else
     if strcmp(narglist{jj,2}, '__output')
      if (minval{jj} == 0) % this is a required output
        if (nextoutput > nargout & nargout > 1)
           error(['Required output ' narglist{jj,1} ' is not stated in the assignment list!']);
        else
          narglist{jj,2} = 'OK_out';
          nextoutput = nextoutput + 1;
          NumReqOutputs = NumReqOutputs-1;
        end
      else % this is an optional output
        if (nargout - nextoutput >= NumReqOutputs)
          narglist{jj,2} = 'OK_out';
          nextoutput = nextoutput + 1;
        else
          narglist{jj,1} = '';
          narglist{jj,2} = '';
        end;
      end
     end
  end
end
if nargout
   varargout = cell(1,nargout);
else
  varargout = cell(0);
end
global KhorosRoot
if exist('KhorosRoot') && ~isempty(KhorosRoot)
w=['"' KhorosRoot];
else
if ispc
  w='"C:\Program Files\dip\khorosBin\';
else
[s,w] = system('which cantata');
w=['"' w(1:end-8)];
end
end
callKhoros([w 'xvregister"  '],Inputs,narglist);


function [out1] = getAppDir(inp1)
out1 = [];
ns = getNamespace();
if isempty(ns)
    return;
end
if strcmp(ns, 'AtlasViewerGUI')
    if nargin == 0
        [out1] = getAppDir_AtlasViewerGUI();
    elseif nargin == 1
        [out1] = getAppDir_AtlasViewerGUI(inp1);
    end
elseif strcmp(ns, 'Homer3')
    if nargin == 0
        [out1] = getAppDir_Homer3();
    elseif nargin == 1
        [out1] = getAppDir_Homer3(inp1);
    end
elseif strcmp(ns, 'DataTreeClass')
    if nargin == 0
        [out1] = getAppDir_DataTreeClass();
    elseif nargin == 1
        [out1] = getAppDir_DataTreeClass(inp1);
    end
end

% ---------------------------------------------------------
function [dirname] = getAppDir_AtlasViewerGUI(isdeployed_override)

if ~exist('isdeployed_override','var')
    isdeployed_override = 'notdeployed';
end

if isdeployed() || strcmp(isdeployed_override, 'isdeployed')
    if ispc()
        dirname = 'c:/users/public/atlasviewer/';
    else
        currdir = pwd;
        cd ~/;
        dirnameHome = pwd;
        dirname = [dirnameHome, '/atlasviewer/'];
        cd(currdir);
    end
else
    dirname = fileparts(which('AtlasViewerGUI.m'));
end

dirname(dirname=='\') = '/';
if dirname(end) ~= '/'
    dirname(end+1) = '/';
end

% ---------------------------------------------------------
function [dirname] = getAppDir_Homer3(isdeployed_override)

if ~exist('isdeployed_override','var')
    isdeployed_override = 'notdeployed';
end

if isdeployed() || strcmp(isdeployed_override, 'isdeployed')
    if ispc()
        dirname = 'c:/users/public/homer3/';
    else
        currdir = pwd;
        cd ~/;
        dirnameHome = pwd;
        dirname = [dirnameHome, '/homer3/'];
        cd(currdir);
    end
else
    dirname = fileparts(which('Homer3.m'));
end

dirname(dirname=='\') = '/';
if dirname(end) ~= '/'
    dirname(end+1) = '/';
end

% ---------------------------------------------------------
function [dirname] = getAppDir_DataTreeClass(isdeployed_override)

if ~exist('isdeployed_override','var')
    isdeployed_override = 'notdeployed';
end

if isdeployed() || strcmp(isdeployed_override, 'isdeployed')
    if ispc()
        dirname = 'c:/users/public/datatree/';
    else
        currdir = pwd;
        cd ~/;
        dirnameHome = pwd;
        dirname = [dirnameHome, '/datatree/'];
        cd(currdir);
    end
else
    dirname = fileparts(which('DataTreeClass.m'));
end

dirname(dirname=='\') = '/';
if dirname(end) ~= '/'
    dirname(end+1) = '/';
end


function HDF5_GroupClose(fileobj, gid, fid)

H5G.close(gid);
if ischar(fileobj)
    H5F.close(fid);
end


function toolbarShortcuts = GetToolbarShortcuts(varargin)
%GETTOOLBARSHORTCUTS is deprecated.  Use GetShortcuts instead.

% $Author: rcotton $	$Date: 2010/08/20 10:21:24 $	$Revision: 1.4 $
% Copyright: Health and Safety Laboratory 2010

toolbarShortcuts = GetShortcuts(varargin{:});

end


function path = voc2007_devkit()
    path = './datasets/VOCdevkit2007';
end


function test_corenums

end


function hP = plugin_board()
% Zynq Platform PCore
% Use Plugin API to create board plugin object

%   Copyright 2015 The MathWorks, Inc.

% Call the common board definition function
hP = AnalogDevices.fmcomms2.common.plugin_board('ZED');


function varargout = JAABAInitOpen(varargin)
% JAABAINITOPEN MATLAB code for JAABAInitOpen.fig
%      JAABAINITOPEN, by itself, creates a new JAABAINITOPEN or raises the existing
%      singleton*.
%
%      H = JAABAINITOPEN returns the handle to a new JAABAINITOPEN or the handle to
%      the existing singleton*.
%
%      JAABAINITOPEN('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in JAABAINITOPEN.M with the given input arguments.
%
%      JAABAINITOPEN('Property','Value',...) creates a new JAABAINITOPEN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before JAABAInitOpen_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to JAABAInitOpen_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help JAABAInitOpen

% Last Modified by GUIDE v2.5 04-Jun-2013 16:23:04

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @JAABAInitOpen_OpeningFcn, ...
                   'gui_OutputFcn',  @JAABAInitOpen_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before JAABAInitOpen is made visible.
function JAABAInitOpen_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to JAABAInitOpen (see VARARGIN)

% Choose default command line output for JAABAInitOpen
handles.output = hObject;
handles.sel = struct('val',[],'edit',false);

figureJLabel = varargin{1};
% Change a few things so they still work well on Mac
adjustColorsIfMac(hObject);

centerOnParentFigure(hObject,figureJLabel);

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes JAABAInitOpen wait for user response (see UIRESUME)
uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = JAABAInitOpen_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.sel;
delete(handles.figure1);

% --- Executes on button press in pushbutton_new.
function pushbutton_new_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_new (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.sel.val = 'New';
guidata(hObject,handles);
figure1_CloseRequestFcn(handles.figure1,[],handles);

% --- Executes on button press in pushbutton_open.
function pushbutton_open_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_open (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.sel.val = 'Open';
guidata(hObject,handles);
figure1_CloseRequestFcn(handles.figure1,[],handles);

% --- Executes on button press in pushbutton_opengt.
function pushbutton_opengt_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_opengt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.sel.val = 'OpenGT';
guidata(hObject,handles);
figure1_CloseRequestFcn(handles.figure1,[],handles);

% --- Executes on button press in checkbox_edit.
function checkbox_edit_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox_edit

handles.sel.edit = get(hObject,'Value');
guidata(hObject,handles);

% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure
% delete(hObject);
uiresume(hObject);


function X = sethackflag(X,flag)
%GETHACKFLAG Internal function to set constraint type

X.typeflag = flag;


function y=fcn_isConnected()
%% About:
% Method to check the connection with the robot.

%% Return value:
% y: true, if a connection between the robot and the PC is active.
%     false, if no connection is present.

    global isConnected;
    y=isConnected;
end


function setSrcComboUserData(hObject,handles,plotFrame)
    contents = cellstr(get(hObject,'String'));
    sel = strtrim(contents{get(hObject,'Value')});
    set(hObject,'UserData',sel);

    if(plotFrame && get(handles.playButton,'Value')==0)
        plotOneFrame(handles);
    end
end


function F = set(varargin)
%SET OBSOLETE

disp('SET has been considered obsolete for many years, and the time has come...');
disp('Update your code. http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Commands.set');
error('Obsolete command')


%NOT Mapping overload


function pbsNonSharedSimpleSubmitFcn(scheduler, job, props, ...
                                        clusterHost, remoteDataLocation)
%PBSNONSHAREDSIMPLESUBMITFCN Submits a MATLAB job to a PBS scheduler in the
% absence of a shared file system between the MATLAB client and the
% PBS scheduler.
%
% See also pbsNonSharedSimpleDecodeFcn.

% Copyright 2006-2008 The MathWorks, Inc.

if ~ischar(clusterHost)
    error('distcomp:genericscheduler:SubmitFcnError', ...
        'Hostname must be a string');
end
if ~ischar(remoteDataLocation)
    error('distcomp:genericscheduler:SubmitFcnError', ...
        'Remote Data Location must be a string');
end
scheduler.UserData = { clusterHost ; remoteDataLocation };
localDataLocation = scheduler.DataLocation;

% Set the name of the decode function which will be executed by
% the worker. The decode function must be on the path of the MATLAB
% worker when it starts up. This is typically done by placing the decode
% function in MATLABROOT/toolbox/local on the cluster nodes, or by
% prefixing commandToRun (created below) with a command to cd to the
% directory where the decode function's M file exists.
decodeFcn = 'pbsNonSharedSimpleDecodeFcn';

% Read the number of tasks which are to be created. This property
% cannot be changed.
numberOfTasks = props.NumberOfTasks;

% A unique file and directory name for the job. This is used to create
% files and a directory under scheduler.DataLocation
jobLocation = props.JobLocation;

% A cell array of unique file names for tasks. These are used to create
% files under jobLocation
taskLocations = props.TaskLocations;

% Since PBS jobs will be submitted from a UNIX host on the cluster,
% a single quoted string will protect the MATLAB command.
quote = '''';

% The MATLAB command to be run on a cluster node to execute a task.
commandToRun = [ quote props.MatlabExecutable quote ' ' ...
                 props.MatlabArguments ];

% Copy the matlab_metadata.mat file to the remote host.
localMetaDataFile = [ localDataLocation '/matlab_metadata.mat' ];
copyDataToCluster(localMetaDataFile, remoteDataLocation, clusterHost);

% Copy the local job directory to the remote host.
localJobDirectory = [ localDataLocation '/' jobLocation ];
copyDataToCluster(localJobDirectory, remoteDataLocation, clusterHost);

% Copy the local job files to the remote host.
localJobFiles = [ localDataLocation '/' jobLocation '.*' ];
copyDataToCluster(localJobFiles, remoteDataLocation, clusterHost);

% Submit tasks which the scheduler will execute by starting MATLAB workers.
for i = 1:numberOfTasks
    taskLocation = taskLocations{i};
    remoteJobDir = [ remoteDataLocation '/' jobLocation ];

    % Create a script to submit a PBS job.
    localScript = createPBSSubmitScript(commandToRun, decodeFcn, ...
        props.StorageConstructor, remoteDataLocation, ...
        jobLocation, taskLocation, quote);
    [Path, scriptName] = fileparts(localScript);

    % Copy the script to the remote host.
    copyDataToCluster(localScript, remoteJobDir, clusterHost);

    % Create the command to run on the remote host.
    remoteScriptLocation = [ remoteJobDir '/' scriptName ];
    remoteCommand = sprintf('qsub %s', remoteScriptLocation);

    % Execute the submit command on the remote host.
    runCmdOnCluster(remoteCommand, clusterHost);

    % Delete the local copy of the script
    delete(localScript);
end

function filename = createPBSSubmitScript(commandToRun, decodeFunction, ...
         storageConstructor, remoteDataLocation, jobLocation, ...
         taskLocation, quote)
%Create a PBS submit script that forwards the required environment
%variables and runs a MATLAB worker.
logFileLocation = [quote remoteDataLocation '/' taskLocation '.log' quote];

% Create the commands to set the environment variables.
% "-N Job#"  specifies the job name
% "-j oe" joins together output and error streams
% "-o ..." specifies where standard output goes to
setEnv = sprintf([ ...
    '#!/bin/sh', '\n', ...
    '#PBS -N MATLAB_', taskLocation,  '\n', ...
    '#PBS -j oe', '\n', ...
    '#PBS -o ', logFileLocation, '\n', ...
    '#PBS -Wgroup_list=matlab\n', ...   %snow
     '#PBS -q pmatlab_q\n', ... %snow
    '#PBS -lpartition=ITHACA\n', ... %snow
    '#PBS -A matlab0001\n', ... %snow
    '#PBS -v MDCE_DECODE_FUNCTION=', decodeFunction, ',', ...
    'MDCE_STORAGE_LOCATION=', remoteDataLocation, ',', ...
    'MDCE_STORAGE_CONSTRUCTOR=', storageConstructor, ',', ...
    'MDCE_JOB_LOCATION=', jobLocation, ',', ...
    'MDCE_TASK_LOCATION=', taskLocation, ',', ...
    'MDCE_DEBUG=', 'true', ...
    '\n', ...
    ]);

% Content of script.
scriptContent = sprintf('%s%s', setEnv, commandToRun);

% Create script.
filename = tempname;
% Open file in binary mode to make it cross-platform.
fid = fopen(filename, 'w');
fprintf(fid, scriptContent);
fclose(fid);


function out= util_unixCmd(cmd, action)
%UTIL_UNIXCMD - Run a unix command and check for errors
%
%Synopsis:
% util_unixCcmd(CMD, <ACTION>)
%
%Arguments:
% CMD:    String, the unix command to be executed
% ACTION: String, printed in case of an error

if ~isunix,
  warning('attempt to execute unix command in non-unix system');
  return;
end

if nargin<2,
  action= '';
end

[stat,out]= unix(cmd);
if stat~=0,
  error(sprintf('error %s (%s -> %s)', action, cmd, out));
end

if nargout==0,
  clear out
end


function obj = setParent(obj, parent)
    % set the parent link frame
    %
    % Parameters:
    % parent: the parent link frame object @type char

    assert(ischar(parent),...
        'The parent link name must be a character vector.');
    obj.Parent = parent;

end


% FT_POSTAMBLE_DEBUG is a helper script for debugging problems with FieldTrip
% functions. It is executed at normal termination of the calling function and
% disables the "onCleanup" function.
%
% Use as
%   ft_preamble debug
%   .... regular code goes here ...
%   ft_postamble debug
%
% See also FT_PREAMBLE, FT_POSTAMBLE, FT_PREAMBLE_DEBUG, DEBUGCLEANUP

% these variables are shared by the three debug handlers
global Ce9dei2ZOo_debug Ce9dei2ZOo_funname Ce9dei2ZOo_argin Ce9dei2ZOo_ws Ce9dei2ZOo_ns Ce9dei2ZOo_is Ce9dei2ZOo_ds

if isfield(cfg, 'verbose') && ischar(cfg.verbose)
  % restore the previous state of the notifications
  ft_warning(Ce9dei2ZOo_ws)
  ft_notice(Ce9dei2ZOo_ns);
  ft_info(Ce9dei2ZOo_is);
  ft_debug(Ce9dei2ZOo_ds);
end

if ~isfield(cfg, 'debug')
  % do not provide extra debugging facilities
  return
end

switch cfg.debug
  case {'displayonsuccess' 'saveonsuccess'}
    % do not clean up the global variables yet
    % these are still needed by the cleanup function

  otherwise
    % stack(1) is this script
    % stack(2) is the calling ft_postamble function
    % stack(3) is the main FieldTrip function that we are interested in
    Ce9dei2ZOx_funname = dbstack;
    Ce9dei2ZOx_funname = Ce9dei2ZOx_funname(3).name;

    if isequal(Ce9dei2ZOx_funname, Ce9dei2ZOo_funname)
      % this results in the cleanup function doing nothing
      Ce9dei2ZOo_debug   = 'no';
      Ce9dei2ZOo_funname = [];
      Ce9dei2ZOo_argin   = [];
    else
      % this happens for nested FieldTrip functions, e.g. when
      % ft_selectdata is called by another high-level function
    end
end


%MAKEFIGS_ANALYTIC has been moved to JLAB_MAKEFIGS.


function handles = enableDataLoaded(hObject, handles)

set(handles.btnSimGraphCreate, 'Enable', 'on');
set(handles.btnSimGraphLoad, 'Enable', 'on');
set(handles.btnDataNormalize, 'Enable', 'on');
set(handles.btnSaveData, 'Enable', 'on');

handles = togglePlotData(hObject, handles, 'on');

guidata(hObject, handles);


function nop(varargin)
    %NOP %NOP Do nothing
    %
    % NOP( ... )
    %
    % A do-nothing function for use as a placeholder when working with callbacks
    % or function handles.

    % Intentionally does nothing

end


function obj=MOxUnitTestOutcome(test_,duration)
    s=struct();
    s.test=test_;
    s.duration=duration;
    obj=class(s,'MOxUnitTestOutcome');


function obj = saveObj(obj)
	% Biafra Ahanonu
	% Started: 2021.03.25 [22:11:25] (branched from ciatah.m)

	if isempty(obj.objSaveLocation)
		[filePath,folderPath,~] = uiputfile('*.*','select folder to save object mat file to','CIAtah_properties.mat');
		% exit if user picks nothing
		% if folderListInfo==0; return; end
		savePath = [folderPath filesep filePath];
		% tmpObj = obj;
		% obj = struct(obj);
		obj.objSaveLocation = savePath;
	else
		savePath = obj.objSaveLocation;
	end
	disp(['saving to: ' savePath])
	try
	  save(savePath,'obj','-v7.3');
	catch
	  disp('Problem saving, choose new location...')
	  obj.objSaveLocation = [];
	  obj.saveObj();
	end
	% obj = tmpObj;
end


 function printm(varargin)
%function printm(varargin)
%|
%| like printf except that it puts the mfilename in front of it
%| so that you know where the message originated.

[caller, line] = caller_name;
if ~isempty(line) && line ~= 0
	caller = [caller sprintf(' %d', line)];
	caller = strrep(caller, 'LiveEditorEvaluationHelper', 'LiveE*');
end
if length(varargin)
	tmp = varargin{1};
	if streq(tmp, '\n', 2) % trick for newline to precede caller name
		disp(' ') % blank line
		varargin{1} = tmp(3:end); % strip '\n' at start
	end
	disp([caller ': ' sprintf(varargin{:})])
else
	disp([caller ': '])
end
if ir_is_octave
	fflush(stdout);
end


function copyLossConvertToClipboard(lossConvert)
%copyLossConvertToClipboard Summary of this function goes here
%   Detailed explanation goes here
    global GLOBAL_LossConvertClipboard;

    GLOBAL_LossConvertClipboard = lossConvert;
end


%--- help for data_prerequest ---
%
%  INTERNAL FUNCTION
%
%


% +TFUN
%
% Files


classdef MimPatientBrowserPanel < GemPanel
    % MimPatientBrowserPanel.  Part of the gui for the TD MIM Toolkit.
    %
    %     This class is used internally within the TD MIM Toolkit to help
    %     build the user interface.
    %
    %     MimPatientBrowserPanel represents the main panel of the Patient Browser.
    %
    %
    %
    %     Licence
    %     -------
    %     Part of the TD MIM Toolkit. https://github.com/tomdoel
    %     Author: Tom Doel, 2013.  www.tomdoel.com
    %     Distributed under the MIT licence. Please see website for details.
    %

    properties (Access = private)
        ListOfPatientsPanel
        AllPatientsSlidingPanel
    end

    methods
        function obj = MimPatientBrowserPanel(parent, patient_database, group_patients_with_same_name, gui_callback)
            obj = obj@GemPanel(parent);
            obj.AllPatientsSlidingPanel = MimPatientBrowserAllPatientsSlidingPanel(obj, patient_database, group_patients_with_same_name, gui_callback);
            obj.ListOfPatientsPanel = MimPatientBrowserListOfPatientsPanel(obj, obj.AllPatientsSlidingPanel, patient_database, group_patients_with_same_name, gui_callback);
            obj.AddChild(obj.AllPatientsSlidingPanel);
            obj.AddChild(obj.ListOfPatientsPanel);
        end

        function SelectSeries(obj, patient_id, series_uid, selected)
            obj.ListOfPatientsPanel.SelectPatient(patient_id, selected);
            obj.AllPatientsSlidingPanel.SelectSeries(patient_id, series_uid, selected);
        end

        function DatabaseHasChanged(obj)
            obj.ListOfPatientsPanel.DatabaseHasChanged;
            obj.AllPatientsSlidingPanel.DatabaseHasChanged;
        end

        function Resize(obj, position)
            parent_width_pixels = max(1, position(3));
            parent_height_pixels = max(1, position(4));
            panel_position = [1 1 parent_width_pixels parent_height_pixels];

            % Resize the panel
            Resize@GemPanel(obj, panel_position);

            panel_width_pixels = panel_position(3);
            panel_height_pixels = panel_position(4);

            % We set the patient list to be a fraction of the panel width, with a
            % maximum cutoff
            max_patient_list_width_pixels = 250;
            if max_patient_list_width_pixels < panel_width_pixels/3
                list_panel_width = max_patient_list_width_pixels;
            else
                list_panel_width = max(1, ceil(panel_width_pixels/3));
            end

            % The patient info panel occupies the rest of the width
            info_panel_width = max(1, panel_width_pixels - list_panel_width);

            % Resize the child panels
            obj.ListOfPatientsPanel.Resize([1 1 list_panel_width panel_height_pixels]);
            obj.AllPatientsSlidingPanel.Resize([1+list_panel_width 1 info_panel_width panel_height_pixels]);
        end
    end
end


function warningNoTrace(varargin)
warnst = warning('off','backtrace');
warning(varargin{:});
warning(warnst);


bgest


function debug(msg)
disp(msg);


function display(item)

% function display(item)
% Display a configuration object
%
% This code is part of a batch job configuration system for MATLAB. See
%      help matlabbatch
% for a general overview.
%_______________________________________________________________________
% Copyright (C) 2007 Freiburg Brain Imaging

% Volkmar Glauche
% $Id: display.m 4166 2011-01-17 15:06:41Z volkmar $

rev = '$Rev: 4166 $'; %#ok

disp(' ');
disp([inputname(1),' = ']);
disp(' ');
disp(item);
disp(' ');


function varargout = credits(varargin)
% CREDITS M-file for credits.fig
%      CREDITS, by itself, creates a new CREDITS or raises the existing
%      singleton*.
%
%      H = CREDITS returns the handle to a new CREDITS or the handle to
%      the existing singleton*.
%
%      CREDITS('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CREDITS.M with the given input arguments.
%
%      CREDITS('Property','Value',...) creates a new CREDITS or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before credits_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to credits_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help credits

% Last Modified by GUIDE v2.5 12-Nov-2008 20:42:52

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @credits_OpeningFcn, ...
                   'gui_OutputFcn',  @credits_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before credits is made visible.
function credits_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to credits (see VARARGIN)

% Choose default command line output for credits
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes credits wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = credits_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

close('credits')


%END Mapping overload


%   CLASS GUI_Remote_Resources
% =========================================================================
%
% DESCRIPTION
%   class to manage the about window of goGPSz
%
% EXAMPLE
%   ui = GUI_Remote_Resources.getInstance();
%
% FOR A LIST OF CONSTANTs and METHODS use doc Core_UI

%--------------------------------------------------------------------------
%               ___ ___ ___
%     __ _ ___ / __| _ | __|
%    / _` / _ \ (_ |  _|__ \
%    \__, \___/\___|_| |___/
%    |___/                    v 1.0RC1
%
%--------------------------------------------------------------------------
%  Copyright (C) 2021 Geomatics Research & Development srl (GReD)
%  Written by:        Andrea Gatti
%  Contributors:      Andrea Gatti, ...
%  A list of all the historical goGPS contributors is in CREDITS.nfo
%--------------------------------------------------------------------------
%
%    This program 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.
%
%    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
%
%--------------------------------------------------------------------------
% 01100111 01101111 01000111 01010000 01010011
%--------------------------------------------------------------------------

classdef GUI_Remote_Resources < GUI_Unique_Win

    properties (Constant)
        WIN_NAME = 'goGPS_Inspect_RR';
    end

    properties (Constant, Access = 'protected')
        BG_COLOR = Core_UI.DARK_GREY_BG;
    end

    %% PROPERTIES SINGLETON POINTERS
    % ==================================================================================================================================================
    properties % Utility Pointers to Singletons
        log
        state
    end

    %% PROPERTIES GUI
    % ==================================================================================================================================================
    properties
        w_edt       % Handle of the main window
        win         % Handle to this window
        j_rrini     % ini resources file java pointer
    end

    %% PROPERTIES STATUS
    % ==================================================================================================================================================
    properties (GetAccess = private, SetAccess = private)
    end

    %% METHOD CREATOR
    % ==================================================================================================================================================

    methods (Static, Access = private)
        function this = GUI_Remote_Resources(w_edt)
            % GUI_MAIN object creator
            this.init();
            this.openGUI();
            if nargin == 1
                this.w_edt = w_edt;
            end
        end
    end

    methods (Static, Access = public)
        function this = getInstance(w_edt)
            % Get the persistent instance of the class
            persistent unique_instance_gui_rr__

            if nargin == 0
                w_edt = [];
            end

            if isempty(unique_instance_gui_rr__)
                this = GUI_Remote_Resources(w_edt);
                unique_instance_gui_rr__ = this;
            else
                this = unique_instance_gui_rr__;
                this.init();
                this.openGUI();
            end
        end

        function closeGUI()
            fh_list = get(groot, 'Children');
            fig_handle = [];

            % bad code writing style but fast
            for f = 1 : numel(fh_list)
                try
                    if isfield(fh_list(f).UserData, 'name') && strcmp(fh_list(f).UserData.name, GUI_Remote_Resources.WIN_NAME)
                        fig_handle = fh_list(f);
                        break
                    end
                catch
                end
            end
            if ~isempty(fig_handle)
                delete(fig_handle);
            end
        end

    end

    %% METHODS INIT
    % ==================================================================================================================================================
    methods
        function init(this)
            this.log = Core.getLogger();
            this.state = Core.getState();
        end

        function openGUI(this)
            % Main Window ----------------------------------------------------------------------------------------------

            old_win = this.getUniqueWinHandle();
            if ~isempty(old_win)
                log = Core.getLogger();
                log.addMarkedMessage('Resetting the old Inspector window');
                win = old_win;

                if strcmp(this.win.Visible, 'off')
                    if isunix && not(ismac())
                        win.Position(1) = round((win.Parent.ScreenSize(3) - win.Position(3)) / 2);
                        win.Position(2) = round((win.Parent.ScreenSize(4) - win.Position(4)) / 2);
                    else
                        win.OuterPosition(1) = round((win.Parent.ScreenSize(3) - win.OuterPosition(3)) / 2);
                        win.OuterPosition(2) = round((win.Parent.ScreenSize(4) - win.OuterPosition(4)) / 2);
                    end
                end
                this.win = win;
            else
                win = figure( 'Name', 'Remote Resources Inspector', ...
                    'Visible', 'on', ...
                    'DockControls', 'off', ...
                    'MenuBar', 'none', ...
                    'ToolBar', 'none', ...
                    'NumberTitle', 'off', ...
                    'Position', [0 0 1040, 640], ...
                    'Resize', 'on');
                win.UserData.name = this.WIN_NAME;

                this.win = win;

                if isunix && not(ismac())
                    win.Position(1) = round((win.Parent.ScreenSize(3) - win.Position(3)) / 2);
                    win.Position(2) = round((win.Parent.ScreenSize(4) - win.Position(4)) / 2);
                else
                    win.OuterPosition(1) = round((win.Parent.ScreenSize(3) - win.OuterPosition(3)) / 2);
                    win.OuterPosition(2) = round((win.Parent.ScreenSize(4) - win.OuterPosition(4)) / 2);
                end

                try
                    main_vb = uix.VBox('Parent', win, ...
                        'Padding', 5, ...
                        'BackgroundColor', Core_UI.DARKER_GREY_BG);
                catch
                    log = Core.getLogger;
                    log.setOutMode(1,[],0); % to plot a Warning I need to disable GUI and enable
                    log.addError('Please install GUI Layout Toolbox (https://it.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox)');
                    open('GUI Layout Toolbox 2.3.4.mltbx');
                    log.newLine();
                    log.addWarning('After installation re-run goGPS');
                    close(win);
                    return;
                end
                top_bh = uix.HBox('Parent', main_vb);

                logo_GUI.BG_COLOR = Core_UI.DARK_GREY_BG;
                left_tbv = uix.VBox('Parent', top_bh, ...
                    'BackgroundColor', logo_GUI.BG_COLOR, ...
                    'Padding', 5);

                % Logo/title box -------------------------------------------------------------------------------------------

                logo_g = uix.Grid('Parent', left_tbv, ...
                    'Padding', 5, ...
                    'BackgroundColor', logo_GUI.BG_COLOR);

                logo_ax = axes( 'Parent', logo_g);
                logo_g.Widths = 64;
                logo_g.Heights = 64;
                [logo, transparency] = Core_UI.getLogo();
                logo(repmat(sum(logo,3) == 0,1,1,3)) = 0;
                logo = logo - 20;
                image(logo_ax, ones(size(logo)), 'AlphaData', transparency);
                logo_ax.XTickLabel = [];
                logo_ax.YTickLabel = [];
                axis off;

                Core_UI.insertEmpty(left_tbv, logo_GUI.BG_COLOR);
                left_tbv.Heights = [82 -1];

                % Title Panel -----------------------------------------------------------------------------------------------
                right_tvb = uix.VBox('Parent', top_bh, ...
                    'Padding', 5, ...
                    'BackgroundColor', logo_GUI.BG_COLOR);

                top_bh.Widths = [106 -1];

                title = uix.HBox('Parent', right_tvb, ...
                    'BackgroundColor', logo_GUI.BG_COLOR);
                txt = this.insertBoldText(title, 'Remote Resources in use', 10, Core_UI.LBLUE, 'left');
                txt.BackgroundColor = logo_GUI.BG_COLOR;

                Core_UI.insertEmpty(right_tvb, logo_GUI.BG_COLOR);

                % Disclaimer Panel -----------------------------------------------------------------------------------------------
                txt = this.insertText(right_tvb, {'Inspect the remoute resources locations', '(read-only)'},  8, [], 'left');

                right_tvb.Heights = [20 5 -1];

                string_bh = uix.VBox('Parent', main_vb, ...
                    'Padding', 10, ...
                    'BackgroundColor', GUI_Remote_Resources.BG_COLOR);

                %Core_UI.insertEmpty(string_bh);

                this.j_rrini = this.insertRRBox(string_bh);
                this.j_rrini.setText('RR');

                % Manage dimension -------------------------------------------------------------------------------------------
                main_vb.Heights = [80 -1];
            end
            this.updateResourcePopUpsState();
            this.win.Visible = 'on';
            this.bringOnTop();
        end

        function updateResourcePopUpsState(this)
            % Getting current remote resource manager
            r_man = Remote_Resource_Manager.getInstance();

            state = Core.getCurrentSettings;
            % read current center
            [center_list, center_ss] = r_man.getCenterList();
            cur_center = Core.getState.getCurCenter;
            if isempty(cur_center)
                cur_center = {'default'};
            end
            value = 1;
            while (value < numel(center_list)) && ~strcmp(center_list{value}, cur_center)
                value = value + 1;
            end

            % display resources tree of the current center
            if ~isempty(value)
                try
                    str = r_man.centerToString(state.getRemoteCenter());
                    str = strrep(['% ' str], char(10), [char(10) ' ']);
                catch
                    str = sprintf('[!!] Resource file missing:\n"%s"\nnot found\n\ngoGPS may not work properly', state.getRemoteSourceFile);
                end
                this.j_rrini.setText(str);
            end
        end

    end

    %% METHODS INSERT
    % ==================================================================================================================================================
    methods (Static)
        function txt = insertBoldText(parent, title, font_size, color, alignment)
            if nargin < 4 || isempty(color)
                color = Core_UI.WHITE;
            end
            if nargin < 5 || isempty(alignment)
                alignment = 'center';
            end
            txt = uicontrol('Parent', parent, ...
                'Style', 'Text', ...
                'String', title, ...
                'ForegroundColor', color, ...
                'HorizontalAlignment', alignment, ...
                'FontSize', Core_UI.getFontSize(font_size), ...
                'FontWeight', 'bold', ...
                'BackgroundColor', GUI_Remote_Resources.BG_COLOR);
        end

        function txt = insertText(parent, title, font_size, color, alignment)
            if nargin < 4 || isempty(color)
                color = Core_UI.WHITE;
            end
            if nargin < 5 || isempty(alignment)
                alignment = 'center';
            end
            txt = uicontrol('Parent', parent, ...
                'Style', 'Text', ...
                'String', title, ...
                'ForegroundColor', color, ...
                'HorizontalAlignment', alignment, ...
                'FontSize', Core_UI.getFontSize(font_size), ...
                'BackgroundColor', GUI_Remote_Resources.BG_COLOR);
        end

        function insertLink(parent, url, prefix, prefix_color, link_label, font_size, color, alignment)
            if nargin < 4 || isempty(color)
                color = Core_UI.WHITE;
            end

            % Create and display the text label
            label_str = sprintf('%s %s', ...
                round(prefix_color(1) * 255), round(prefix_color(2) * 255), round(prefix_color(3) * 255), prefix, ...
                round(color(1) * 255), round(color(2) * 255), round(color(3) * 255), link_label);
            j_label = javaObjectEDT('javax.swing.JLabel', label_str);
            bg_color = num2cell(GUI_Remote_Resources.BG_COLOR);
            j_label.setBackground(java.awt.Color(bg_color{:}));
            %% DEPRECATE!!!
            warning on
            [hj_label, h_container] = javacomponent(j_label, [10,10,250,20], parent);
            warning off

            % Modify the mouse cursor when hovering on the label
            hj_label.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR));

            % Set the label's tooltip
            hj_label.setToolTipText(['Visit the ' url ' website']);

            % Set the mouse-click callback
            set(hj_label, 'MouseClickedCallback', @(h,e)web(['http://' url], '-browser'))
        end

        function j_rrini = insertRRBox(container)
            j_rrini = com.mathworks.widgets.SyntaxTextPane;
            %codeType = j_rrini.M_MIME_TYPE;  % j_rrini.contentType='text/m-MATLAB'
            %j_rrini.setContentType(codeType);
            str = ' Remote Resources in use: cd ';
            j_rrini.setText(str);
            % Create the ScrollPanel containing the widget
            j_scroll_settings = com.mathworks.mwswing.MJScrollPane(j_rrini);
            % Inject edit box with the Java Scroll Pane into the main_window
            %% DEPRECATE!!!
            warning off
            [panel_j, panel_h] = javacomponent(j_scroll_settings, [1 1 1 1], container);
            warning on
            j_rrini.setEditable(0);
        end

    end

    %% METHODS EVENTS
    % ==================================================================================================================================================
    methods (Access = public)
    end
end


function setproxy(proxyname, port)
% SETPROXY - Set the proxy to use when making all remote calls with
% NCTOOLBOX (https://github.com/nctoolbox/nctoolbox)
%
% Use as: setproxy(proxyname, port)
%
% Inputs:
%  proxyname = the proxy name that all connections will be routed to
%  port      = The port on the proxy to connect through
%

% Brian Schlining
% 2010-02-16
%
% httpClient = org.apache.commons.httpclient.HttpClient();
% httpClient.getHostConfiguration().setProxy(proxyname, port);
% ucar.nc2.dataset.NetcdfDataset.setHttpClient(httpClient);

%ucar.nc2.util.net.HTTPSession.setGlobalSimpleProxy(proxyname, port)
ucar.nc2.util.net.HTTPSession.setGlobalProxy(proxyname, port)


function r = emptyfun(varargin)
r = [];


classdef StepBase < matlab.hwmgr.internal.hwsetup.TemplateBase

  properties
    InfoText1
    InfoText2
    InfoText3
  end

  methods
    function obj = StepBase(varargin)
      obj@matlab.hwmgr.internal.hwsetup.TemplateBase(varargin{:});

      parentContainer = obj.ContentPanel;

      obj.InfoText1 = matlab.hwmgr.internal.hwsetup.Label.getInstance(parentContainer);
      obj.InfoText1.Position = [20 290 400 80];
      obj.InfoText1.Text = '';
      obj.InfoText1.Color = matlab.hwmgr.internal.hwsetup.util.Color.WHITE;

      obj.InfoText2 = matlab.hwmgr.internal.hwsetup.Label.getInstance(parentContainer);
      obj.InfoText2.Position = [20 230 400 50];
      obj.InfoText2.Text = '';
      obj.InfoText2.Color = matlab.hwmgr.internal.hwsetup.util.Color.WHITE;

      obj.InfoText3 = matlab.hwmgr.internal.hwsetup.Label.getInstance(parentContainer);
      obj.InfoText3.Position = [20 170 400 50];
      obj.InfoText3.Text = '';
      obj.InfoText3.Color = matlab.hwmgr.internal.hwsetup.util.Color.WHITE;

      obj.HelpText.AboutSelection = '';
      obj.HelpText.WhatToConsider = '';

      if strcmp(obj.Workflow.FirstScreenID, class(obj))
        obj.BackButton.Visible = 'off';
        obj.BackButton.Enable = 'off';
      end
    end

    function restoreScreen(obj)
      obj.enableScreen();
    end
  end

%   methods (Access = protected, Abstract)
%     status = installDriverImpl(obj)
%   end

end


%+ easy11 bbbbbbbbbb
% easy12 chistart
% easy14 bound2
%+ easy17 bbbbbbbbbb
%
%
% bbbbbbbbb rinexa: bbbbbbbbbbbbbbbbbbb in the end


function pause(H)
%PAUSE Pause playback of movie in movie player
%  Note that the play and pause methods are identical.
%  Pause is equivalent to calling play.

feval(H.fcns.play,[],[],H.hfig);


function d = delimiter()

if ispc
    d = ';';
else
    d = ':';
end


function  checkout()
%Commit Checkout the currect directory to TortoiseSVN
% See also: svn
svn('checkout',pwd)


% script for compiled EEGLAB version about button

tmptmptext = strvcat('                                  EEGLAB 1997-2020 (compiled version)', ...
                  '       ', ...
                  '       ', ...
                  'The EEGLAB electrophysiological data analysis software is an open source research', ...
                  'project developed at the Swartz Center for Computational Neuroscience, Institute', ...
                  'for Neural Computation at the University of California San Diego in collaboration', ...
                  'with The Salk Institute (La Jolla) and the CERCO laboratory (Toulouse) where part', ...
                  'of the core code was developed.', ...
                  ' ', ...
                  'EEGLAB incorporates several third party suites of functions, Fieldtrip for source ', ...
                  'localization, and BIOSIG for binary file import. A list of plugins is also included', ...
                  'in this compiled release. See http://sccn.ucsd.edu/eeglab/plugins.html for more', ...
                  'information.', ...
                  ' ', ...
                  'The EEGLAB software, its source code, and the source code of all additional third', ...
                  'party functions it includes is protected by the BSD open source license.', ...
                  ' ');

warndlg2(tmptmptext);
clear tmptmptext;


%MAKEFIGS_TRIVARIATE has been moved to JLAB_MAKEFIGS.


function output = base64encode(input)
%BASE64ENCODE Encode a byte array using Base64 codec.
%
%    output = base64encode(input)
%
% The function takes a char, int8, or uint8 array INPUT and returns Base64
% encoded string OUTPUT. JAVA must be running to use this function. Note
% that encoding doesn't preserve input dimensions.
%
% See also base64decode

error(nargchk(1, 1, nargin));
error(javachk('jvm'));
if ischar(input), input = uint8(input); end

output = char(org.apache.commons.codec.binary.Base64.encodeBase64Chunked(input))';

end


tmptmptext = strvcat('                                  EEGLAB 1997-2010 (compiled version)', ...
                  '       ', ...
                  '       ', ...
                  'The EEGLAB electrophysiological data analysis software is an open source research', ...
                  'project developped at the Swartz Center for Computational Neuroscience, Institute', ...
                  'for Neural Computation at the University of California San Diego in collaboration', ...
                  'with The Salk Institute (La Jolla) and the CERCO laboratory (Toulouse) where part', ...
                  'of the core code was developped.', ...
                  ' ', ...
                  'EEGLAB incorporates several third party suites of functions, Fieldtrip for source ', ...
                  'localization, and BIOSIG for binary file import. A list of plugins is also included', ...
                  'in this compiled release. See http://sccn.ucsd.edu/eeglab/plugins.html for more', ...
                  'information.', ...
                  ' ', ...
                  'The EEGLAB software, its source code, and the source code of all additional third', ...
                  'party functions it includes is protected by the GNU GPL open source license.', ...
                  ' ');

warndlg2(tmptmptext);
clear tmptmptext;


classdef TabPanel < uix.TabPanel
    %TabPanel  Show one element inside a tabbed panel
    %
    %   obj = uiextras.TabPanel() creates a panel with tabs along one edge
    %   to allow selection between the different child objects contained.
    %
    %   obj = uiextras.TabPanel(param,value,...) also sets one or more
    %   property values.
    %
    %   See the documentation for more detail and the list of properties.
    %
    %   Examples:
    %   >> f = figure();
    %   >> p = uiextras.TabPanel( 'Parent', f, 'Padding', 5 );
    %   >> uicontrol( 'Style', 'frame', 'Parent', p, 'Background', 'r' );
    %   >> uicontrol( 'Style', 'frame', 'Parent', p, 'Background', 'b' );
    %   >> uicontrol( 'Style', 'frame', 'Parent', p, 'Background', 'g' );
    %   >> p.TabNames = {'Red', 'Blue', 'Green'};
    %   >> p.SelectedChild = 2;
    %
    %   See also: uiextras.Panel
    %             uiextras.BoxPanel

    %  Copyright 2009-2014 The MathWorks, Inc.
    %  $Revision: 979 $ $Date: 2014-09-28 14:26:12 -0400 (Sun, 28 Sep 2014) $

    properties( Hidden, Access = public, Dependent )
        Callback
    end

    properties( Access = private )
        Callback_ = '' % backing for Callback
    end

    properties( Hidden, Access = public, Dependent )
        Enable % deprecated
        SelectedChild
        TabEnable
        TabNames
        TabPosition
        TabSize
    end

    properties( Access = private )
        SelectionChangedListener % listener
    end

    methods

        function obj = TabPanel( varargin )

            % Call uix constructor
            obj@uix.TabPanel( varargin{:} )

            % Auto-parent
            if ~ismember( 'Parent', varargin(1:2:end) )
                obj.Parent = gcf();
            end

            % Create listeners
            selectionChangedListener = event.listener( obj, ...
                'SelectionChanged', @obj.onSelectionChanged );

            % Store properties
            obj.SelectionChangedListener = selectionChangedListener;

        end % constructor

    end % structors

    methods

        function value = get.Enable( ~ )

            % Warn
            % warning( 'uiextras:Deprecated', ...
            %     'Property ''Enable'' will be removed in a future release.' )

            % Return
            value = 'on';

        end % get.Enable

        function set.Enable( ~, value )

            % Check
            assert( ischar( value ) && any( strcmp( value, {'on','off'} ) ), ...
                'uiextras:InvalidPropertyValue', ...
                'Property ''Enable'' must be ''on'' or ''off''.' )

            % Warn
            % warning( 'uiextras:Deprecated', ...
            %     'Property ''Enable'' will be removed in a future release.' )

        end % set.Enable

        function value = get.Callback( obj )

            % Get
            value = obj.Callback_;

        end % get.Callback

        function set.Callback( obj, value )

            % Check
            if ischar( value ) % string
                % OK
            elseif isa( value, 'function_handle' ) && ...
                    isequal( size( value ), [1 1] ) % function handle
                % OK
            elseif iscell( value ) && ndims( value ) == 2 && ...
                    size( value, 1 ) == 1 && size( value, 2 ) > 0 && ...
                    isa( value{1}, 'function_handle' ) && ...
                    isequal( size( value{1} ), [1 1] ) %#ok<ISMAT> % cell callback
                % OK
            else
                error( 'uiextras:InvalidPropertyValue', ...
                    'Property ''Callback'' must be a valid callback.' )
            end

            % Set
            obj.Callback_ = value;

        end % set.Callback

        function value = get.SelectedChild( obj )

            % Get
            value = obj.Selection;

        end % get.SelectedChild

        function set.SelectedChild( obj, value )

            % Set
            obj.Selection = value;

        end % set.SelectedChild

        function value = get.TabEnable( obj )

            % Get
            value = transpose( obj.TabEnables );

        end % get.TabEnable

        function set.TabEnable( obj, value )

            % Set
            obj.TabEnables = value;

        end % set.TabEnable

        function value = get.TabNames( obj )

            % Get
            value = transpose( obj.TabTitles );

        end % get.TabNames

        function set.TabNames( obj, value )

            % Set
            obj.TabTitles = value;

        end % set.TabNames

        function value = get.TabPosition( obj )

            % Get
            value = obj.TabLocation;

        end % get.TabPosition

        function set.TabPosition( obj, value )

            % Set
            obj.TabLocation = value;

        end % set.TabPosition

        function value = get.TabSize( obj )

            % Get
            value = obj.TabWidth;

        end % get.TabSize

        function set.TabSize( obj, value )

            % Set
            obj.TabWidth = value;

        end % set.TabSize

    end % accessors

    methods( Access = private )

        function onSelectionChanged( obj, source, eventData )

            % Create legacy event data structure
            oldEventData = struct( 'Source', eventData.Source, ...
                'PreviousChild', eventData.OldValue, ...
                'SelectedChild', eventData.NewValue );

            % Call callback
            callback = obj.Callback_;
            if ischar( callback ) && isequal( callback, '' )
                % do nothing
            elseif ischar( callback )
                feval( callback, source, oldEventData )
            elseif isa( callback, 'function_handle' )
                callback( source, oldEventData )
            elseif iscell( callback )
                feval( callback{1}, source, oldEventData, callback{2:end} )
            end

        end % onSelectionChanged

    end % event handlers

end % classdef


classdef PTKDependency < handle
    % PTKDependency. Part of the internal framework of the TD MIM Toolkit.
    %
    %     You should not use this class within your own code. It is intended to
    %     be used internally within the framework of the TD MIM Toolkit.
    %
    %     PTKDependency sores a dependency object, uniquely tagging a particular
    %     result generated from running a plugin. This dependency is stored
    %     alongside the plugin result and stored in the
    %     dependency list of every plugin which uses this result. This allows us
    %     to determine that a result is still valid, because its dependencies
    %     still match the dependency objects in the cache.
    %     Licence
    %     -------
    %     Part of the TD MIM Toolkit. https://github.com/tomdoel
    %     Author: Tom Doel, Copyright Tom Doel 2014.  www.tomdoel.com
    %     Distributed under the MIT licence. Please see website for details.
    %

    properties
        PluginName
        Context
        Uid
        DatasetUid
        Attributes
    end

    methods
        function obj = PTKDependency(name, context, uid, dataset_uid, attributes)
            obj.PluginName = name;
            obj.Context = context;
            obj.Uid = uid;
            obj.DatasetUid = dataset_uid;
            obj.Attributes = attributes;
        end
    end
end


function TF = isax(h)
%ISAX Check if input is an axes handle.
% Usage:
%   TF = isax(h)
%
% Args:
%   h:
%
% See also: isfig, isgraphics

TF = isa(h,'matlab.graphics.axis.Axes');

end


% env add


%OR Datafile overload


% BACKEND
%
% Files
%   CheckForJVM     - Throws an error if the JVM is not available.
%   SafeGetField    - A safe wrapper to GETFIELD.
%   SetDefaultValue - Initialise a missing or empty value in the caller.
%   strcontains     - Does a cell array contain a particular string?


%kkgeneric 'Generic Routine Interface (glue)'
% This MatLab function was automatically generated by a converter (KhorosToMatLab) from the Khoros kgeneric.pane file
%
% Parameters:
% String: prefix 'Prefix', default: ' ': 'prefix string'
% InputFile: i 'Input Image ', optional: 'input image'
% OutputFile: o 'Output Image', optional: 'output image or file'
% String: iname1 'Input name #1 ', default: ' ': 'name of input argument #1'
% InputFile: i1 'Input Filename #1 ', optional: 'input filename #1'
% String: iname2 'Input name #2 ', default: ' ': 'name of input argument #2'
% InputFile: i2 'Input Filename #2 ', optional: 'input filename #2'
% String: iname3 'Input name #3 ', default: ' ': 'name of input argument #3'
% InputFile: i3 'Input Filename #3 ', optional: 'input filename #3'
% String: oname1 'Output name #1', default: ' ': 'name of output argument #1'
% OutputFile: o1 'Output Filename #1', optional: 'output filename #1'
% String: oname2 'Output name #2', default: ' ': 'name of output argument #2'
% OutputFile: o2 'Output Filename #2', optional: 'output filename #2'
% String: oname3 'Output name #3', default: ' ': 'name of output argument #3'
% OutputFile: o3 'Output Filename #3', optional: 'output filename #3'
% String: name1 'Arg name #1', default: ' ': 'Name of argument #1'
% String: val1 'Argument #1 value', default: ' ': 'argument #1 value'
% String: name2 'Arg name #2', default: ' ': 'Name of argument #2'
% String: val2 'Argument #2 value', default: ' ': 'argument #2 value'
% String: name3 'Arg name #3', default: ' ': 'Name of argument #3'
% String: val3 'Argument #3 value', default: ' ': 'argument #3 value'
% String: name4 'Arg name #4', default: ' ': 'Name of argument #4'
% String: val4 'Argument #4 value', default: ' ': 'argument #4 value'
% String: name5 'Arg name #5', default: ' ': 'Name of argument #5'
% String: val5 'Argument #5 value', default: ' ': 'argument #5 value'
% String: name6 'Arg name #6', default: ' ': 'Name of argument #6'
% String: val6 'Argument #6 value', default: ' ': 'argument #6 value'
% String: name7 'Arg name #7', default: ' ': 'Name of argument #7'
% String: val7 'Argument #7 value', default: ' ': 'argument #7 value'
% String: name8 'Arg name #8', default: ' ': 'Name of argument #8'
% String: val8 'Argument #8 value', default: ' ': 'argument #8 value'
% String: trailer 'Trailer', default: ' ': 'trailer string'
%
% Example: [o, o1, o2, o3] = kkgeneric({i, i1, i2, i3}, {'prefix',' ';'i','';'o','';'iname1',' ';'i1','';'iname2',' ';'i2','';'iname3',' ';'i3','';'oname1',' ';'o1','';'oname2',' ';'o2','';'oname3',' ';'o3','';'name1',' ';'val1',' ';'name2',' ';'val2',' ';'name3',' ';'val3',' ';'name4',' ';'val4',' ';'name5',' ';'val5',' ';'name6',' ';'val6',' ';'name7',' ';'val7',' ';'name8',' ';'val8',' ';'trailer',' '})
%
% Khoros helpfile follows below:
%
%  PROGRAM
% kgeneric - Generic Routine Interface (glue)
%
%  DESCRIPTION
% .I kgeneric
% is a programmable interface that allows a generalized Un*x command line
% to be executed by cantata.
%
% Entries on the pane are spit out to a string that is then system()'d
% off. The string is built up by appending the contents of the SELECTED
% entries together in scan-line order.
%
% Note: All entries are strings. Unfortunately, the forms don't
% seem to like multiple-worded strings, so you have to build up your
% command piece at a time. You CAN use a multiple-worded string in the
% prefix and trailer.
%
% Note: Anything entered into a FILENAME box will be treated as a file
% using the normal Khoros file access checking. This means the UI will
% try to open the filename for access. If it is a Un*x command or other
% object then things won't work.
%
% Note: There appears to be no way to protect special characters from
% the shell.
%
% Note: The oval button to the left of argument name selection allows
% you to put a minus sign ("-") immediately in front of the name itself
% in the command string that is executed. The parser won't let you
% put a minus sign in the string field itself - it will complain about
% unknown arguments. So if you want an argument name that looks like
%
% -blah
%
% then click the button to get the - to show and enter blah as the name.
% The actual command string executed will look like that above.
%
% Note: There is no job control from this routine. Hitting the
% kill button in cantata is not guaranteed to kill the command that was
% system()'d off. Additionally, status reporting is unsupported.
%
%
%
%  EXAMPLES
%
% To execute:
%
% ls -al > snarf
%
% using this routine, do:
%
% % kgeneric -prefix ls -iname1 al -iname2 > -o1 snarf -di1 1 -di2 0 -di3 0 -do1 0
% -do2 0 -do3 0 -dn1 0 -dn2 0 -dn3 0 -dn4 0 -dn5 0 -dn6 0 -dn7 0 -dn8 0
%
% and you should get the desired result. Note that this routine is not much good
% for use on the command line. It is for cantata.
%
%  "SEE ALSO"
% None. Yet.
%
%  RESTRICTIONS
% Kgeneric executes the command via a ksystem() call, and thus there is no
% reporting of errors from the command. If nothing happens when you run a command,
% try  executing the whole command from command line. If the command line fails,
% fix the problem before trying to use kgeneric.
%
% No data type or range checking is available when using this interface.
%
%  REFERENCES
% None.
%
%  COPYRIGHT
% Copyright (C) 1993 - 1996, Khoral Research, Inc.  All rights reserved.
%

function varargout = kkgeneric(varargin)
if nargin ==0
  Inputs={};arglist={'',''};
elseif nargin ==1
  Inputs=varargin{1};arglist={'',''};
elseif nargin ==2
  Inputs=varargin{1}; arglist=varargin{2};
else error('Usage: [out1,..] = kkgeneric(Inputs,arglist).');
end
if size(arglist,2)~=2
  error('arglist must be of form {''ParameterTag1'',value1;''ParameterTag2'',value2}')
 end
narglist={'prefix', ' ';'i', '__input';'o', '__output';'iname1', ' ';'i1', '__input';'iname2', ' ';'i2', '__input';'iname3', ' ';'i3', '__input';'oname1', ' ';'o1', '__output';'oname2', ' ';'o2', '__output';'oname3', ' ';'o3', '__output';'name1', ' ';'val1', ' ';'name2', ' ';'val2', ' ';'name3', ' ';'val3', ' ';'name4', ' ';'val4', ' ';'name5', ' ';'val5', ' ';'name6', ' ';'val6', ' ';'name7', ' ';'val7', ' ';'name8', ' ';'val8', ' ';'trailer', ' '};
maxval={0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
minval={0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
istoggle=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
was_set=istoggle * 0;
paramtype={'String','InputFile','OutputFile','String','InputFile','String','InputFile','String','InputFile','String','OutputFile','String','OutputFile','String','OutputFile','String','String','String','String','String','String','String','String','String','String','String','String','String','String','String','String','String'};
% identify the input arrays and assign them to the arguments as stated by the user
if ~iscell(Inputs)
Inputs = {Inputs};
end
NumReqOutputs=0; nextinput=1; nextoutput=1;
  for ii=1:size(arglist,1)
  wasmatched=0;
  for jj=1:size(narglist,1)
   if strcmp(arglist{ii,1},narglist{jj,1})  % a given argument was matched to the possible arguments
     wasmatched = 1;
     was_set(jj) = 1;
     if strcmp(narglist{jj,2}, '__input')
      if (nextinput > length(Inputs))
        error(['Input ' narglist{jj,1} ' has no corresponding input!']);
      end
      narglist{jj,2} = 'OK_in';
      nextinput = nextinput + 1;
     elseif strcmp(narglist{jj,2}, '__output')
      if (nextoutput > nargout)
        error(['Output nr. ' narglist{jj,1} ' is not present in the assignment list of outputs !']);
      end
      if (isempty(arglist{ii,2}))
        narglist{jj,2} = 'OK_out';
      else
        narglist{jj,2} = arglist{ii,2};
      end

      nextoutput = nextoutput + 1;
      if (minval{jj} == 0)
         NumReqOutputs = NumReqOutputs - 1;
      end
     elseif isstr(arglist{ii,2})
      narglist{jj,2} = arglist{ii,2};
     else
        if strcmp(paramtype{jj}, 'Integer') & (round(arglist{ii,2}) ~= arglist{ii,2})
            error(['Argument ' arglist{ii,1} ' is of integer type but non-integer number ' arglist{ii,2} ' was supplied']);
        end
        if (minval{jj} ~= 0 | maxval{jj} ~= 0)
          if (minval{jj} == 1 & maxval{jj} == 1 & arglist{ii,2} < 0)
            error(['Argument ' arglist{ii,1} ' must be bigger or equal to zero!']);
          elseif (minval{jj} == -1 & maxval{jj} == -1 & arglist{ii,2} > 0)
            error(['Argument ' arglist{ii,1} ' must be smaller or equal to zero!']);
          elseif (minval{jj} == 2 & maxval{jj} == 2 & arglist{ii,2} <= 0)
            error(['Argument ' arglist{ii,1} ' must be bigger than zero!']);
          elseif (minval{jj} == -2 & maxval{jj} == -2 & arglist{ii,2} >= 0)
            error(['Argument ' arglist{ii,1} ' must be smaller than zero!']);
          elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} < minval{jj})
            error(['Argument ' arglist{ii,1} ' must be bigger than ' num2str(minval{jj})]);
          elseif (minval{jj} ~= maxval{jj} & arglist{ii,2} > maxval{jj})
            error(['Argument ' arglist{ii,1} ' must be smaller than ' num2str(maxval{jj})]);
          end
        end
     end
     if ~strcmp(narglist{jj,2},'OK_out') &  ~strcmp(narglist{jj,2},'OK_in')
       narglist{jj,2} = arglist{ii,2};
     end
   end
   end
   if (wasmatched == 0 & ~strcmp(arglist{ii,1},''))
        error(['Argument ' arglist{ii,1} ' is not a valid argument for this function']);
   end
end
% match the remaining inputs/outputs to the unused arguments and test for missing required inputs
 for jj=1:size(narglist,1)
     if  strcmp(paramtype{jj}, 'Toggle')
        if (narglist{jj,2} ==0)
          narglist{jj,1} = '';
        end;
        narglist{jj,2} = '';
     end;
     if  ~strcmp(narglist{jj,2},'__input') && ~strcmp(narglist{jj,2},'__output') && istoggle(jj) && ~ was_set(jj)
          narglist{jj,1} = '';
          narglist{jj,2} = '';
     end;
     if strcmp(narglist{jj,2}, '__input')
      if (minval{jj} == 0)  % meaning this input is required
        if (nextinput > size(Inputs))
           error(['Required input ' narglist{jj,1} ' has no corresponding input in the list!']);
        else
          narglist{jj,2} = 'OK_in';
          nextinput = nextinput + 1;
        end
      else  % this is an optional input
        if (nextinput <= length(Inputs))
          narglist{jj,2} = 'OK_in';
          nextinput = nextinput + 1;
        else
          narglist{jj,1} = '';
          narglist{jj,2} = '';
        end;
      end;
     else
     if strcmp(narglist{jj,2}, '__output')
      if (minval{jj} == 0) % this is a required output
        if (nextoutput > nargout & nargout > 1)
           error(['Required output ' narglist{jj,1} ' is not stated in the assignment list!']);
        else
          narglist{jj,2} = 'OK_out';
          nextoutput = nextoutput + 1;
          NumReqOutputs = NumReqOutputs-1;
        end
      else % this is an optional output
        if (nargout - nextoutput >= NumReqOutputs)
          narglist{jj,2} = 'OK_out';
          nextoutput = nextoutput + 1;
        else
          narglist{jj,1} = '';
          narglist{jj,2} = '';
        end;
      end
     end
  end
end
if nargout
   varargout = cell(1,nargout);
else
  varargout = cell(1,1);
end
global KhorosRoot
if exist('KhorosRoot') && ~isempty(KhorosRoot)
w=['"' KhorosRoot];
else
if ispc
  w='"C:\Program Files\dip\khorosBin\';
else
[s,w] = system('which cantata');
w=['"' w(1:end-8)];
end
end
[varargout{:}]=callKhoros([w 'kgeneric"  '],Inputs,narglist);


function styleLabelAsWarn(hLabel,warnStr)
%styleLabelAsWarn Summary of this function goes here
%   Detailed explanation goes here
    lblStr = strWrapForLabel(hLabel, warnStr);

    set(hLabel,'Visible','on');
    set(hLabel,'BackgroundColor',[1,1,0]);
    set(hLabel,'ForegroundColor',[0,0,0]);
    set(hLabel,'String',lblStr);
    set(hLabel,'TooltipString','');
    set(hLabel,'FontWeight','bold');

    setappdata(hLabel,'tooltipstring',warnStr);
end


function s=get_name(a,detailed)
 s=get_name(a.algorithm);
 eval_name


function pathstr = getPathStrDialog(startPathStr,title,filterspec)
%
% fullPath = getPathStrDialog(startPathStr,title,[filterspec])
%
% Calls uigetfile to display a dialog box that allows the user to pick a file.
%
% startPathStr: starting point for the dialogbox
% title: window title of dialog box, passed on to uigetfile.
% filterspec: passed onto uigetfile. default: '*'
%
% returns full path string
%
% djh, 2/5/2001

if ~exist('filterspec','var')
    filterspec = '*';
end
if ~exist(startPathStr,'dir')
    startPathStr = pwd;
end

% save current file position
cDir=pwd;
% move to appropriate directory
chdir(startPathStr);
% call uigetfile
[filename, pathStr]=uigetfile(filterspec,title);
% move back to original directory
chdir(cDir);

if (filename==0) % cancel pressed
    pathstr = [];
else
    pathstr=fullfile(pathStr,filename);
end


%MIN Datafile overload


classdef PostProcessingConfiguratorUIElements < handle
    properties (Access = public)
        algorithmsList;
        algorithmsPropertiesTable;
        annotationsPanel;
        annotationMappingList;
        annotationMappingTable;
    end

    methods (Access = public)
        function obj = PostProcessingConfiguratorUIElements(algorithmsList,...
                algorithmsPropertiesTable, annotationsPanel, annotationMappingList,...
            annotationMappingTable)
            obj.algorithmsList = algorithmsList;
            obj.annotationsPanel = annotationsPanel;
            obj.algorithmsPropertiesTable = algorithmsPropertiesTable;
            obj.annotationMappingList = annotationMappingList;
            obj.annotationMappingTable = annotationMappingTable;
        end
    end
end


function userInterrupt(standalone)
global procStreamStyle
global testidx

UnitTests_Init(standalone, false);
testidx=[];
procStreamStyle=[];


classdef core
% General utility functions
methods(Static)

end

end


function store = getStore(problem, x, storedb) %#ok<STOUT,INUSD>

    error('This file was removed from Manopt. Please use the StoreDB class.');

end


classdef MimClearDataset < MimGuiPlugin
    % MimClearDataset. Gui Plugin for displaying an "about box" dialog
    %
    %     You should not use this class within your own code. It is intended to
    %     be used by the gui of the TD MIM Toolkit.
    %
    %     MimClearDataset is a Gui Plugin for the MIM Toolkit. The gui will
    %     create a button to run this plugin. Running this plugin will cause a
    %     splash screen dialog to be displayed.
    %
    %
    %     Licence
    %     -------
    %     Part of the TD MIM Toolkit. https://github.com/tomdoel
    %     Author: Tom Doel, Copyright Tom Doel 2014.  www.tomdoel.com
    %     Distributed under the MIT licence. Please see website for details.
    %

    properties
        ButtonText = 'No Dataset'
        SelectedText = 'No Dataset'
        ToolTip = ''
        Category = 'Developer tools'
        Visibility = 'Developer'
        Mode = 'Segment'

        HidePluginInDisplay = false
        PTKVersion = '1'
        ButtonWidth = 6
        ButtonHeight = 1
        Icon = 'clear_overlay.png'
        Location = 101
    end

    methods (Static)
        function RunGuiPlugin(gui_app)
            gui_app.ClearDataset;
        end

        function enabled = IsEnabled(gui_app)
            enabled = gui_app.DeveloperMode && gui_app.IsDatasetLoaded;
        end

    end
end


%OPENFG Framegrabber device open function.
%
%SYNTAX devinfo = openfg('alias')
%
%DESCRIPTION This function will let the user open a DT
%framegrabber device. The user has to give the
%framegrabbers alias as input argument. The user
%already knows this alias. This function can also be used
%to get the device information structure of a device that
%was already opened.
%
%INPUT The alias (alias) of the framegrabber device.
%
%REMARKS It will be verified if the input is a valid string.
%If it's valid, it will try to open the framegrabber device
%with that specific alias. If more than one Framegrabber is
%installed in the computer, it is necessary to give unique
%aliases to these devices.
%
%OUTPUT If the input isn't valid or the framegrabber device
%can't be opened for some reason, some error message will be
%shown to the user. If everything's ok, this function will
%return a structure with the device information (devinfo) of
%the opened framegrabber device.
%
%EXAMPLE To open the framegrabber with alias 'DT3152' and
%store the device info strucutre in the variable m, or, if
%the device with alias 'DT3152' was already open, to store
%the device info structure in the variable m, use:
%
%	m = openfg('DT3152');

disp('Error: openfg not found.')


function planC = annotatePlanCForXNAT(planC, xhost,xexp,xproj,xsubj)
% function planC = annotatePlanCForXNAT(planC, xhost,xexp,xproj,xsubj)
%
% This function adds XNAT addressing metadata to an existing planC

if nargin < 3 || isempty(xproj)
    xproj = '';
    if isempty(xsubj)
        xsubj = '';
    end
end

indexS = planC{end};
planC{indexS.header}.xnatInfo = struct('host',xhost,'experiment_id',xexp,'project_id',xproj,'subject_id',xsubj);


function p = root()
    %ROOT  Obtain mexopencv root path
    %
    persistent p_cache
    if isempty(p_cache)
        p_cache = fileparts(fileparts(mfilename('fullpath')));
    end
    p = p_cache;
end


function SDUpdater(fhndl)

persistent app cleanup;

if ~isempty(cleanup)
    cleanup = [];
end

if ~ispc
    error('The SD Updater is only supported on Windows platforms');
end

app = feval(fhndl);
cleanup = onCleanup(@()delete(app));


%--- help for decompose_parameter_name ---
%
%  INTERNAL FUNCTION
%
%


shallPrint = false;


function address = resolveip(input)
%resolveip Summary of this function goes here
%   Detailed explanation goes here
    try
        address = java.net.InetAddress.getByName(input);
    catch
        error(sprintf('Unknown host %s.', input));
    end
end


function closeSSWindow()
%
% closeSSWindow()
%
% clears SS while closing the corresponding window.
%
% rmk, 9/17/98

% Clear the variable
clear global SS

% Delete the window
delete(get(0,'CurrentFigure'));

return


% PLUGUIN_UIUPDATE - support function for plugin_menu

% Copyright (C) 2019 Arnaud Delorme
%
% This file is part of EEGLAB, see http://www.eeglab.org
% for the documentation and details.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain the above copyright notice,
% this list of conditions and the following disclaimer.
%
% 2. Redistributions in binary form must reproduce the above copyright notice,
% this list of conditions and the following disclaimer in the documentation
% and/or other materials provided with the distribution.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
% THE POSSIBILITY OF SUCH DAMAGE.

function plugin_uiupdate(fig)

tmpobj = get(fig, 'userdata');
listboxVal = get(findobj(fig, 'tag', 'pluginlist'), 'value');

allPlugins = tmpobj.allplugins;
selectedPlugins = tmpobj.selectedplugins;
selection       = tmpobj.selection;
if length(listboxVal) == 1
    lastSelect = listboxVal;
else
    lastSelect = setdiff(listboxVal, selection);

    % check if selection is consistent
    if ~all([selectedPlugins([ listboxVal ]).installed]) && ~all(~[selectedPlugins([ listboxVal ]).installed] )
        listboxVal = lastSelect(1);
        set(findobj(fig, 'tag', 'pluginlist'), 'value', listboxVal);
    end
end
if isempty(lastSelect), lastSelect = listboxVal(1); end
if length(lastSelect) > 1, lastSelect = lastSelect(1); end

tmpstr = selectedPlugins(lastSelect).description;

% set text
hDescription = findobj(fig, 'tag', 'description');
hTags        = findobj(fig, 'tag', 'tags');
hStatus      = findobj(fig, 'tag', 'status');
hSize        = findobj(fig, 'tag', 'size');
tmpstr = textwrap(hDescription, {tmpstr});
set(hDescription, 'string', tmpstr);
set(hTags       , 'string', selectedPlugins(lastSelect).rawtags );
set(hSize       , 'string', [num2str(ceil(selectedPlugins(lastSelect).size/100)/10) ' MB'] );

% installed status
if selectedPlugins(lastSelect).installed
    if selectedPlugins(lastSelect).installorupdate
        set(hStatus, 'string', ['version ' selectedPlugins(lastSelect).currentversion ' installed - an update is available'] );
    else
        set(hStatus , 'string', 'installed' );
    end
else
    set(hStatus, 'string', 'not installed');
end

% set buttons
set(findobj(fig, 'tag', 'install'), 'enable', 'on');
if selectedPlugins(lastSelect).installed
    set(findobj(fig, 'tag', 'rmbut'), 'enable', 'on');
else
    set(findobj(fig, 'tag', 'rmbut'), 'enable', 'off');
end
if ~isempty(selectedPlugins(lastSelect).webdoc)
    set(findobj(fig, 'tag', 'documentation'), 'enable', 'on', 'callback', ['web(''' selectedPlugins(lastSelect).webdoc ''', ''-browser'');' ]);
else
    set(findobj(fig, 'tag', 'documentation'), 'enable', 'off')
end
set(findobj(fig, 'tag', 'rating'),  'callback', ['web(''' selectedPlugins(lastSelect).webrating ''', ''-browser'');' ]);

tmpobj.selection = listboxVal;
set(fig, 'userdata', tmpobj);


function separatePausedNSx(varargin)

% separatePausedNsx    Obsoleted. Use splitNSxPauses instead.

disp('This function is obsoleted.')
disp('Use splitNSxPauses instead.');

splitNSxPauses;


classdef Step3 < adi.StepBase

    %   Copyright 2017 The MathWorks, Inc.

    methods
        function obj = Step3(varargin)
            obj@adi.StepBase(varargin{:});

            %       obj.Workflow.InstallDriverWorkflow = true;

            obj.Title.Text = 'ADI Board Support Package Installer: Step3';

            obj.InfoText1.Position = [20 340 400 30];
            obj.InfoText1.Text = 'Test1: Step3';

            obj.InfoText2.Position = [20 290 400 50];
            obj.InfoText2.Text = 'Test2: Step3';

            obj.HelpText.AboutSelection = 'About Selection: Step3';
            obj.HelpText.WhatToConsider = 'Test3: Step3';
        end

%         function out = getNextScreenID(obj)
%             % HSA infrastructure requires a "getNextScreenID" method implemented
%             % in the leaf class. Otherwise, it renders "Finish" button instead of
%             % "Next".
%             out = getNextScreenIDImpl(obj);
%         end

        function restoreScreen(obj)
            obj.enableScreen();
        end
    end

    methods (Access = protected)

        function out = getNextScreenIDImpl(~)
            out = 'adi.Step3';
        end

    end

end


classdef PTKReportingDefault < CoreReportingDefault
    % PTKReportingDefault. Legacy support class. Replaced by CoreReportingDefault.
    %
    %
    %     Licence
    %     -------
    %     Part of the TD MIM Toolkit. https://github.com/tomdoel
    %     Author: Tom Doel, Copyright Tom Doel 2014.  www.tomdoel.com
    %     Distributed under the MIT licence. Please see website for details.
    %

    methods
        function obj = PTKReportingDefault(varargin)
            obj = obj@CoreReportingDefault(varargin{:});
        end
    end
end


%GETFG Query function for the Framegrabber.
%
%SYNTAX parvalue = getfg(devinfo, 'parname');
%
%DESCRIPTION This function will let the user get a
%parameter of DT framegrabber device.
%
%INPUT The device information structure (devinfo)
%of the opened framegrabber device and the parameter
%name (parname) and if applicable the field name
%(fieldname).
%
%REMARKS It will be verified if the first input
%argument is a valid device information structure and
%if the second input argument is a parameter name and
%if the third input argument is a fieldname
%(if applicable). If it's valid, it will try to get
%the device id from the device information structure.
%
%OUTPUT If the input isn't valid or the framegrabber
%can't get the parameter value of the chosen parameter
%name, some error message will be shown to the user.
%If everything's ok, it will return the parameter value
%(parvalue) of the chosen parameter name of the device.
%
%EXAMPLE To get the blacklevel which will be stored in
%the variable bl, and assuming that the variable m
%stores the device info of the current framegrabber, type:
%
%	bl = getfg(m,'blacklevel');

disp('Error: getfg not found.')


% SERVER.SENDREQUEST sends an RPC request to a slave.
function sendRequest(server, slaveIdx, numArgsOut, reqHook, varargin)
  if (slaveIdx > server.slaveCount)
    error('Slave index is out of bounds.');
  end

  % set up output stream
  req.hook = reqHook;
  req.vars = varargin;
  req.nargout = numArgsOut;

  % set up output stream, send object
  if (server.options.emulate)
    server.savedObjects{slaveIdx} = matlab2java(req);
  else
    if (slaveIdx > length(server.slave_sock))
      error('No socket for slave.');
    end

    os=server.slave_sock{slaveIdx}.getOutputStream();
    oos=java.io.ObjectOutputStream(os);
    oos.writeObject(matlab2java(req));
  end


function cleanup(dirnameInstall, dirnameApp, options)
global platform

installfilename = sprintf('%s_install', lower(getAppname()));

if ~exist('dirnameInstall','var') || isempty(dirnameInstall)
    if exist('./Install','dir')
        dirnameInstall = filesepStandard([pwd, '/Install']);
    else
        dirnameInstall = filesepStandard(pwd);
    end
end
if ~exist('dirnameApp','var') || isempty(dirnameApp)
    dirnameApp = getAppDir();
end
if ~exist('options','var')
    options = 'end';
end

if exist([dirnameInstall, installfilename],'dir')
    rmdir_safe([dirnameInstall, installfilename]);
end
for ii = 1:length(platform.exename)
    if exist([dirnameInstall, platform.exename{ii}],'file')==2
        delete([dirnameInstall, platform.exename{ii}]);
    elseif exist([dirnameInstall, platform.exename{ii}],'dir')==7
        rmdir_safe([dirnameInstall, platform.exename{ii}]);
    end
end
if ispathvalid([dirnameApp, 'requiredMCRProducts.txt'])
    delete([dirnameApp, 'requiredMCRProducts.txt']);
end
if ispathvalid([dirnameInstall, 'requiredMCRProducts.txt'])
    delete([dirnameInstall, 'requiredMCRProducts.txt']);
end
if ispathvalid([dirnameInstall, 'desktopPath.txt'])
    delete([dirnameInstall, 'desktopPath.txt']);
end

for ii=1:length(platform.setup_exe)
    if exist([dirnameInstall, platform.setup_exe{ii}],'file')==2
        delete([dirnameInstall, platform.setup_exe{ii}]);
    elseif exist([dirnameInstall, platform.setup_exe{ii}],'dir')==7
        rmdir_safe([dirnameInstall, platform.setup_exe{ii}]);
    end
end
if optionExists(options,'start')
    if exist([dirnameInstall, 'Buildme.log'],'file')
        delete([dirnameInstall, 'Buildme.log']);
    end
    if exist([dirnameApp, 'Buildme_Setup.log'],'file')
        delete([dirnameApp, 'Buildme_Setup.log']);
    end
end
if exist([dirnameInstall, 'mccExcludedFiles.log'],'file')
    delete([dirnameInstall, 'mccExcludedFiles.log']);
end
if exist([dirnameApp, 'mccExcludedFiles.log'],'file')
    delete([dirnameApp, 'mccExcludedFiles.log']);
end


function obj=addFromSuite(obj, s)
% Add MOxUnitTestSuite tests to the suite
%
% obj=addFromSuite(obj, s)
%
% Inputs:
%   obj             MoxUnitTestSuite instance
%   s               MOxUnitTestSuite instance with tests to be added to
%                   the suite.
%
% Output:
%   obj             MoxUnitTestSuite instance with all tests in s
%                   added to the suite
%
% See also: initTestSuite
%
% NNO 2015

    n_test_nodes=countTestNodes(s);

    for k=1:n_test_nodes
        test_node=getTestNode(s, k);
        obj=addTest(obj, test_node);
    end


function getHeaderSize(in)
%
%
if notDefined('in');
    in = '';
else
    warning('Obsolete funciton');
end

disp(in);

return


function varargout = compressione_help(varargin)
% COMPRESSIONE_HELP M-file for compressione_help.fig
%      COMPRESSIONE_HELP, by itself, creates a new COMPRESSIONE_HELP or raises the existing
%      singleton*.
%
%      H = COMPRESSIONE_HELP returns the handle to a new COMPRESSIONE_HELP or the handle to
%      the existing singleton*.
%
%      COMPRESSIONE_HELP('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in COMPRESSIONE_HELP.M with the given input arguments.
%
%      COMPRESSIONE_HELP('Property','Value',...) creates a new COMPRESSIONE_HELP or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before compressione_help_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to compressione_help_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help compressione_help

% Last Modified by GUIDE v2.5 16-Jun-2010 18:52:11

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @compressione_help_OpeningFcn, ...
                   'gui_OutputFcn',  @compressione_help_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before compressione_help is made visible.
function compressione_help_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to compressione_help (see VARARGIN)

% Choose default command line output for compressione_help
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes compressione_help wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = compressione_help_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


function obj = void_interpreter(filelist)
   obj = [];
   error('No interpreter has been assigned to this datasource object');
end


%script: copy correct dll-files

 if(exist('./pco_uint32.m','file'))
  delete('./pco_uint32.m');
 end

 if(exist('./pco_uint32err.m','file'))
  delete('./pco_uint32err.m');
 end

 if verLessThan('matlab','8.0.0')
  copyfile('./ver_7/pco_uint32.m','./pco_uint32.m');
  copyfile('./ver_7/pco_uint32err.m','./pco_uint32err.m');
 else
  copyfile('./ver_8/pco_uint32.m','./pco_uint32.m');
  copyfile('./ver_8/pco_uint32err.m','./pco_uint32err.m');
 end

 if(exist('../runtime/include','dir'))
  copyfile('../runtime/include/*.h','./');
 end

 pco_camera_create_deffile();

 if(strcmp(computer('arch'),'win32'))

  if(exist('./sc2_cam.dll','file'))
   delete('./sc2_cam.dll');
  end
  if(exist('../runtime/bin/sc2_cam.dll','file'))
   copyfile('../runtime/bin/sc2_cam.dll','./');
  end

  if(exist('./sc2_cl_me4.dll','file'))
   delete('./sc2_cl_me4.dll');
  end
  if(exist('../runtime/bin/sc2_cl_me4.dll','file'))
   copyfile('../runtime/bin/sc2_cl_me4.dll','./');
  end

  if(exist('./sc2_cl_nat.dll','file'))
   delete('./sc2_cl_nat.dll');
  end
  if(exist('../runtime/bin/sc2_cl_nat.dll','file'))
   copyfile('../runtime/bin/sc2_cl_nat.dll','./');
  end

  if(exist('./sc2_cl_mtx.dll','file'))
   delete('./sc2_cl_mtx.dll');
  end
  if(exist('../runtime/bin/sc2_cl_mtx.dll','file'))
   copyfile('../runtime/bin/sc2_cl_mtx.dll','./');
  end

  if(exist('./sc2_clhs.dll','file'))
   delete('./sc2_clhs.dll');
  end
  if(exist('../runtime/bin/sc2_clhs.dll','file'))
   copyfile('../runtime/bin/sc2_clhs.dll','./');
  end

  if(exist('./PCO_Recorder.dll','file'))
   delete('./PCO_Recorder.dll');
  end
  if(exist('../runtime/bin/PCO_Recorder.dll','file'))
   copyfile('../runtime/bin/PCO_Recorder.dll','./');
  end

  if(exist('./PCO_File.dll','file'))
   delete('./PCO_File.dll');
  end
  if(exist('../runtime/bin/PCO_File.dll','file'))
   copyfile('../runtime/bin/PCO_File.dll','./');
  end

 elseif(strcmp(computer('arch'),'win64'))

  if(exist('./sc2_cam.dll','file'))
   delete('./sc2_cam.dll');
  end
  if(exist('../runtime/bin64/sc2_cam.dll','file'))
   copyfile('../runtime/bin64/sc2_cam.dll','./');
  end

  if(exist('./sc2_cl_me4.dll','file'))
   delete('./sc2_cl_me4.dll');
  end
  if(exist('../runtime/bin64/sc2_cl_me4.dll','file'))
   copyfile('../runtime/bin64/sc2_cl_me4.dll','./');
  end

  if(exist('./sc2_cl_nat.dll','file'))
   delete('./sc2_cl_nat.dll');
  end
  if(exist('../runtime/bin64/sc2_cl_nat.dll','file'))
   copyfile('../runtime/bin64/sc2_cl_nat.dll','./');
  end

  if(exist('./sc2_cl_mtx.dll','file'))
   delete('./sc2_cl_mtx.dll');
  end
  if(exist('../runtime/bin64/sc2_cl_mtx.dll','file'))
   copyfile('../runtime/bin64/sc2_cl_mtx.dll','./');
  end

  if(exist('./sc2_clhs.dll','file'))
   delete('./sc2_clhs.dll');
  end
  if(exist('../runtime/bin64/sc2_clhs.dll','file'))
   copyfile('../runtime/bin64/sc2_clhs.dll','./');
  end

  if(exist('./PCO_Recorder.dll','file'))
   delete('./PCO_Recorder.dll');
  end
  if(exist('../runtime/bin64/PCO_Recorder.dll','file'))
   copyfile('../runtime/bin64/PCO_Recorder.dll','./');
  end

  if(exist('./PCO_File.dll','file'))
   delete('./PCO_File.dll');
  end
  if(exist('../runtime/bin64/PCO_File.dll','file'))
   copyfile('../runtime/bin64/PCO_File.dll','./');
  end

 else
  error('This platform is not supported');
 end


classdef MimOutputInfo
    % MimOutputInfo. A structure for holding information related to output files
    %
    %
    %     Licence
    %     -------
    %     Part of the TD MIM Toolkit. https://github.com/tomdoel
    %     Author: Tom Doel, Copyright Tom Doel 2014.  www.tomdoel.com
    %     Distributed under the MIT licence. Please see website for details.
    %

    properties
        Filenames
        Description
        DateCreated
        PluginName
    end

    methods
        function obj = MimOutputInfo(plugin_name, description, filenames, date)
            if nargin > 0
                obj.Filenames = filenames;
                obj.Description = description;
                obj.DateCreated = date;
                obj.PluginName = plugin_name;
            end
        end
    end
end


%SIGN Datafile overload