Skip to content

Commit 696e73b

Browse files
committed
v1.9.2
-- Made displaying of rejected stims work in data axes of main GUI. -- Added motion correction unit test -- Cleaned up, streamlined and improved many aspects of unit testing.
1 parent c553884 commit 696e73b

37 files changed

+547
-257
lines changed

DataTree/DataFiles/DeleteSnirfFiles.m

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function DeleteSnirfFiles(snirffiles0)
2+
3+
if ~exist('snirffiles0','var')
4+
snirffiles0 = SnirfFilesClass().files;
5+
end
6+
7+
snirffiles = mydir('');
8+
if iscell(snirffiles0)
9+
for ii=1:length(snirffiles0)
10+
snirffiles(ii) = mydir(snirffiles0{ii});
11+
end
12+
elseif ischar(snirffiles0)
13+
snirffiles = mydir(snirffiles0);
14+
elseif isa(snirffiles0, 'FileClass')
15+
snirffiles = snirffiles0;
16+
end
17+
18+
for ii=1:length(snirffiles)
19+
if snirffiles(ii).isdir
20+
continue;
21+
end
22+
fprintf('Deleting %s\n', [snirffiles(ii).pathfull, '/', snirffiles(ii).filename]);
23+
delete([snirffiles(ii).pathfull, '/', snirffiles(ii).filename]);
24+
pause(0.25);
25+
end
26+

DataTree/GroupClass.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function Load(obj)
327327

328328
% ----------------------------------------------------------------------------------
329329
function Save(obj, options)
330-
if ~exist('optionsstr','var')
330+
if ~exist('options','var')
331331
options = 'acquired:derived';
332332
end
333333
options_s = obj.parseSaveOptions(options);

DataTree/ProcStream/FuncCallClass.m

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ function Copy(obj, obj2, reg)
105105
end
106106

107107

108+
% ------------------------------------------------------------
109+
function idx = GetParamIdx(obj, key)
110+
idx = [];
111+
if ~exist('key','var') || isempty(key)
112+
key=1;
113+
end
114+
if ischar(key)
115+
for ii=1:length(obj.paramIn)
116+
if strcmp(key, obj.paramIn(ii).name)
117+
idx=ii;
118+
break;
119+
end
120+
end
121+
elseif iswholenum(key) && (key <= length(obj.paramIn))
122+
idx = key;
123+
end
124+
end
125+
126+
108127
% ------------------------------------------------------------
109128
function phelp = GetParamHelp(obj, key)
110129
phelp = '';
@@ -450,25 +469,6 @@ function AddUsageInfo(obj, reg)
450469
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
451470
methods (Access = 'private')
452471

453-
% ------------------------------------------------------------
454-
function idx = GetParamIdx(obj, key)
455-
idx = [];
456-
if ~exist('key','var') || isempty(key)
457-
key=1;
458-
end
459-
if ischar(key)
460-
for ii=1:length(obj.paramIn)
461-
if strcmp(key, obj.paramIn(ii).name)
462-
idx=ii;
463-
break;
464-
end
465-
end
466-
elseif iswholenum(key) && (key <= length(obj.paramIn))
467-
idx = key;
468-
end
469-
end
470-
471-
472472
end
473473
end
474474

DataTree/ProcStream/ProcInputClass.m

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
CondName2Subj; % Used by group processing stream
99
CondName2Run; % Used by subject processing stream
1010
tIncMan; % Manually include/excluded time points
11+
stimValSettings; % Derived stim values
1112
misc;
1213
changeFlag; % Flag specifying if procInput+acquisition data is out
1314
% of sync with procResult (currently not implemented)
@@ -26,6 +27,7 @@
2627
obj.misc = [];
2728
obj.changeFlag = 0;
2829
obj.config = struct('procStreamCfgFile','');
30+
obj.stimValSettings = struct('none',0, 'incl',1, 'excl_manual',-1, 'excl_auto',-2);
2931
if nargin==0
3032
return;
3133
end
@@ -353,13 +355,31 @@ function LoadVars(obj, vars)
353355
eval( sprintf('obj.misc.%s = vars.%s;', fields{ii}, fields{ii}) );
354356
end
355357
end
356-
358+
359+
end
360+
361+
362+
363+
methods
364+
365+
% ----------------------------------------------------------------------------------
366+
function vals = GetStimValSettings(obj)
367+
vals = obj.stimValSettings;
368+
end
369+
370+
371+
% ----------------------------------------------------------------------------------
372+
function s = GetStims(obj)
373+
s = [];
374+
end
375+
357376

