Unverified Commit b000659a authored by jayd1860's avatar jayd1860 Committed by GitHub
Browse files

v1.35.11 - Clearly display in MainGUI and DataTree the data files that were...

v1.35.11 - Clearly display in MainGUI and DataTree the data files that were NOT loaded because of errors (#128)

* v1.35.8

-- Clearly display in MainGUI and DataTree the data files that were NOT loaded because of errors and more clearly display in the logging the ones that were loaded and the ones. In MainGUI display data files NOT loaded in separate listbox window with red font. Clicking on any one of the error files displays error that kept it from loading.

-- Replace version number display for shared libraries with last revision date/time.

-- Improve and clean up code in syncSubmodules tool:
   a) Use last revision date/time instead of version number to sync shared libs.
   b) Warn user of uncommitted changes when syncing files in syncSubmodules.m
   c) Do a general code clean up

* v1.35.9

-- Get rid of version numbers and version files from shared libraries. Instead generate last rev date on the fly and display that (this only applies to git repos, for unzipped code just display lib name).

* v1.35.10

-- Fix error loading SNIRF aux.name field in AuxClass because of changes to MATLAB's HDF5 library. (It seems for string there is no need to transpose the data.)

* v1.35.11

-- Fix minor display issue on MAC where the file search window does NOT display title showing the purpose of the window ("Load Processing Options File"). Use alternative file search GUI (only on MAC) which displays Window title and allows user to select *.cfg file.
parent 247a02c7
Loading
Loading
Loading
Loading
+48 −5
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ classdef DataFilesClass < handle
    
    properties
        files;
        filesErr;
        filetype;
        dirFormats;
        err;
@@ -21,6 +22,7 @@ classdef DataFilesClass < handle
        % ----------------------------------------------------
        function obj = DataFilesClass(varargin)            
            obj.files = FileClass.empty();
            obj.filesErr = FileClass.empty();
            obj.filetype = '';
            obj.rootdir = pwd;
            obj.nfiles = 0;
@@ -116,15 +118,15 @@ classdef DataFilesClass < handle
                obj.InitLookupTable();
                obj.FindDataSet(ii);
                
                % Remove any files that cannot pass the basic test of loading
                % its data
                obj.ErrorCheck();
                if ~isempty(obj.files)
                    break
                end
            end
            
            % Remove any files that cannot pass the basic test of loading
            % its data
            obj.ErrorCheckName();
            obj.ErrorCheckFinal();
        end

        
@@ -290,6 +292,41 @@ classdef DataFilesClass < handle
        
        
        
        % ----------------------------------------------------
        function ErrorCheckFinal(obj)
            obj.ErrorCheckName();
            
            % Find all acquisition files in group folder
            fileNames = findTypeFiles(obj.rootdir, ['.', obj.filetype]);
            
            % Make alist of all files excluded from current data set  
            for ii = 1:length(fileNames)
                filefound = false;
                
                for jj = 1:length(obj.files)
                    if pathscompare(fileNames{ii}, [obj.rootdir, obj.files(jj).name])
                        filefound = true;
                        break;
                    end
                end
                
                for jj = 1:length(obj.filesErr)
                    if pathscompare(fileNames{ii}, [obj.rootdir, obj.filesErr(jj).name])
                        filefound = true;
                        break;
                    end
                end
                
                if ~filefound
                    obj.filesErr(end+1) = FileClass(fileNames{ii});
                    obj.filesErr(end).SetError('Invalid File Name');
                end
            end
        
        end
        
        
        
        % --------------------------------------------------------------------------
        function answer = AskToFixNameConflicts(obj, ii)
            global cfg
@@ -426,7 +463,7 @@ classdef DataFilesClass < handle
                filename = [obj.files(ii).rootdir, obj.files(ii).name];
                eval( sprintf('o = %s(filename);', constructor) );
                if o.GetError()<0
                    obj.logger.Write('FAILED error check:   %s will not be added to data set\n', filename);
                    obj.logger.Write('DataFilesClass.ErrorCheck:   FAILED error check - %s will not be added to data set\n', filename);
                    errorIdxs = [errorIdxs, ii]; %#ok<AGROW>
                else
                    dataflag = true;
@@ -435,7 +472,12 @@ classdef DataFilesClass < handle
            if dataflag==false
                obj.files = FileClass.empty();
            else
                for jj = 1:length(errorIdxs)
                    obj.filesErr(end+1) = obj.files(errorIdxs(jj)).copy;
                    obj.filesErr(end).SetError('Invalid Data Format');
                end
            	obj.files(errorIdxs) = [];
                obj.nfiles = obj.nfiles - length(errorIdxs);
            end
        end
        
@@ -518,5 +560,6 @@ classdef DataFilesClass < handle
            b = obj.lookupTable(string2hash(str, n));
        end
        
        
    end
end
+18 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ classdef FileClass < matlab.mixin.Copyable
        rootdir
        err
        logger
        errmsgs
    end
    
    methods
@@ -39,6 +40,8 @@ classdef FileClass < matlab.mixin.Copyable
            obj.rootdir    = '';
            obj.err        = -1;          % Assume file is not loadable
            obj.logger     = InitLogger(logger);            
            obj.errmsgs    = {'Invalid Data Format','Invalid File Name'};
            
            
            if nargin==0
                return;
@@ -535,6 +538,20 @@ classdef FileClass < matlab.mixin.Copyable
        end
        
        
        % -----------------------------------------------------
        function err = SetError(obj, err)
            if ischar(err)
                err = find(strcmp(obj.errmsgs, err));
            end
            obj.err = err;
        end
        
        
        % -----------------------------------------------------
        function msg = GetErrorMsg(obj)
            msg = obj.errmsgs{abs(obj.err)};
        end
        
    end
  
