function varargout=dopSaveDirDescription(varargin)
% dopOSCCI Mark II: dopSaveDirDescription ~ 13-8-2010 (last edit)
%
% create a description of the particular summary based on the parameters
% being run.  If multiple channels, then vary the output as the different
% channels might have different parameters and extra numbers in the
% defintion list
%
% global dsd

% -------------------------------------------------------------------------
%     'dopOSCCI' summarises functional transcranial Doppler ultrasonography
%     (fTCD) data.  The primary function of the software is to assess the
%     hemispheric lateralization of cognitive function.
%
%     Copyright (C) 2011 the Chancellor, Masters and Scholars of the
%     University of Oxford.
% 
%     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/> 
%     or write to the Free Software Foundation, Inc., 51 Franklin Street,
%     Fifth Floor, Boston, MA 02110-1301, USA.
%
%     Authors: Nic Badcock, Georgina Holt, Anneka Holden, & Dorothy Bishop.
%       contact: nicholas.badcock@gmail.com
%
%     Type 'dopOSCCIlicense' for license details or see dopOSCCIlicense.txt
%
try
    fprintf('%s\n',['Running ',mfilename]);
    inputs.varargin=varargin;
    inputs.turnOn={'test','epoch','base','poi','trials','sep',...
        'actWin','actRej','downHertz'};
    inputs.turnOff={};
    inputs.defaults=struct('descrip',[],...
        'def',[]); % definition structure from dopTaskDef
    dsd=setGetInputsStruct(inputs); % also returns dsd.setGet.settings = list of inputs
    % dsd.setGet.settings={'base','epoch','poi','trials','trialSeparation',...
    %     'actWin','actRej','hertz'};
    %               trials: 12
    %               epoch: [-10 20]
    %                base: [-10 0]
    %     trialSeparation: 40
    %                 poi: [8 18]
    %              actWin: 2
    %              actRej: [70 140]
    %               hertz: 25
    
    if isempty(dsd.descrip)
        %% create description
        for i=1:length(dsd.setGet.list)
            dsd.tmp.tn=dsd.setGet.list{i}; % temp name
            if ~sum(strcmp(dsd.tmp.tn,{'descrip','def','test'}))
                if dsd.(dsd.tmp.tn)
                    dsd.tmp.sf='_'; % start fill
                    if isempty(dsd.descrip)
                        dsd.tmp.sf='';
                    end
                    dsd.tmp.tnd=dsd.def.(dsd.tmp.tn); % temp name data
                    dsd.tmp.tds=[];
                    for j=1:length(dsd.tmp.tnd)
                        dsd.tmp.tds{end+1}=num2str(dsd.def.(dsd.tmp.tn)(j)); % temp datas - plural
                    end
                    switch dsd.tmp.tn
                        case {'base','epoch','poi','actRej'}
                            dsd.tmp.descrip=[dsd.tmp.sf,dsd.tmp.tn,...
                                dsd.tmp.tds{1},'to',dsd.tmp.tds{2}];
                        case {'trials','sep','actWin','hertz'}
                            dsd.tmp.descrip=...
                                [dsd.tmp.sf,dsd.tmp.tn,dsd.tmp.tds{1}];
                    end
                    dsd.descrip=[dsd.descrip,dsd.tmp.descrip];
                end
            end
        end
        %     dsd.descrip=['base',num2str(dsd.def.base(1)),'to',num2str(dsd.def.base(2)),...
        %         '_poi',num2str(dsd.def.poi(1)),'to',num2str(dsd.def.poi(2))];
    end
    varargout{1}=dsd.descrip;
    
catch err
    save(dopOSCCIdebug(mfilename));throw(err); 
end