358377
% ----------------------------------------------------------------------------------
359378
function SetTincMan(obj, val)
360379
obj.tIncMan = val;
361380
end
362-
381+
382+
363383
% ----------------------------------------------------------------------------------
364384
function val = GetTincMan(obj)
365385
val = obj.tIncMan;

DataTree/RunClass.m

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
obj.acquired = SnirfClass(obj.name);
3535
end
3636
obj.CondName2Group = [];
37-
obj.Load();
37+
obj.Load();
3838
end
39-
39+
4040

4141

4242
% ----------------------------------------------------------------------------------
@@ -255,9 +255,17 @@ function SetStims_MatInput(obj,s,t,CondNames)
255255

256256
% ----------------------------------------------------------------------------------
257257
function s = GetStims(obj)
258+
% First look in derived data, then acquired
259+
260+
% Proc stream output
258261
s = obj.procStream.output.GetStims();
259262
if isempty(s)
260-
s = obj.acquired.GetStims();
263+
% Proc stream input
264+
s = obj.procStream.input.GetStims();
265+
if isempty(s)
266+
% Acquired data
267+
s = obj.acquired.GetStims();
268+
end
261269
end
262270
end
263271

@@ -436,6 +444,13 @@ function RenameCondition(obj, oldname, newname)
436444
obj.acquired.RenameCondition(oldname, newname);
437445
end
438446

447+
448+
% ----------------------------------------------------------------------------------
449+
function vals = GetStimValSettings(obj)
450+
vals = obj.procStream.input.GetStimValSettings();
451+
end
452+
453+
439454
end
440455

441456
end

Homer3.m

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -831,52 +831,46 @@ function DisplayStim(handles)
831831

832832
%%% Plot stim marks. This has to be done before plotting exclude time
833833
%%% patches because stim legend doesn't work otherwise.
834-
if ~isempty(procElem.GetStims())
835-
t = procElem.acquired.GetTime();
836-
s = procElem.acquired.GetStims();
837-
838-
% Plot included and excluded stims
839-
yrange = GetAxesYRangeForStimPlot(hAxes);
840-
hLg=[];
841-
idxLg=[];
842-
kk=1;
843-
CondColTbl = procElem.CondColTbl;
844-
for iS = 1:size(s,2)
845-
iCond = procElem.CondName2Group(iS);
846-
lstS = find(s(:,iS) ~= 0);
847-
lstExclS_Auto = [];
848-
lstExclS_Man = find(s(:,iS) == -1);
849-
850-
for iS2=1:length(lstS)
851-
if ~isempty(find(lstS(iS2) == lstExclS_Auto))
852-
hl = plot(t(lstS(iS2))*[1 1],yrange,'-.');
853-
set(hl,'linewidth',1);
854-
set(hl,'color',CondColTbl(iCond,:));
855-
elseif ~isempty(find(lstS(iS2) == lstExclS_Man))
856-
hl = plot(t(lstS(iS2))*[1 1],yrange,'--');
857-
set(hl,'linewidth',1);
858-
set(hl,'color',CondColTbl(iCond,:));
859-
else
860-
hl = plot(t(lstS(iS2))*[1 1],yrange,'-');
861-
set(hl,'linewidth',1);
862-
set(hl,'color',CondColTbl(iCond,:));
863-
end
864-
end
865-
866-
% Get handles and indices of each stim condition
867-
% for legend display
868-
if ~isempty(lstS)
869-
% We don't want dashed lines appearing in legend, so
870-
% we draw invisible solid stims over all stims to
871-
% trick the legend into only showing solid lines.
872-
hLg(kk) = plot(t(lstS(iS2))*[1 1],yrange,'-', 'linewidth',4, 'visible','off');
873-
set(hLg(kk),'color',CondColTbl(iCond,:));
874-
idxLg(kk) = iCond;
875-
kk=kk+1;
834+
t = procElem.GetTime();
835+
s = procElem.GetStims();
836+
stimVals = procElem.GetStimValSettings();
837+
CondColTbl = procElem.CondColTbl;
838+
839+
% Plot included and excluded stims
840+
yrange = GetAxesYRangeForStimPlot(hAxes);
841+
hLg=[];
842+
idxLg=[];
843+
kk=1;
844+
for iCond = 1:size(s,2)
845+
iCondGroup = procElem.CondName2Group(iCond);
846+
iS = find(s(:,iCond) ~= stimVals.none);
847+
for ii=1:length(iS)
848+
linestyle = '';
849+
if s(iS(ii),iCond) == stimVals.excl_auto
850+
linestyle = '-.';
851+
elseif s(iS(ii),iCond) == stimVals.excl_manual
852+
linestyle = '--';
853+
elseif s(iS(ii),iCond) == stimVals.incl
854+
linestyle = '-';
876855
end
856+
hl = plot(t(iS(ii))*[1 1], yrange, linestyle);
857+
set(hl, 'linewidth',1);
858+
set(hl, 'color',CondColTbl(iCondGroup,:));
859+
end
860+
861+
% Get handles and indices of each stim condition
862+
% for legend display
863+
if ~isempty(iS)
864+
% We don't want dashed lines appearing in legend, so
865+
% we draw invisible solid stims over all stims to
866+
% trick the legend into only showing solid lines.
867+
hLg(kk) = plot(t(iS(1))*[1 1],yrange,'-', 'linewidth',4, 'visible','off');
868+
set(hLg(kk),'color',CondColTbl(iCondGroup,:));
869+
idxLg(kk) = iCondGroup;
870+
kk=kk+1;
877871
end
878-
DisplayCondLegend(hLg, idxLg);
879872
end
873+
DisplayCondLegend(hLg, idxLg);
880874
hold off
881875
set(hAxes,'ygrid','on');
882876

