Commit 447caaba authored by jayd1860's avatar jayd1860
Browse files

v1.80.1

-- If no data files were found in group folder because all the potential ones had errors display all the files not loaded in the error files listbox instead of displaying completely empty GUI.

* DataTree, v1.15.1
-- Avoid loading snirf files from derived data folder such as derivatives/homer.
-- Error check measurement list in DataClass. Make sure that for source/detector pair the number of channels is equal to number of data types that is number of wavelengths or for derived data number of Hb types * number of conditions.

* Utils, v1.7.1
-- Avoid loading snirf files from derived data folder such as derivatives/homer. Extend excluded folders in findTypeFiles.m to check for files in derived folder
parent 72e3a8d6
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ classdef DataFilesClass < handle
    
    properties (Access = private)
        lookupTable
        excludedFolders
    end
    
    methods
@@ -38,6 +39,7 @@ classdef DataFilesClass < handle
            
            obj.logger = logger;
            obj.lookupTable = [];
            obj.excludedFolders = {};
            
            skipconfigfile = false;
            askToFixNameConflicts = [];
@@ -74,7 +76,7 @@ classdef DataFilesClass < handle
            obj.rootdir = filesepStandard(obj.rootdir,'full');           
            
            % Configuration parameters
            obj.config = struct('RegressionTestActive','','AskToFixNameConflicts',1);
            obj.config = struct('RegressionTestActive','',  'AskToFixNameConflicts',1, 'DerivedDataDir','');
            if skipconfigfile==false
                str = cfg.GetValue('Regression Test Active');
                if strcmp(str,'true')
@@ -96,6 +98,18 @@ classdef DataFilesClass < handle
                obj.config.SuppressErrorChecking = true;                
            end
            
            [p, f] = fileparts(cfg.GetValue('Output Folder Name'));
            if isempty(p)
                obj.config.DerivedDataDir = f;
            else
                obj.config.DerivedDataDir = p;
            end
            obj.excludedFolders = {...
                [obj.rootdir, obj.config.DerivedDataDir];
                [obj.rootdir, 'fw'];
                [obj.rootdir, 'imagerecon'];
                [obj.rootdir, 'anatomical'];
                };
            if nargin==0
                return;
            end
@@ -222,6 +236,14 @@ classdef DataFilesClass < handle
                return
            end
            parentdir = filesepStandard(parentdir);
            
            % Check if folder is excluded, if yes don't search there
            for ii = 1:length(obj.excludedFolders)
                if includes(parentdir, obj.excludedFolders{ii})
                    return;
                end
            end
            
            pattern = obj.dirFormats.choices{iFormat}{iPattern};
            
            dirs = mydir([parentdir, pattern], obj.rootdir);
@@ -307,7 +329,7 @@ classdef DataFilesClass < handle
            obj.ErrorCheckName();
            
            % Find all acquisition files in group folder
            fileNames = findTypeFiles(obj.rootdir, ['.', obj.filetype]);
            fileNames = findTypeFiles(obj.rootdir, ['.', obj.filetype], obj.excludedFolders);
            
            % Make a list of all files excluded from current data set  
            for ii = 1:length(fileNames)
+23 −0
Original line number Diff line number Diff line
@@ -289,6 +289,8 @@ classdef DataClass < FileLoadSaveClass
            if ~exist('params','var')
                params = propnames(obj);
            end
            
            % Check dataTimeSeries
            if ismember('dataTimeSeries',params)
                if obj.IsEmpty()
                    err = -2;
@@ -304,6 +306,8 @@ classdef DataClass < FileLoadSaveClass
                    err = 5;
                end
            end
            
            % Check time 
            if ismember('time',params)
                if isempty(obj.time)
                    err = -6;
@@ -313,6 +317,25 @@ classdef DataClass < FileLoadSaveClass
                    err = 7;
                end
            end
            
            % Check measurement list
            if ismember('measurementList',params)
                ml = sortrows(obj.GetMeasurementList('matrix'));
                nDatatypes = length(unique(ml(:,4))) * length(unique(ml(:,3)));
                i = 1;
                while i <= size(ml,1)
                    k = find(ml(:,1)==ml(i,1) & ml(:,2)==ml(i,2));
                    if length(k) < nDatatypes
                        err = -7;
                    elseif length(k) > nDatatypes
                        err = -8;
                    end
                    if err < 0
                        break
                    end
                    i = i+length(k);
                end
            end
        end
        
    end
+3 −0
Original line number Diff line number Diff line
@@ -267,6 +267,8 @@ classdef DataTreeClass < handle
                    while dataInit.GetError() < 0
                        dataInit = FindFiles(obj.dirnameGroups{kk}, fmt, options);
                        if isempty(dataInit) || dataInit.IsEmpty()
                            obj.filesErr = dataInit.filesErr;
                            ErrorCheckLoadedFiles(obj);
                            return;
                        end
                        dataInitPrev(iter) = dataInit;
