Commit 1cdc7bae authored by Jay Dubb's avatar Jay Dubb
Browse files

v1.27.0.1

-- Fix error when data storage scheme is 'files' (instead of 'memory') private non-SNIRF spec variables are being accessed illegally. Need to use FileLoadSaveClass methods. Part of last commit to make non-SNIRF spec variables private.
-- Add to DataTreeClass the method AutoSetDataStorageSchemesimple to determine data storage scheme automatically from the data groupResults.mat (rather than hard-coding it from AppSettings.cfg. This probably could be improved but it's a start.
parent e9697338
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ classdef SnirfClass < AcqDataClass & FileLoadSaveClass
            
            % Load mutable data from Snirf file here ONLY if data storage scheme is 'files'
            if strcmpi(obj.GetDataStorageScheme(), 'files')
                obj.LoadStim(obj.filename);
                obj.LoadStim(obj.GetFilename());
            end
            
            % Generate new instance of SnirfClass
+2 −2
Original line number Diff line number Diff line
@@ -75,9 +75,9 @@ classdef StimClass < FileLoadSaveClass
            
            % Error checking            
            if ~isempty(fileobj) && ischar(fileobj)
                obj.filename = fileobj;
                obj.SetFilename(fileobj);
            elseif isempty(fileobj)
                fileobj = obj.filename;
                fileobj = obj.GetFilename();
            end 
            if isempty(fileobj)
               err = -1;
+34 −10
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ classdef DataTreeClass < handle
            obj.dataStorageScheme = cfg.GetValue('Data Storage Scheme');

            % Estimate amount of memory required and set the data storage scheme
            obj.SetDataStorageScheme(options);
            obj.SetDataStorageScheme();
            
            obj.FindAndLoadGroups(groupDirs, fmt, procStreamCfgFile, options);
            if obj.IsEmpty()
@@ -245,16 +245,13 @@ classdef DataTreeClass < handle
        
                
        % ---------------------------------------------------------------
        function SetDataStorageScheme(obj, options)
        function SetDataStorageScheme(obj)

            % Force distrubited file saving scheme, regardless of initial
            % value of obj.dataStorageScheme
            if ~exist('options','var')
                options = '';
            end
            
            if optionExists(options, 'files')
                obj.dataStorageScheme = 'files';
            % If there is no config option that was used to set
            % dataStorageScheme then try to determine from saved data 
            % what the storage scheme is. Main user of this is AtlasViewer            
            if isempty(obj.dataStorageScheme)
                obj.AutoSetDataStorageScheme();
            end
            
            % Estimate memory requirement based on number of acquired files and their
@@ -271,6 +268,33 @@ classdef DataTreeClass < handle
        end 
        
          
        
        % ---------------------------------------------------------------
        function AutoSetDataStorageScheme(obj)
            g.group = GroupClass();
            if isvalidfile('./groupResults.mat')
                g = load('./groupResults.mat');
                if isa(g.group, 'GroupClass') && g.group.IsEmpty()
                    if isvalidfile('../groupResults.mat')
                        g = load('../groupResults.mat');
                    end
                end
            elseif isvalidfile('../groupResults.mat')
                g = load('../groupResults.mat');
            end
            if isa(g.group, 'GroupClass') && g.group.IsEmpty()
                if g.group.subjs(1).runs(1).acquired.IsEmpty()
                    obj.dataStorageScheme = 'files';
                else
                    obj.dataStorageScheme = 'memory';
                end
            else
                obj.dataStorageScheme = 'memory';
            end
        end
          
        
        
        % ---------------------------------------------------------------
        function LoadGroup(obj, iG, procStreamCfgFile)
            
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@ function vrnnum = getVernum()
vrnnum{1} = '1';   % Major version #
vrnnum{2} = '27';  % Major sub-version #
vrnnum{3} = '0';   % Minor version #
vrnnum{4} = '0';   % Minor sub-version # or patch #: 'p1', 'p2', etc
vrnnum{4} = '1';   % Minor sub-version # or patch #: 'p1', 'p2', etc