@@ -888,6 +882,12 @@ function DisplayCondLegend(hLg, idxLg)
888882
dataTree = hmr.dataTree;
889883
procElem = dataTree.currElem;
890884

885+
if isempty(hLg)
886+
return;
887+
end
888+
if isempty(idxLg)
889+
return;
890+
end
891891
[idxLg, k] = sort(idxLg);
892892
CondNamesAll = procElem.CondNamesAll;
893893
if ishandles(hLg)

StimEdit/stimGUI_Display.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ function stimGUI_Display(handles)
2626
CondColTbl = stimEdit.dataTree.group.CondColTbl();
2727
t = stimEdit.dataTree.currElem.GetTime();
2828
s = stimEdit.dataTree.currElem.GetStims();
29+
stimVals = stimEdit.dataTree.currElem.GetStimValSettings();
2930

30-
[lstR,lstC] = find(abs(s)==1);
31+
[lstR,lstC] = find(abs(s) ~= stimVals.none);
3132
[lstR,k] = sort(lstR);
3233
lstC = lstC(k);
3334
nStim = length(lstR);
@@ -37,11 +38,14 @@ function stimGUI_Display(handles)
3738
hLg=[];
3839
kk=1;
3940
for ii=1:nStim
40-
if(s(lstR(ii),lstC(ii))==1)
41-
Lines(ii).handle = plot([1 1]*t(lstR(ii)), yy,'-', 'parent',handles.axes1);
42-
elseif(s(lstR(ii),lstC(ii))==-1)
43-
Lines(ii).handle = plot([1 1]*t(lstR(ii)), yy,'--', 'parent',handles.axes1);
41+
if(s(lstR(ii),lstC(ii))==stimVals.incl)
42+
linestyle = '-';
43+
elseif(s(lstR(ii),lstC(ii))==stimVals.excl_manual)
44+
linestyle = '--';
45+
elseif(s(lstR(ii),lstC(ii))==stimVals.excl_auto)
46+
linestyle = '-.';
4447
end
48+
Lines(ii).handle = plot([1 1]*t(lstR(ii)), yy, linestyle, 'parent',handles.axes1);
4549

4650
iCond = stimEdit.dataTree.currElem.CondName2Group(lstC(ii));
4751
Lines(ii).color = CondColTbl(iCond,1:3);
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)