Skip to content

Commit de02dd7

Browse files
authored
v1.79.1 -- Fix Homer3 displaying probe in 3D rather than 2D. (#177)
v1.79.0 * DataTree, v1.14.0 -- Fix Homer3 displaying probe in 3D rather than 2D. Back out changes that default to 3D in ProbeClass and NirsClass GetSrcPos and GetDetPos for ALL cases. The way it's supposed to work is probe is supposed to use 2D coordinates ONLY when being displayed in Homer3. Rest of the time default to 3D if it exists. Reason for original change is misunderstanding of what the purpose of 2D coord was which is ONLY for display * Utils, v1.5.1 -- Add ability to simulate full dataset (generateSimData.m, simulateDataTimeSeries.m) to be able to eventually do workflow unit and system tests
1 parent b69f6e6 commit de02dd7

16 files changed

+305
-161
lines changed

DataTree/AcquiredData/Nirs/NirsClass.m

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -794,14 +794,45 @@ function SetConditions(obj, CondNames)
794794

795795

796796
% ---------------------------------------------------------
797-
function srcpos = GetSrcPos(obj, ~)
797+
function srcpos = GetSrcPos(obj, options) %#ok<*INUSD>
798+
if ~exist('options','var')
799+
options = '';
800+
end
801+
if optionExists(options,'2D')
802+
if ~isempty(obj.SD.SrcPos)
798803
srcpos = obj.SD.SrcPos;
804+
else
805+
srcpos = obj.SD.SrcPos3D;
806+
end
807+
else
808+
if ~isempty(obj.SD.SrcPos3D)
809+
srcpos = obj.SD.SrcPos3D;
810+
else
811+
srcpos = obj.SD.SrcPos;
812+
end
813+
end
799814
end
800815

801816

817+
802818
% ---------------------------------------------------------
803-
function detpos = GetDetPos(obj, ~)
804-
detpos = obj.SD.DetPos;
819+
function detpos = GetDetPos(obj, options)
820+
if ~exist('options','var')
821+
options = '';
822+
end
823+
if optionExists(options,'2D')
824+
if ~isempty(obj.SD.DetPos)
825+
detpos = obj.SD.DetPos;
826+
else
827+
detpos = obj.SD.DetPos3D;
828+
end
829+
else
830+
if ~isempty(obj.SD.DetPos3D)
831+
detpos = obj.SD.DetPos3D;
832+
else
833+
detpos = obj.SD.DetPos;
834+
end
835+
end
805836
end
806837

807838

@@ -1048,12 +1079,27 @@ function RenameCondition(obj, oldname, newname)
10481079

10491080

10501081
% ----------------------------------------------------------------------------------
1051-
function SD = InitProbe(obj)
1082+
function SD = InitProbe(obj, srcpos, detpos, ml, lambda, dummypos)
1083+
if nargin<2
1084+
srcpos = [];
1085+
end
1086+
if nargin<3
1087+
detpos = [];
1088+
end
1089+
if nargin<4
1090+
ml = [];
1091+
end
1092+
if nargin<5
1093+
lambda = [];
1094+
end
1095+
if nargin<6
1096+
dummypos = [];
1097+
end
10521098
SD = struct(...
1053-
'Lambda',[], ...
1054-
'SrcPos',[], ...
1055-
'DetPos',[], ...
1056-
'DummyPos',[], ...
1099+
'Lambda',lambda, ...
1100+
'SrcPos',srcpos, ...
1101+
'DetPos',detpos, ...
1102+
'DummyPos',dummypos, ...
10571103
'SrcPos3D',[], ...
10581104
'DetPos3D',[], ...
10591105
'DummyPos3D',[], ...
@@ -1069,7 +1115,7 @@ function RenameCondition(obj, oldname, newname)
10691115
'Landmarks',obj.InitLandmarks(), ...
10701116
'Landmarks2D',obj.InitLandmarks(), ...
10711117
'Landmarks3D',obj.InitLandmarks(), ...
1072-
'MeasList',[], ...
1118+
'MeasList',ml, ...
10731119
'MeasListAct',[], ...
10741120
'SpringList',[], ...
10751121
'AnchorList',{{}}, ...

DataTree/AcquiredData/Snirf/ProbeClass.m

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -386,25 +386,49 @@ function Project_3D_to_2D(obj)
386386

387387

388388
% ---------------------------------------------------------
389-
function srcpos = GetSrcPos(obj, ~)
390-
if ~isempty(obj.sourcePos3D)
391-
srcpos = obj.sourcePos3D;
389+
function srcpos = GetSrcPos(obj, options) %#ok<*INUSD>
390+
if ~exist('options','var')
391+
options = '';
392+
end
393+
if optionExists(options,'2D')
394+
if ~isempty(obj.sourcePos2D)
395+
srcpos = obj.sourcePos2D;
396+
else
397+
srcpos = obj.sourcePos3D;
398+
end
392399
else
393-
srcpos = obj.sourcePos2D;
394-
end
400+
if ~isempty(obj.sourcePos3D)
401+
srcpos = obj.sourcePos3D;
402+
else
403+
srcpos = obj.sourcePos2D;
404+
end
405+
end
395406
end
396407

397408

409+
398410
% ---------------------------------------------------------
399-
function detpos = GetDetPos(obj, ~)
400-
if ~isempty(obj.detectorPos3D)
401-
detpos = obj.detectorPos3D;
411+
function detpos = GetDetPos(obj, options)
412+
if ~exist('options','var')
413+
options = '';
414+
end
415+
if optionExists(options,'2D')
416+
if ~isempty(obj.detectorPos2D)
417+
detpos = obj.detectorPos2D;
418+
else
419+
detpos = obj.detectorPos3D;
420+
end
402421
else
403-
detpos = obj.detectorPos2D;
404-
end
422+
if ~isempty(obj.detectorPos3D)
423+
detpos = obj.detectorPos3D;
424+
else
425+
detpos = obj.detectorPos2D;
426+
end
427+
end
405428
end
406429

407430

431+
408432
% -------------------------------------------------------
409433
function B = eq(obj, obj2)
410434
B = false;
@@ -418,7 +442,6 @@ function Project_3D_to_2D(obj)
418442
return;
419443
end
420444
if isempty(obj) && isempty(obj2)
421-
b = true;
422445
return;
423446
end
424447
if ~all(obj.wavelengths(:)==obj2.wavelengths(:))
@@ -477,6 +500,7 @@ function Project_3D_to_2D(obj)
477500
end
478501

479502

503+
480504
% ----------------------------------------------------------------------------------
481505
function nbytes = MemoryRequired(obj)
482506
nbytes = 0;
@@ -487,6 +511,7 @@ function Project_3D_to_2D(obj)
487511
end
488512

489513

514+
490515
% ----------------------------------------------------------------------------------
491516
function b = IsEmpty(obj)
492517
b = true;
@@ -501,6 +526,7 @@ function Project_3D_to_2D(obj)
501526
end
502527

503528

529+
504530
% ----------------------------------------------------------------------------------
505531
function b = IsValid(obj)
506532
b = false;

DataTree/AcquiredData/Snirf/SnirfClass.m

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,22 +1339,20 @@ function SetConditions(obj, CondNames)
13391339

13401340

13411341
% ---------------------------------------------------------
1342-
function srcpos = GetSrcPos(obj,option)
1343-
if exist('option','var')
1344-
srcpos = obj.probe.GetSrcPos(option);
1345-
else
1346-
srcpos = obj.probe.GetSrcPos();
1342+
function srcpos = GetSrcPos(obj, options)
1343+
if exist(options,'var')
1344+
options = '';
13471345
end
1346+
srcpos = obj.probe.GetSrcPos(options);
13481347
end
13491348

13501349

13511350
% ---------------------------------------------------------
1352-
function detpos = GetDetPos(obj,option)
1353-
if exist('option','var')
1354-
detpos = obj.probe.GetDetPos(option);
1355-
else
1356-
detpos = obj.probe.GetDetPos();
1351+
function detpos = GetDetPos(obj, options)
1352+
if exist(options,'var')
1353+
options = '';
13571354
end
1355+
detpos = obj.probe.GetDetPos(options);
13581356
end
13591357

13601358

DataTree/SessClass.m

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,8 @@ function SaveAcquiredData(obj)
452452

453453

454454
% ----------------------------------------------------------------------------------
455-
function probe = GetProbe(obj, option)
455+
function probe = GetProbe(obj, ~)
456456
probe = obj.runs(1).GetProbe();
457-
% for run = obj.runs
458-
% if ~(probe == run.GetProbe())
459-
% warning(['Probe ', run.name, 'differs from ', obj.runs(1).name])
460-
% end
461-
% end
462457
end
463458

464459

@@ -472,26 +467,6 @@ function SaveAcquiredData(obj)
472467
end
473468

474469

475-
% ----------------------------------------------------------------------------------
476-
function srcpos = GetSrcPos(obj,option)
477-
if exist('option','var')
478-
srcpos = obj.runs(1).GetSrcPos(option);
479-
else
480-
srcpos = obj.runs(1).GetSrcPos();
481-
end
482-
end
483-
484-
485-
% ----------------------------------------------------------------------------------
486-
function detpos = GetDetPos(obj,option)
487-
if exist('option','var')
488-
detpos = obj.runs(1).GetDetPos(option);
489-
else
490-
detpos = obj.runs(1).GetDetPos();
491-
end
492-
end
493-
494-
495470
% ----------------------------------------------------------------------------------
496471
function bbox = GetSdgBbox(obj)
497472
bbox = obj.runs(1).GetSdgBbox();

DataTree/SubjClass.m

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -518,26 +518,6 @@ function SetSDG(obj,option)
518518
end
519519

520520

521-
% ----------------------------------------------------------------------------------
522-
function srcpos = GetSrcPos(obj,option)
523-
if exist('option','var')
524-
srcpos = obj.sess(1).GetSrcPos(option);
525-
else
526-
srcpos = obj.sess(1).GetSrcPos();
527-
end
528-
end
529-
530-
531-
% ----------------------------------------------------------------------------------
532-
function detpos = GetDetPos(obj,option)
533-
if exist('option','var')
534-
detpos = obj.sess(1).GetDetPos(option);
535-
else
536-
detpos = obj.sess(1).GetDetPos();
537-
end
538-
end
539-
540-
541521
% ----------------------------------------------------------------------------------
542522
function bbox = GetSdgBbox(obj)
543523
bbox = obj.sess(1).GetSdgBbox();
@@ -547,13 +527,6 @@ function SetSDG(obj,option)
547527
% ----------------------------------------------------------------------------------
548528
function probe = GetProbe(obj)
549529
probe = obj.sess(1).GetProbe();
550-
% for sess = obj.sess
551-
% for run = sess.runs
552-
% if ~(probe == run.GetProbe())
553-
% warning(['Probe ', run.name, 'differs from ', obj.sess(1).runs(1).name])
554-
% end
555-
% end
556-
% end
557530
end
558531

559532

DataTree/TreeNodeClass.m

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,16 +644,56 @@ function RenameCondition(obj, oldname, newname)
644644
end
645645

646646

647+
647648
% ----------------------------------------------------------------------------------
648649
function idx = GetConditionIdx(obj, CondName)
649650
C = obj.GetConditions();
650651
idx = find(strcmp(C, CondName));
651652
end
652653

653654

655+
656+
% ----------------------------------------------------------------------------------
657+
function SD = GetSDG(obj, option)
658+
if exist('option','var')
659+
SD = obj.runs(1).GetSDG(option);
660+
else
661+
SD = obj.runs(1).GetSDG();
662+
end
663+
end
664+
665+
666+
667+
% ----------------------------------------------------------------------------------
668+
function srcpos = GetSrcPos(obj, options)
669+
srcpos = [];
670+
if exist('options','var')
671+
options = '';
672+
end
673+
if isempty(obj.children)
674+
return;
675+
end
676+
srcpos = obj.children(1).GetSrcPos(options);
677+
end
678+
679+
680+
681+
% ----------------------------------------------------------------------------------
682+
function detpos = GetDetPos(obj, options)
683+
detpos = [];
684+
if exist('options','var')
685+
options = '';
686+
end
687+
if isempty(obj.children)
688+
return;
689+
end
690+
detpos = obj.children(1).GetDetPos(options);
691+
end
692+
693+
694+
654695
% ---------------------------------------------------------
655696
function ml = GetMeasurementList(obj, matrixMode, iBlk, dataType)
656-
ml = [];
657697
if ~exist('matrixMode','var')
658698
matrixMode = '';
659699
end
@@ -718,6 +758,18 @@ function RenameCondition(obj, oldname, newname)
718758
end
719759

720760

761+
762+
% -----------------------------------------------------------------------
763+
function [md2d, md3d] = GetChannelsMeanDistance(obj)
764+
md2d = [];
765+
md3d = [];
766+
if isempty(obj.acquired)
767+
return;
768+
end
769+
[md2d, md3d] = obj.acquired.GetChannelsMeanDistance();
770+
end
771+
772+
721773

722774
% ----------------------------------------------------------------------------------
723775
function ch = GetMeasList(obj, options, iBlk)

DataTree/Version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1.13.1
1+
1.14.1
22

MainGUI/GetSelectedSDPairIndex.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function iSD = GetSelectedSDPairIndex(iS, iD)
22
global maingui
33

4-
SD = maingui.dataTree.currElem.GetSDG();
4+
SD = maingui.dataTree.currElem.GetSDG('2D');
55
iSrcDet = maingui.axesSDG.iSrcDet;
66
nSDPairsSelected = size(iSrcDet,1);
77

Utils/Shared/Version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0
1+
1.5.1

0 commit comments

Comments
 (0)