@@ -374,6 +376,7 @@ classdef DataTreeClass < handle
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            obj.AcqData2Group(iGroup);
            if isempty(obj.groups)
                obj.ErrorCheckLoadedFiles();
                return
            end
                
+1 −1
Original line number Diff line number Diff line
1.15.0
 No newline at end of file
1.15.1
 No newline at end of file
+32 −8
Original line number Diff line number Diff line
@@ -84,13 +84,17 @@ function MainGUI_EnableDisableGUI(handles, val)
   
% Processing element panel
set(handles.listboxGroupTree, 'enable', val);
if strcmp(get(handles.listboxFilesErr, 'visible'), 'on')
    set(handles.listboxFilesErr, 'enable','on');
else
    set(handles.listboxFilesErr, 'enable',val);
end
set(handles.pushbuttonHideErrors, 'enable',val);
set(handles.radiobuttonProcTypeGroup, 'enable', val);
set(handles.radiobuttonProcTypeSubj, 'enable', val);
set(handles.radiobuttonProcTypeSess, 'enable', val);
set(handles.radiobuttonProcTypeRun, 'enable', val);
set(handles.textStatus, 'enable', val);
set(handles.textStatus, 'enable','on');

% Data plot panel
set(handles.textPanLeftRight, 'enable', val);
@@ -153,12 +157,17 @@ function MainGUI_EnableDisablePlotEditMode(handles, val)

% Processing element panel
set(handles.listboxGroupTree, 'enable', val);
if strcmp(get(handles.listboxFilesErr, 'visible'), 'on')
    set(handles.listboxFilesErr, 'enable','on');
else
    set(handles.listboxFilesErr, 'enable',val);
end
set(handles.textStatus, 'enable','on');
set(handles.pushbuttonHideErrors, 'enable',val);
set(handles.radiobuttonProcTypeGroup, 'enable', val);
set(handles.radiobuttonProcTypeSubj, 'enable', val);
set(handles.radiobuttonProcTypeSess, 'enable', val);
set(handles.radiobuttonProcTypeRun, 'enable', val);
set(handles.textStatus, 'enable', val);

% Control
set(handles.pushbuttonCalcProcStream, 'enable', val);
@@ -246,6 +255,7 @@ maingui.childguis(6) = ChildGuiClass('configSettingsGUI');
% Load date files into group tree object
maingui.dataTree = LoadDataTree(maingui.groupDirs, maingui.format, procStreamFile);
if maingui.dataTree.IsEmpty()
    DisplayGroupTree(handles);
    return;
end
if ~isempty(maingui.unitTest)
@@ -379,13 +389,16 @@ maingui.listboxGroupTreeParams = struct('listMaps',struct('names',{{}}, 'idxs',
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Determine the best view for the data files 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[viewSetting, views] = SetView(handles, nSubjs, nSess, nRuns);
[viewSetting, ~] = SetView(handles, nSubjs, nSess, nRuns);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set listbox used for displaying valid data
% Get the GUI listboxGroupTree setting 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
listboxGroup = {};
if viewSetting <= length(maingui.listboxGroupTreeParams.listMaps)
    listboxGroup = maingui.listboxGroupTreeParams.listMaps(viewSetting).names;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set listbox used for displaying files that did not load correctly
@@ -417,8 +430,16 @@ if ~isempty(handles)
    if nFilesFailed > 0 || nFilesWarning > 0
        set(handles.textStatus, 'foregroundcolor',maingui.errcolor);
        if nFilesFailed > 0
            set(handles.listboxFilesErr, 'visible','on', 'value',1, 'string',listboxFilesErr)
            set(handles.listboxFilesErr, 'visible','on', 'enable','on','value',1, 'string',listboxFilesErr)
            set(handles.pushbuttonHideErrors, 'visible','on');
            if nFileSuccess==0
                set(handles.pushbuttonHideErrors, 'visible','off');
                p1 = get(handles.listboxGroupTree, 'position');
                p2 = get(handles.listboxFilesErr, 'position');
                offset_y = p1(4)/2;
                set(handles.listboxGroupTree, 'position',[p1(1), p1(2)+offset_y, p1(3), offset_y])
                set(handles.listboxFilesErr, 'position',[p2(1), p2(2), p2(3), p2(4)+offset_y])
            end
        else
            set(handles.listboxFilesErr, 'visible','off');
            set(handles.pushbuttonHideErrors, 'visible','off');
@@ -436,6 +457,9 @@ if ~isempty(handles)
        set(handles.listboxGroupTree, 'position', [pos1(1) pos2(2) pos1(3) .98-pos2(2)]);
    end
end
if nFileSuccess==0
    return
end

% Select initial data tree processing element in the 'Current Processing Element' panel
idx = [1,1,1,1];
Loading