end
 No newline at end of file
+0 −3
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ while files.IsEmpty()
                if nfolders==0
                    nfolders = 1;
                end
                fprintf('FindFiles: Found %d .nirs data files in %d folders\n', filesSrc.nfiles, nfolders);
            end
            
            % Search for source acquisition files in .nirs format which have not
@@ -134,8 +133,6 @@ while files.IsEmpty()
        cd(dirnameGroup)
    end
    
    fprintf('FindFiles: Found %d %s data files in %d folders\n', files.nfiles, fmt, length(files.files)-files.nfiles);
    
end


+2 −2
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@ end
% with the file format's storage order.
if ~isrow(val) && ~iscolumn(val)            % Matrices
    val = permute(val, ndims(val):-1:1);
elseif ischar(val)                          % 1D char strings 
    val = permute(val, ndims(val):-1:1);
% elseif ischar(val)                          % 1D char strings 
%     val = permute(val, ndims(val):-1:1);
elseif ~isempty(findstr('multidim', options))   % Force multi-dimensional even if vector
    val = permute(val, ndims(val):-1:1);
elseif ~isempty(findstr('2D', options))         % Force 2D even if vector
+29 −37
Original line number Diff line number Diff line
@@ -261,15 +261,9 @@ classdef DataTreeClass < handle
                        iter = iter+1;
                    end                    
                    obj.files = dataInit.files;
                    obj.filesErr = dataInit.filesErr;

                    obj.logger.Write('\n');

                    % Print file and folder numbers stats
                    nfolders = length(dataInit.files)-dataInit.nfiles;
                    if nfolders==0
                        nfolders = 1;
                    end
                    obj.logger.Write('DataTreeClass.FindAndLoadGroups: Found %d data files in %d folders\n', dataInit.nfiles, nfolders);
                    obj.PrintDatasetFormat(dataInit);
                    
                    % Now load group files to data tree
                    obj.LoadGroup(iGroupNew, procStreamCfgFile, options);
@@ -449,7 +443,7 @@ classdef DataTreeClass < handle
                group.SetIndexID(jj);
                obj.groups(jj) = group;
                obj.groups(jj).SetPath(obj.dirnameGroups{jj})
                obj.logger.Write('Added group %s to dataTree.\n', obj.groups(jj).GetName);
                obj.logger.Write('Added group  "%s"  to dataTree.\n', obj.groups(jj).GetName);
            end

            % Add subj, sess and run to group
@@ -459,12 +453,15 @@ classdef DataTreeClass < handle
        
        % ----------------------------------------------------------
        function ErrorCheckLoadedFiles(obj)
            for iF=length(obj.files):-1:1
                if ~obj.files(iF).Loadable() && obj.files(iF).IsFile()
                    obj.filesErr(end+1) = obj.files(iF).copy;
                    obj.files(iF) = [];
            if isempty(obj.filesErr)
                return
            end
            obj.logger.Write('\n')
            obj.logger.Write('DataTreeClass.ErrorCheckLoadedFiles:   WARNING - The following files in this data set were NOT loaded:\n')
            for iF = 1:length(obj.filesErr)
                obj.logger.Write('   %s\n', obj.filesErr(iF).name)
            end
            obj.logger.Write('\n')
        end
        
        
@@ -679,29 +676,24 @@ classdef DataTreeClass < handle
        end

        
        % ----------------------------------------------------------
        function PrintFolderStructure(obj, options)
            if ~exist('options','var')
                options = '';
        % -----------------------------------------------------------
        function PrintDatasetFormat(obj, dataInit)
            
            % Print file and folder numbers stats
            nfolders = length(dataInit.files)-dataInit.nfiles;
            if nfolders==0
                nfolders = 1;
            end
            stepsize = 3;
            numFilesMsg = sprintf('with %d data files in %d folders\n', dataInit.nfiles, nfolders);
            obj.logger.Write('\n');
            obj.logger.Write('DataTreeClass - Data Set Folder Structure:\n');
            for ii = 1:length(obj.files)
                k = length(find(obj.files(ii).name=='/'));   
                if ii<10, j=3; elseif ii>9 && ii<100, j=2; else j=3; end %#ok<*SEPEX>
                if optionExists(options, 'flat')
                    obj.logger.Write('%d.%s%s\n', ii, blanks(j), obj.files(ii).name);
                else
                    if ii<10, j=3; elseif ii>9 && ii<100, j=2; else j=3; end
                    if optionExists(options, 'numbered')
                        n = k*stepsize+stepsize+j;
                        obj.logger.Write('%d.%s%s\n', ii, blanks(n), obj.files(ii).filename);
                    else
                        n = k*stepsize+stepsize;
                        obj.logger.Write('%s%s\n', blanks(n), obj.files(ii).filename);
                    end
                end
            if dataInit.nfiles == 0
                obj.logger.Write('DataTreeClass.FindAndLoadGroups:   Did not find any data0 files %s.\n', numFilesMsg);
            elseif dataInit.dirFormats.type > 3 && dataInit.dirFormats.type < 9
                obj.logger.Write('DataTreeClass.FindAndLoadGroups:   Found BIDS data set %s.\n', numFilesMsg);
            elseif dataInit.dirFormats.type < 4
                obj.logger.Write('DataTreeClass.FindAndLoadGroups:   Found non-standard format set %s.\n', numFilesMsg);
            elseif dataInit.dirFormats.type > 8
                obj.logger.Write('DataTreeClass.FindAndLoadGroups:   Found non-standard but BIDS-like data set %s.\n', numFilesMsg);
            end
            obj.logger.Write('\n');
        end
Loading