Skip to content

Commit

Permalink
v1.76.0 - Merge squashed commit from development branch of the follow…
Browse files Browse the repository at this point in the history
…ing:

commit 1680519
Author: jayd1860 <jdubb@bu.edu>
Date:   Tue Apr 11 14:49:33 2023 -0400

    -- Sync setpaths in DataTree with DataTree library

commit 0f5428e
Author: jayd1860 <44243610+jayd1860@users.noreply.github.com>
Date:   Tue Apr 4 16:30:29 2023 -0400

    v1.76.0  -- Update DataTree shared lib submodule (#168)

    * v1.75.4

    * DataTree, v1.11.1
    -- Fix error when loading some probes in NirsClass check that NirsClass.GetChannelsMeanDistance() is error checking size of SrcPos3D and DetPos3D against meas list indices.

    * Utils, v1.4.4
    -- Change font size in MenuBox.
    -- Adjust button width to slightly wider.

    * v1.75.5 -- Fix font size for MAC for MenuBox.m and configSettingsGUI.m

    * v1.75.6 -- Utils, 1.4.6 -- Tweak size of MenuBox text gap.

    * v1.76.0

    -- Update DataTree shared lib submodule

    * DataTree, 1.12.0
    -- Change AcqDataClass GetSrcPos and GetDetPos methods to ignore '2D' and instead automatically try to retrieve 3D optodes if available otherwise it retrieves 2D. This fixes the problem of retrieving non existent or artificially generated 2D optodes that do not agree with the 'LengthUnit' which is a problem when doing image reconstruction and using a non-zero SD separation to exclude channels (possibbly end up exluding ALL chaqnnels if units apply to the wrong optodes).
    -- Update NirsClass so SDgui matches GrommetRot being changed back to cell array type instead of numeric array.

commit 4974adb
Author: Meryem Ayşe Yücel <49535526+mayucel@users.noreply.github.com>
Date:   Mon Apr 3 12:02:43 2023 -0400

    Dev may2 (#167)

    * Update ar_fit.m

    Fixing bug in filename stepwise->stepwisefit, and the relevant extracted output.

    * Update ar_glm_final.m

    Reducing the number of max iterations to 10 for the sake of computational time.

    * Update ar_glm_final.m

    fix
    Pmax 10->100

    * AR p order

    Order was hardcoded, changed it be 2 X sampling frequency.

commit d0fac4b
Author: jayd1860 <44243610+jayd1860@users.noreply.github.com>
Date:   Thu Mar 23 02:10:45 2023 -0400

    v1.75.6 -- Fix font size in MenuBox on MAC (#166)

    * v1.75.4

    * DataTree, v1.11.1
    -- Fix error when loading some probes in NirsClass check that NirsClass.GetChannelsMeanDistance() is error checking size of SrcPos3D and DetPos3D against meas list indices.

    * Utils, v1.4.4
    -- Change font size in MenuBox.
    -- Adjust button width to slightly wider.

    * v1.75.5 -- Fix font size for MAC for MenuBox.m and configSettingsGUI.m

    * v1.75.6 -- Utils, 1.4.6 -- Tweak size of MenuBox text gap.

commit f583645
Author: jayd1860 <jdubb@bu.edu>
Date:   Tue Mar 21 21:52:42 2023 -0400

    v1.75.3

    -- Fix issue with setpaths error on MAC when setting file persmissions and logging it global logger not declared.
    -- Clean up addremove argument to setpaths and add option (addremove=2) to exclusively load only the current repo while excluding search paths for all other similar repos

commit d2c3873
Author: jayd1860 <jdubb@bu.edu>
Date:   Tue Mar 21 15:31:33 2023 -0400

    v1.75.2

    -- Sync with shared libraries (submodules).

    * DataTree, v1.11.0
    -- Change NirsClass.ProbeEqual() to consider measurement lists in different orders but same set of SD pairs to be equal. SO SDgui doesn't think edits were made when they weren't.
    -- Add NirsClass.GetChannelsMeanDistance() method same as in SnirfClass

    * Utils, v1.4.2
    -- Make another tweak in MenuBox - character size doesn't quite equal character units so we compensate by multiplying by scaling factor for button width and height.

    * Utils, v1.4.1
    -- Fix some size and position issues with radiobutton style MenuBox. Another attempt to simplify size and position calculations.

commit a44aeed
Author: sreekanthkura7 <sreekanth.kura7@gmail.com>
Date:   Tue Mar 21 14:25:14 2023 -0400

     Add plotProbe2 display

commit 27a642e
Author: jayd1860 <44243610+jayd1860@users.noreply.github.com>
Date:   Sat Mar 18 00:49:19 2023 -0400

    Fix SpatialUnit scaling in SD NirsClass (#165)

    * v1.75.0

    -- In syncSubmodules.m add option to ignore last revision dates of the parent repo and submodules and instead force the direction of copying changes from parent repo to submodules ('parent2submodules') or submodules to parent repo ('submodules2parent').

    * DataTree, v1.9.0, v1.8.3
    -- Fix wrong probe scaling converting units in SnirfClass.ProbeClass and NirsClass
    -- Add m (meter) to SpatialUnits NirsClass add appropriate scaling. When changing units in SDgui ask iof fixing incorrect units or simply changing units and associated coordinates.

    * Utils, v1.4.0, v1.3.5
    -- Remove non-class method convert_optodepos_to_circlular_2D_pos.m from ProbeClass to Utils.
    -- Add missing function pretty_print_struct.m  used in DataTree to Utils library
    -- Fix bug in last commit having to do with the MenuBox radiobutton dialog selction of spatial unit change: either a) correcting them and changing units ONLY  or  b) changing units and coordinates.
    -- Add radiobutton selection style option to MenuBox.m
    -- Fix some issues with MenuBox.m including issue with MenuBox disappearing outside of screen when run standalone with no parent GUI.

    * v1.75.1

    -- DataTree, v1.10.0, Fix error in probe registration loading SD file where anchor points are not copied correctly.

commit 4544f60
Author: jayd1860 <jdubb@bu.edu>
Date:   Wed Mar 8 13:23:12 2023 -0500

    v1.74.3

    -- Sync with latest shared libraries

    * DataTree, v1.8.1
    -- Fix error when trying to retrieve ppf param during image recon because dataTree.currElem.procStream.fcalls being empty. This is because of using GroupClass.CompareVersions caused procstream fcalls from groupResults not to load (it was deemed too old) which is clearly not what we want. Removed for now the comparison (CompareVersions for now always returns 0)  until we can figure out best way to handle old versions of groupResults.
    -- Provide ProbeClass.GetScaleFactor() method to retrieve private scaling field
    -- In ExportProcStreamDependencies get rid of the *_Library_Version suffix next to each library name in the JSON output

    * FuncRegistry, v1.2.2
    -- Fix issue with converting mlACt vector to 2D array with mlAct_Initialize.m during image recon.

    * Utils, v1.3.2
    -- Add ability to versionstr2num to process version arguments in the form of 3 numbers rather than a string for backward compatability with DataTree GroupClass to get old style version.

commit 104e17c
Author: jayd1860 <jdubb@bu.edu>
Date:   Tue Mar 7 11:53:01 2023 -0500

    v1.74.1

    -- Fix Logger.Write issue when getting cell array of strings input.
    -- Remove redundant copy of jsonlab library which has been moved to Utils shared library files from jsonlab library.
    -- Utils, v1.3.1: Remove unnecessary files from jsonlab library. License looks like it allows modification as long as you include the license itself in the distribution.
    -- FuncRegistry, v1.2.1: Update version number after Meryem's changes to ar_glm_final.m.

commit 349a96d
Author: jayd1860 <jdubb@bu.edu>
Date:   Sun Mar 5 14:41:52 2023 -0500

    v1.74.0

    -- Move updateVersions and supporting function out of Utils/submodules to Utils/Shared in DataTree standalone mode to update repo versions.
    -- Move JSON library from Utils to Utils/Shared for use in DataTree standalone mode to write JSON files when expoerting proc stream.

    * DataTree, v1.8.0

    -- Fix issue of DataTree in standalone mode not getting the right value for config parameter "Export Processing Stream Functions".
    -- Remove reliance on static method TreeNodeClass.ExportProcStreamFunctions to get value of config parameter which tells you if code should export processing stream. Instead switch to getting the value directly from the ConfigFileClass global variable cfg which is automatically updated when changes are made to any config parameters through the configSettingsGUI.

    * Utils, v1.3.0

    -- Add JSON library so that export of procesaswing stream to JSON files can work in DataTree in standalone mode.
    -- Add repoManagement/updateVersions.m and supporting function so that use can use the script to update versions in DataTree in standalone mode.
    -- When saving config parameters in configSettingsGUI update global ConfigFileClass variable cfg so that DataTree in standalone mode has immediate access to changes in config params without having to rerun dataTree.

commit d86615d
Author: Meryem Ayşe Yücel <49535526+mayucel@users.noreply.github.com>
Date:   Sun Mar 5 14:35:03 2023 -0500

    Dev may2 (#163)

    * Update ar_fit.m

    Fixing bug in filename stepwise->stepwisefit, and the relevant extracted output.

    * Update ar_glm_final.m

    Reducing the number of max iterations to 10 for the sake of computational time.

    * Update ar_glm_final.m

    fix
    Pmax 10->100

    * AR p order

    Order was hardcoded, changed it be 2 X sampling frequency.

    ---------

    Co-authored-by: jayd1860 <44243610+jayd1860@users.noreply.github.com>

commit c3a2f13
Author: jayd1860 <jdubb@bu.edu>
Date:   Sat Mar 4 23:04:36 2023 -0500

    v1.73.1

    -- Fix issue where you get error in getVernum.m when namespace isn't set.

commit 222f6e0
Author: jayd1860 <jdubb@bu.edu>
Date:   Sat Mar 4 00:57:24 2023 -0500

    v1.73.0

    -- Separate ApplicationName into ApplicationName and Version when exporting processing stream to JSON file.
    -- Change default for config parameter Export Processing Stream Functions from No to Yes.
    -- Add library version numbers to JSON file generated by export processing stream utility
    -- Add utility updateVersions.m to Utils/submodules to automatically generate new version numbers for main application and shared library depedencies
    -- Fix issue with copying probe in NirsClass.CopyProbe when concerting from .nirs to .snirf. Also use NirsClass constructor rather than load() to load .nirs data when converting from .nirs to .snirf.

commit 16a3aae
Merge: 9991e1d 40bb3ca
Author: jayd1860 <44243610+jayd1860@users.noreply.github.com>
Date:   Fri Mar 3 00:46:55 2023 -0500

    Merge branch 'master' into development

commit 9991e1d
Author: jayd1860 <jdubb@bu.edu>
Date:   Fri Mar 3 00:28:17 2023 -0500

    -- Update version numbers for DataTree and FuncRegistry after new fixes

commit 592a42f
Author: Meryem Ayşe Yücel <49535526+mayucel@users.noreply.github.com>
Date:   Fri Mar 3 00:23:21 2023 -0500

    Update ar_fit.m (#161)

    * Update ar_fit.m

    Fixing bug in filename stepwise->stepwisefit, and the relevant extracted output.

    * Update ar_glm_final.m

    Reducing the number of max iterations to 10 for the sake of computational time.

commit a383a3f
Author: jayd1860 <jdubb@bu.edu>
Date:   Thu Mar 2 23:43:34 2023 -0500

    v1.72.0

    -- Fix error when exporting processing stream to JSON files because of bug in extracting mlActMan - since it is no longer a vector but a 2D array of sd pairs plus data type.

commit bf948c0
Author: jayd1860 <jdubb@bu.edu>
Date:   Tue Feb 28 23:28:38 2023 -0500

# Conflicts:
#	DataTree/AcquiredData/Nirs/NirsClass.m
#	DataTree/AcquiredData/Snirf/ProbeClass.m
#	DataTree/GroupClass.m
#	DataTree/Version.txt
#	FuncRegistry/UserFunctions/iWLS/ar_glm_final.m
#	FuncRegistry/Version.txt
#	Utils/Shared/Version.txt
#	Utils/Shared/versionstr2num.m
#	Version.txt
  • Loading branch information
jayd1860 committed Apr 12, 2023
1 parent 448762b commit e73d650
Show file tree
Hide file tree
Showing 123 changed files with 1,923 additions and 6,200 deletions.
2 changes: 1 addition & 1 deletion DataTree/AcquiredData/DataFiles/DataFilesClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function ErrorCheck(obj)
if obj.files(ii).isdir
continue;
end
filename = [obj.rootdir, obj.files(ii).name];
filename = [obj.rootdir, obj.files(ii).name]; %#ok<NASGU>
eval( sprintf('o = %s(filename);', constructor) );
if o.GetError() < 0
obj.logger.Write('DataFilesClass.ErrorCheck - ERROR: In file "%s" %s. File will not be added to data set\n', obj.files(ii).name, o.GetErrorMsg());
Expand Down
2 changes: 1 addition & 1 deletion DataTree/AcquiredData/DataFiles/Nirs2Snirf.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
fprintf('Converting %s to %s\n', src, dst);
waitbar_improved(ii/length(nirsfiles), h, sprintf('Converting %s to SNIRF: %d of %d', nirsfiles(ii).name, ii, length(nirsfiles)));

nirs = load(src,'-mat');
nirs = NirsClass(src);

if DEBUG==false
snirf(ii) = SnirfClass(nirs);
Expand Down
201 changes: 153 additions & 48 deletions DataTree/AcquiredData/Nirs/NirsClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,23 @@ function SaveMat(obj, fname, options)
fields{2} = propnames(obj2.SD);

fieldsToExclude = { ...
'MeasList'; ...
'MeasListAct'; ...
'SrcMap'; ...
};


% Check MeasList explicitely
if (isfield(obj.SD,'MeasList') && ~isfield(obj2.SD,'MeasList')) || ~isfield(obj.SD,'MeasList') && isfield(obj2.SD,'MeasList')
return;
end
[~, k1] = sortrows(obj.SD.MeasList);
[~, k2] = sortrows(obj2.SD.MeasList);
if ~all(obj.SD.MeasList(k1,:) == obj2.SD.MeasList(k2,:))
return;
end


for kk = 1:length(fields)
for jj = 1:length(fields{kk})
field = fields{kk}{jj};
Expand All @@ -363,7 +376,7 @@ function SaveMat(obj, fname, options)
end

% Now compare field
if ~isfield(obj.SD,field) || ~isfield(obj2.SD,field)
if (isfield(obj.SD,field) && ~isfield(obj2.SD,field)) || ~isfield(obj.SD,field) && isfield(obj2.SD,field)
return;
end
if eval( sprintf('~strcmp(class(obj.SD.%s), class(obj2.SD.%s))', field, field) )
Expand Down Expand Up @@ -1044,56 +1057,87 @@ function RenameCondition(obj, oldname, newname)
'SrcPos3D',[], ...
'DetPos3D',[], ...
'DummyPos3D',[], ...
'nSrcs',0,...
'nDets',0,...
'nDummys',0,...
'SrcGrommetType',{{}}, ...
'DetGrommetType',{{}}, ...
'DummyGrommetType',{{}}, ...
'SrcGrommetRot',[], ...
'DetGrommetRot',[], ...
'DummyGrommetRot',[], ...
'SrcGrommetRot',{{}}, ...
'DetGrommetRot',{{}}, ...
'DummyGrommetRot',{{}}, ...
'Landmarks',obj.InitLandmarks(), ...
'Landmarks2D',obj.InitLandmarks(), ...
'Landmarks3D',obj.InitLandmarks(), ...
'MeasList',[], ...
'MeasListAct',[], ...
'SpringList',[], ...
'AnchorList',[], ...
'AnchorList',{{}}, ...
'SrcMap',[], ...
'SpatialUnit','', ...
'xmin',0, ...
'xmax',0, ...
'ymin',0, ...
'ymax',0, ...
'auxChannels',[] ...
'auxChannels',{{}} ...
);
end



% ----------------------------------------------------------------------------------
function SetProbeSpatialUnit(obj, spatialUnitNew)
scaling = 1;
if strcmpi(spatialUnitNew,'mm')
if strcmpi(obj.SD.SpatialUnit,'cm')
scaling = 10;
end
elseif strcmpi(spatialUnitNew,'cm')
if strcmpi(obj.SD.SpatialUnit,'mm')
scaling = 1/10;
end
else
spatialUnitNew = '';
function SetProbeSpatialUnit(obj, spatialUnitNew, scaling, ndims)
if ~exist('ndims','var')
ndims = '2d';
end

% Set scaling based on current units and desired units if they do not match AND
% scaling was not explcitly specified (i.e., passed in as an argument).
if ~exist('scaling','var') || isempty(scaling)
scaling = 1;
if strcmpi(spatialUnitNew,'mm')
if strcmpi(obj.SD.SpatialUnit,'cm')
scaling = 10;
elseif strcmpi(obj.SD.SpatialUnit,'m')
scaling = 1000;
end
elseif strcmpi(spatialUnitNew,'cm')
if strcmpi(obj.SD.SpatialUnit,'mm')
scaling = 1/10;
elseif strcmpi(obj.SD.SpatialUnit,'m')
scaling = 100;
end
elseif strcmpi(spatialUnitNew,'m')
if strcmpi(obj.SD.SpatialUnit,'mm')
scaling = 1/1000;
elseif strcmpi(obj.SD.SpatialUnit,'cm')
scaling = 1/100;
end
else
spatialUnitNew = '';
end
end


obj.SD.SpatialUnit = spatialUnitNew;
obj.SD.SrcPos = obj.SD.SrcPos * scaling;
obj.SD.DetPos = obj.SD.DetPos * scaling;
obj.SD.DummyPos = obj.SD.DummyPos * scaling;
if size(obj.SD.SpringList,2)==3
lst = find(obj.SD.SpringList(:,3)~=-1);
obj.SD.SpringList(lst,3) = obj.SD.SpringList(lst,3) * scaling;

if isempty(ndims) || strcmpi(ndims, '2D')
obj.SD.SrcPos = obj.SD.SrcPos * scaling;
obj.SD.DetPos = obj.SD.DetPos * scaling;
obj.SD.DummyPos = obj.SD.DummyPos * scaling;
if size(obj.SD.SpringList,2)==3
lst = find(obj.SD.SpringList(:,3)~=-1);
obj.SD.SpringList(lst,3) = obj.SD.SpringList(lst,3) * scaling;
end
obj.SD.Landmarks.pos = obj.SD.Landmarks.pos * scaling;
end

if isempty(ndims) || strcmpi(ndims, '3D')
obj.SD.SrcPos3D = obj.SD.SrcPos3D * scaling;
obj.SD.DetPos3D = obj.SD.DetPos3D * scaling;
obj.SD.DummyPos3D = obj.SD.DummyPos3D * scaling;
obj.SD.Landmarks3D.pos = obj.SD.Landmarks3D.pos * scaling;
end
obj.SD.Landmarks.pos = obj.SD.Landmarks.pos * scaling;
obj.SD.Landmarks3D.pos = obj.SD.Landmarks3D.pos * scaling;
obj.SD.Landmarks2D.pos = obj.SD.Landmarks2D.pos * scaling;
end


Expand All @@ -1102,22 +1146,25 @@ function SetProbeSpatialUnit(obj, spatialUnitNew)
function FixProbeSpatialUnit(obj)
if isempty(obj.SD.SpatialUnit)
q = MenuBox('Spatial units not provided in probe data. Please specify spatial units of the optode coordinates?', ...
{'mm','cm',sprintf('do not know')});
{'mm','cm','m'});
if q==1
obj.SD.SpatialUnit = 'mm';
elseif q==2
obj.SD.SpatialUnit = 'cm';
elseif q==3
obj.SD.SpatialUnit = '';
end
end
if ~strcmpi(obj.SD.SpatialUnit,'mm')
q = MenuBox(sprintf('This probe uses ''%s'' units for probe coordinates. We recommend converting to ''mm'' units, to be consistent with Homer. Do you want to convert probe coordinates from %s to mm?', ...
obj.SD.SpatialUnit), {'YES','NO'}, 'upperleft');
if q==1
obj.SetProbeSpatialUnit('mm')
obj.SD.SpatialUnit = 'm';
end
end
% We don't need to force anything on the user since homer and AV do internal conversions to 'mm'
%
% if ~strcmpi(obj.SD.SpatialUnit,'mm')
% q = MenuBox(sprintf('This probe uses ''%s'' units for probe coordinates. We recommend converting to ''mm'' units, to be consistent with Homer. Do you want to convert probe coordinates from %s to mm?', ...
% obj.SD.SpatialUnit), {'YES','NO'}, 'upperleft');
% if q==1
% obj.SetProbeSpatialUnit('mm')
% end
% end
%
end


Expand Down Expand Up @@ -1162,24 +1209,28 @@ function FixProbeSpatialUnit(obj)


% ----------------------------------------------------------------------------------
function CopyProbe(obj, SD)
function CopyProbe(obj, SD) %#ok<INUSD>
fields = propnames(obj.SD);
for ii = 1:length(fields)
if eval( sprintf('isfield(SD, ''%s'')', fields{ii}) )
if eval( sprintf('strcmp(class(obj.SD.%s), class(SD.%s))', fields{ii}, fields{ii}) )
eval( sprintf('obj.SD.%s = SD.%s;', fields{ii}, fields{ii}) );
eval( sprintf('obj.SD.%s = SD.%s;', fields{ii}, fields{ii}) );
elseif eval( sprintf('isnumeric(obj.SD.%s) && iscell(SD.%s)', fields{ii}, fields{ii}) )
if eval( sprintf('~isempty(SD.%s)', fields{ii}) )
eval( sprintf('obj.SD.%s = cell2array(SD.%s);', fields{ii}, fields{ii}) );
end
for kk = 1:length(eval( sprintf('SD.%s', fields{ii}) ))
if eval( sprintf('isnumeric(SD.%s{kk}) && (length(SD.%s{kk})==1)', fields{ii}, fields{ii}) )
eval( sprintf('obj.SD.%s(kk) = SD.%s{kk};', fields{ii}, fields{ii}) );
end
end
end
elseif eval( sprintf('isscalar(obj.SD.%s) && isscalar(SD.%s)', fields{ii}, fields{ii}) )
eval( sprintf('obj.SD.%s = SD.%s;', fields{ii}, fields{ii}) );
end
end
end

% Fill in any fields that don't conform to standard SD data structure

% SrcGrommetType
d1 = size(obj.SD.SrcPos,1) - length(obj.SD.SrcGrommetType);
if d1 > 0
Expand All @@ -1189,7 +1240,13 @@ function CopyProbe(obj, SD)
% SrcGrommetRot
d2 = size(obj.SD.SrcPos,1) - length(obj.SD.SrcGrommetRot);
if d2 > 0
obj.SD.SrcGrommetRot(end+1:end+d2) = zeros(d2,1);
for ii = length(obj.SD.SrcGrommetRot)+1:length(obj.SD.SrcGrommetRot)+d2
if iscell(obj.SD.SrcGrommetRot)
obj.SD.SrcGrommetRot{ii} = 0;
else
obj.SD.SrcGrommetRot(ii) = 0;
end
end
end

% DetGrommetType
Expand All @@ -1201,7 +1258,13 @@ function CopyProbe(obj, SD)
% DetGrommetRot
d2 = size(obj.SD.DetPos,1) - length(obj.SD.DetGrommetRot);
if d2 > 0
obj.SD.DetGrommetRot(end+1:end+d2) = zeros(d2,1);
for ii = length(obj.SD.SrcGrommetRot)+1:length(obj.SD.SrcGrommetRot)+d2
if iscell(obj.SD.DetGrommetRot)
obj.SD.DetGrommetRot{ii} = 0;
else
obj.SD.DetGrommetRot(ii) = 0;
end
end
end

% DummyGrommetType
Expand All @@ -1213,7 +1276,13 @@ function CopyProbe(obj, SD)
% DummyGrommetRot
d2 = size(obj.SD.DummyPos,1) - length(obj.SD.DummyGrommetRot);
if d2 > 0
obj.SD.DummyGrommetRot(end+1:end+d2) = zeros(d2,1);
for ii = length(obj.SD.DummyGrommetRot)+1:length(obj.SD.DummyGrommetRot)+d2
if iscell(obj.SD.DummyGrommetRot)
obj.SD.DummyGrommetRot{ii} = 0;
else
obj.SD.DummyGrommetRot(ii) = 0;
end
end
end

% MesListAct
Expand All @@ -1224,8 +1293,11 @@ function CopyProbe(obj, SD)
elseif d>1
obj.SD.MeasListAct(end-d:end) = [];
end
end

end

obj.SD.nSrcs = size(obj.SD.SrcPos,1);
obj.SD.nDets = size(obj.SD.DetPos,1);
obj.SD.nDummys = size(obj.SD.DummyPos,1);
end


Expand All @@ -1238,6 +1310,7 @@ function CopyStim(obj, obj2)
end



% ----------------------------------------------------------------------------------
function CopyStruct(obj, s)
fields = propnames(obj);
Expand Down Expand Up @@ -1272,13 +1345,15 @@ function ConvertSnirfProbe(obj, snirf)
end



% ----------------------------------------------------------------------------------
function ConvertSnirfData(obj, snirf)
obj.d = snirf.data(1).dataTimeSeries;
obj.t = snirf.data(1).time;
end



% ----------------------------------------------------------------------------------
function ConvertSnirfStim(obj, snirf)
obj.s = zeros(length(obj.t), length(snirf.stim));
Expand All @@ -1302,6 +1377,7 @@ function ConvertSnirfStim(obj, snirf)
end



% ----------------------------------------------------------------------------------
function ConvertSnirfAux(obj, snirf)
obj.aux = zeros(length(obj.t), length(snirf.aux));
Expand All @@ -1311,6 +1387,7 @@ function ConvertSnirfAux(obj, snirf)
end



% ----------------------------------------------------------------------------------
function ConvertSnirf(obj, snirf)
obj.ConvertSnirfProbe(snirf);
Expand All @@ -1322,7 +1399,33 @@ function ConvertSnirf(obj, snirf)



% ----------------------------------------------------------------------------------
% -----------------------------------------------------------------------
function [md2d, md3d] = GetChannelsMeanDistance(obj)
md2d = [];
md3d = [];
ml = obj.SD.MeasList;
if isempty(ml)
return
end
k = find(ml(:,4)==1);
ml = ml(k,:);
d1 = zeros(size(ml,1),1);
d2 = zeros(size(ml,1),1);
for ii = 1:size(ml,1)
if ml(ii,1) <= size(obj.SD.SrcPos,1) && ml(ii,2) <= size(obj.SD.DetPos,1)
d1(ii) = dist3(obj.SD.SrcPos(ml(ii,1),:), obj.SD.DetPos(ml(ii,2),:));
end
if ml(ii,1) <= size(obj.SD.SrcPos3D,1) && ml(ii,2) <= size(obj.SD.DetPos3D,1)
d2(ii) = dist3(obj.SD.SrcPos3D(ml(ii,1),:), obj.SD.DetPos3D(ml(ii,2),:));
end
end
md2d = mean(d1);
md3d = mean(d2);
end



% -----------------------------------------------------------------------
function ErrorCheck(obj)
if isempty(obj)
return
Expand Down Expand Up @@ -1368,6 +1471,7 @@ function ErrorCheck(obj)
end



% ----------------------------------------------------------------
function [str, fields] = Properties2String(obj)
str = '';
Expand All @@ -1382,6 +1486,7 @@ function ErrorCheck(obj)
end



% -------------------------------------------------------
function changes = StimChangesMade(obj)
% Load stims from file
Expand Down

0 comments on commit e73d650

Please sign in to comment.