Commit 4885f3de authored by jayd1860's avatar jayd1860
Browse files

v1.44.0

-- Fix ordering issue with active/inactive (mlAct) channels in user functions and MainGUI display. Use sources, detectors, wavelength matrix rather than a logical vector.
-- When manually pruning channel only prune at the current wavelength.
-- Implement missing application of active/inactive (mlAct) channels at the higher averaging user functions: hmrE_RunAvg.m, hmrG_SubjAvg.m, hmrS_SessAvg.m
-- Fix incorrect nTrials calculation at the group level
-- Fix PlotProbeGUI/plotProbe.m display issue as a result of fixing the MeasList ordering issue.
parent ea939423
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -6,16 +6,20 @@ if ~exist('options','var')
    options = 'sort';
end
rootdir = filesepStandard(rootdir);
files = DataFilesClass(pwd, 'snirf');
files = DataFilesClass(rootdir, 'snirf');
files = files.files;
for ii = 1:length(files)
    fname = filesepStandard([rootdir, files(1).name]);
    if files(ii).IsDir()
        continue
    end
    fname = filesepStandard([files(ii).rootdir, files(ii).name]);    
    s = SnirfClass(fname);
    n = NirsClass(s);
    if optionExists(options, 'sort')
        n.SortData();
    end
    [pname, fname] = filesepStandard(fname);
    fnameNew = [pname, fname, '.nirs'];
    [pname, fname] = fileparts(fname);
    fnameNew = [filesepStandard(pname), fname, '.nirs'];
    fprintf('Converting %s to %s\n', fname, fnameNew)
    n.Save(fnameNew);
end
+2 −2
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ classdef NirsClass < AcqDataClass & FileLoadSaveClass
        
        % ---------------------------------------------------------
        function SortData(obj)
            [obj.SD.MeasList, order] = sortrows(obj.SD.MeasList,4);
            [obj.SD.MeasList, order] = sortrows(obj.SD.MeasList);
            obj.d = obj.d(:,order);
            [obj.SD.MeasList, order] = sortrows(obj.SD.MeasList,4);
            obj.d = obj.d(:,order);
@@ -1046,7 +1046,7 @@ classdef NirsClass < AcqDataClass & FileLoadSaveClass
        
        
        % ----------------------------------------------------------------------------------
        function b = CopyProbe(obj, SD)            
        function CopyProbe(obj, SD)            
            fields = propnames(obj.SD);
            for ii = 1:length(fields)
                if eval( sprintf('isfield(SD, ''%s'')', fields{ii}) )
+23 −2
Original line number Diff line number Diff line
@@ -386,8 +386,30 @@ classdef DataClass < FileLoadSaveClass
        
        
        % ---------------------------------------------------------
        function ml = GetMeasurementList(obj)
        function ml = GetMeasurementList(obj, option)
            if ~exist('option','var')
                option = '';
            end            
            hbTypes         = {'hbo','hbr','hbt'};
            if isempty(option)
            ml = obj.measurementList;
            elseif strcmp(option,'matrix')                
                ml = zeros(length(obj.measurementList),4);
                for ii = 1:length(obj.measurementList)
                    k = 0;
                    for jj = 1:length(hbTypes)
                        if ~isempty(strfind(lower(obj.measurementList(ii).dataTypeLabel), hbTypes{jj}))
                            k = jj;
                            break;
                        end
                    end
                    if obj.measurementList(ii).wavelengthIndex > 0
                        ml(ii,:) = [obj.measurementList(ii).sourceIndex, obj.measurementList(ii).detectorIndex, obj.measurementList(ii).dataTypeIndex, obj.measurementList(ii).wavelengthIndex];
                    elseif k > 0
                        ml(ii,:) = [obj.measurementList(ii).sourceIndex, obj.measurementList(ii).detectorIndex, obj.measurementList(ii).dataTypeIndex, k];                        
                    end
                end
            end
        end
        
        
@@ -483,7 +505,6 @@ classdef DataClass < FileLoadSaveClass
                                    iSrcDetPair = find(ml(:,1)==srcs(iS) & ml(:,2)==dets(iD));
                                    d(:, iWl, iSrcDetPair) = obj.dataTimeSeries(:,ii); %#ok<*FNDSB>
                                    
                                    
                                    order(kk) = ii;
                                    kk = kk+1;
                                    break;
+6 −2
Original line number Diff line number Diff line
@@ -299,14 +299,18 @@ classdef DataTreeClass < handle
                banner = '';
            end
            obj.logger.Write('\n');
            if ~isempty(banner)
            	obj.logger.Write('============================================\n');
            end
            if ~isempty(banner)
                obj.logger.Write('%s', banner);
                obj.logger.Write('\n');
                obj.logger.Write('\n');
            end
            obj.groups(1).PrintProcStream();
            if ~isempty(banner)
            	obj.logger.Write('============================================\n');
            end
            obj.logger.Write('\n');
        end
        
+4 −0
Original line number Diff line number Diff line
@@ -337,6 +337,10 @@ classdef ProcResultClass < handle
                return;
            end            
            
            if ~ispathvalid([filename, '.mat'], 'file')
                return
            end
            
            % Free memory for this object
            obj.Initialize();
        end
Loading