Commit f0db636d authored by jayd1860's avatar jayd1860
Browse files

v1.16

-- Add export HRF capability and MainGUI menu option
-- Minor renaming of GuiOutsideScreenBorders to guiOutsideScreenBorders for naming consistency
parent 1ec259b4
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -597,6 +597,26 @@ classdef GroupClass < TreeNodeClass
            fprintf('Completed saving groupResults.mat in %0.3f seconds.\n', toc(t_local));
        end
        
        
        
        % ----------------------------------------------------------------------------------
        function ExportHRF(obj, options, iBlk)
            if nargin<2
                options = 'current';
            end
            if nargin<3
                iBlk = 1;
            end
            
            obj.procStream.ExportHRF(obj.name, obj.CondNames, iBlk)
            if strcmp(options, 'all')
                for ii=1:length(obj.subjs)
                    obj.subjs(ii).ExportHRF('all', iBlk)
                end
            end
        end
                
        
    end  % Public Save/Load methods
        
    
+60 −1
Original line number Diff line number Diff line
@@ -504,6 +504,65 @@ classdef ProcResultClass < handle
            end
        end
        
        
        % ----------------------------------------------------------------------------------
        function ExportHRF(obj, filename, CondNames, iBlk)
            if nargin<3
                iBlk = 1;
            end
                        
            % Max column width in number ois characters
            maxcolwidth = 12;
            
            [pname, fname] = fileparts(filename);
            ext = '_HRF.txt';
            
            fd = fopen([pname, fname, ext], 'wt');
            
            fprintf(fd, '%s: exported HRF data\n', fname);
            fprintf('%s: exported HRF data\n', fname);
            
            if isa(obj.dcAvg, 'DataClass')
                dataTimeSeries = obj.dcAvg.GetDataTimeSeries();
                measList = obj.dcAvg.measurementList;
                
                % Header: stim condition
                for iCh=1:length(measList)
                    stim_cond_str = sprintf('%s', CondNames{measList(iCh).dataTypeIndex});
                    nspaces = round((maxcolwidth - length(stim_cond_str)));
                    fprintf(fd, '%s%s\t', blanks(nspaces), stim_cond_str);
                end
                fprintf(fd, '\n');
                
                % Header: Hb type row
                for iCh=1:length(measList)
                    hb_sd_str = sprintf('%s,%d,%d', measList(iCh).dataTypeLabel, measList(iCh).sourceIndex, measList(iCh).detectorIndex);
                    nspaces = round((maxcolwidth - length(hb_sd_str)));
                    fprintf(fd, '%s%s\t', blanks(nspaces), hb_sd_str);
                end
                
                fprintf(fd, '\n');
                        
                % Data rows
                for t=1:size(dataTimeSeries,1)
                    for iCh=1:length(measList)
                        if isnan(dataTimeSeries(t,iCh))
                            nspaces = round((maxcolwidth - length('NaN')));
                        else
                            nspaces = dataTimeSeries(t,iCh)>=0;
                        end
                        fprintf(fd, '%s%0.5e\t', blanks(nspaces), dataTimeSeries(t,iCh));
                    end
                    fprintf(fd, '\n');
                end
                fprintf(fd, '\n\n');            
            end
            
            fclose(fd);
        end

    end
    
    end
    
+16 −3
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ classdef ProcStreamClass < handle
                % remove '[', ']', and ','
                foos = obj.fcalls(iFcall).argOut.str;
                for ii=1:length(foos)
                    if foos(ii)=='[' | foos(ii)==']' | foos(ii)==',' | foos(ii)=='#'
                    if foos(ii)=='[' || foos(ii)==']' || foos(ii)==',' || foos(ii)=='#'
                        foos(ii) = ' ';
                    end
                end
@@ -230,7 +230,7 @@ classdef ProcStreamClass < handle
                    foo2 = foos(lst(ii)+1:lst(ii+1)-1);
                    lst2 = strmatch( foo2, paramOut, 'exact' );
                    idx = strfind(foo2,'foo');
                    if isempty(lst2) & (isempty(idx) || idx>1) & ~isempty(foo2)
                    if isempty(lst2) && (isempty(idx) || idx>1) && ~isempty(foo2)
                        paramOut{end+1} = foo2;
                    end
                end
@@ -340,6 +340,19 @@ classdef ProcStreamClass < handle
        end
        
        
        % ----------------------------------------------------------------------------------
        function ExportHRF(obj, filename, CondNames, iBlk)
            if nargin<3
                iBlk = 1;
            end
            obj.output.ExportHRF(filename, CondNames, iBlk)
        end

    end
    
    
    
    methods
        
        % ----------------------------------------------------------------------------------
        function [args, type] = GetInputArgs(obj, iFcall)
@@ -388,7 +401,7 @@ classdef ProcStreamClass < handle
            end            
            for iP = 1:nParam
                p{iP} = obj.fcalls(iFcall).paramIn(iP).value;
                if length(obj.fcalls(iFcall).argIn.str)==1 & iP==1
                if length(obj.fcalls(iFcall).argIn.str)==1 && iP==1
                    sargin = sprintf('%sp{%d}', sargin, iP);
                    if isnumeric(p{iP})
                        if length(p{iP})==1
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ classdef RunClass < TreeNodeClass
        end
        
                
        
        % ----------------------------------------------------------------------------------
        % Deletes derived data in procResult
        % ----------------------------------------------------------------------------------
@@ -107,6 +106,7 @@ classdef RunClass < TreeNodeClass
            end
        end

        
        % ----------------------------------------------------------------------------------
        % Copy processing params (procInut and procResult) from
        % N2 to N1 if N1 and N2 are same nodes
+18 −0
Original line number Diff line number Diff line
@@ -424,6 +424,24 @@ classdef SubjClass < TreeNodeClass
            end
        end

        
        % ----------------------------------------------------------------------------------
        function ExportHRF(obj, options, iBlk)
            if nargin<2
                options = 'current';
            end
            if nargin<3
                iBlk = 1;
            end

            obj.procStream.ExportHRF(obj.name, obj.CondNames, iBlk)
            if strcmp(options, 'all')
                for ii=1:length(obj.runs)
                    obj.runs(ii).ExportHRF(iBlk)
                end
            end
        end
        
    end
        
    
Loading