Skip to content

Commit 7136fe3

Browse files
committed
v1.80.5
-- Fix checking for latest updates. Move checkForAtlasViewerUpdates.m to the more general checkForUpdates.m and fix the problems which stopped working after getVernum changes. -- Streamline executable installation code * DataTree, v1.15.2 -- Fix error in DataFilesClass.FindDataSet() if the pattern that found acquisition file has no extension that means this pattern is meant ONLY for folders. Therefore any file matches should be skipped. -- Update SNIRF fields of MeasListClass with latest from spec. * Utils, v1.7.4 -- Fix checking for latest updates. Move checkForHomerUpdates.m to the more general checkForUpdates.m and fix the problems which stopped working after getVernum changes.
1 parent 9fe13dd commit 7136fe3

File tree

13 files changed

+191
-133
lines changed

13 files changed

+191
-133
lines changed

DataTree/AcquiredData/DataFiles/DataFilesClass.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,12 @@ function FindDataSet(obj, iFormat, iPattern, parentdir)
254254
continue;
255255
end
256256
if dirs(ii).IsFile()
257-
if strcmp(pattern, '*')
257+
% If the pattern that found this file has no extension
258+
% that means this pattern is meant ONLY for folders.
259+
% Therefore any file matches should be skipped.
260+
% Bug Fix - JD, Jun 20, 2023
261+
[~,~,ext] = fileparts(pattern);
262+
if isempty(ext)
258263
continue
259264
end
260265
if includes(dirs(ii).name, obj.filetype)

DataTree/AcquiredData/Nirs/NirsClass.m

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function SortData(obj)
213213
% ---------------------------------------------------------
214214
function err = LoadTime(obj, fdata, err)
215215
if nargin == 1
216-
fdata = load(obj.GetFilename(),'-mat', 't');
216+
load(obj.GetFilename(),'-mat', 't');
217217
err = 0;
218218
return
219219
elseif nargin == 2
@@ -1380,29 +1380,40 @@ function CopyStruct(obj, s)
13801380

13811381

13821382
% ----------------------------------------------------------------------------------
1383-
function ConvertSnirfProbe(obj, snirf)
1384-
obj.SD.Lambda = snirf.probe.wavelengths;
1385-
obj.SD.SrcPos = snirf.probe.sourcePos2D;
1386-
obj.SD.DetPos = snirf.probe.detectorPos2D;
1387-
obj.SD.SrcPos3D = snirf.probe.sourcePos3D;
1388-
obj.SD.DetPos3D = snirf.probe.detectorPos3D;
1389-
obj.SD.MeasList = snirf.GetMeasList();
1390-
obj.SD.SpatialUnit = snirf.GetLengthUnit();
1391-
if length(snirf.probe.landmarkLabels) == size(snirf.probe.landmarkPos3D,1)
1392-
obj.SD.Landmarks3D.labels = snirf.probe.landmarkLabels;
1393-
obj.SD.Landmarks3D.pos = snirf.probe.landmarkPos3D;
1394-
end
1395-
if length(snirf.probe.landmarkLabels) == size(snirf.probe.landmarkPos2D,1)
1396-
obj.SD.Landmarks2D.labels = snirf.probe.landmarkLabels;
1397-
obj.SD.Landmarks2D.pos = snirf.probe.landmarkPos2D;
1398-
end
1399-
if ~isempty(obj.SD.Landmarks3D.labels)
1400-
obj.SD.Landmarks.pos = obj.SD.Landmarks3D.pos;
1401-
obj.SD.Landmarks.labels = obj.SD.Landmarks3D.labels;
1402-
elseif ~isempty(obj.SD.Landmarks2D.labels)
1403-
obj.SD.Landmarks.pos = obj.SD.Landmarks2D.pos;
1404-
obj.SD.Landmarks.labels = obj.SD.Landmarks2D.labels;
1405-
end
1383+
function err = ConvertSnirfProbe(obj, snirf)
1384+
err = 0;
1385+
if isempty(snirf)
1386+
return
1387+
end
1388+
if isempty(snirf.probe)
1389+
return
1390+
end
1391+
try
1392+
obj.SD.Lambda = snirf.probe.wavelengths;
1393+
obj.SD.SrcPos = snirf.probe.sourcePos2D;
1394+
obj.SD.DetPos = snirf.probe.detectorPos2D;
1395+
obj.SD.SrcPos3D = snirf.probe.sourcePos3D;
1396+
obj.SD.DetPos3D = snirf.probe.detectorPos3D;
1397+
obj.SD.MeasList = snirf.GetMeasList();
1398+
obj.SD.SpatialUnit = snirf.GetLengthUnit();
1399+
if length(snirf.probe.landmarkLabels) == size(snirf.probe.landmarkPos3D,1)
1400+
obj.SD.Landmarks3D.labels = snirf.probe.landmarkLabels;
1401+
obj.SD.Landmarks3D.pos = snirf.probe.landmarkPos3D;
1402+
end
1403+
if length(snirf.probe.landmarkLabels) == size(snirf.probe.landmarkPos2D,1)
1404+
obj.SD.Landmarks2D.labels = snirf.probe.landmarkLabels;
1405+
obj.SD.Landmarks2D.pos = snirf.probe.landmarkPos2D;
1406+
end
1407+
if ~isempty(obj.SD.Landmarks3D.labels)
1408+
obj.SD.Landmarks.pos = obj.SD.Landmarks3D.pos;
1409+
obj.SD.Landmarks.labels = obj.SD.Landmarks3D.labels;
1410+
elseif ~isempty(obj.SD.Landmarks2D.labels)
1411+
obj.SD.Landmarks.pos = obj.SD.Landmarks2D.pos;
1412+
obj.SD.Landmarks.labels = obj.SD.Landmarks2D.labels;
1413+
end
1414+
catch
1415+
err = -1;
1416+
end
14061417
end
14071418

14081419

DataTree/AcquiredData/Snirf/DataClass.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,19 @@
280280
return;
281281
end
282282
end
283+
if all(obj.dataTimeSeries==0)
284+
return
285+
end
283286
b = true;
284287
end
285288

286289

290+
% -------------------------------------------------------
291+
function b = IsValid(obj)
292+
b = obj.IsDataValid();
293+
end
294+
295+
287296
% ----------------------------------------------------------------------
288297
function err = ErrorCheck(obj, err, params)
289298
if ~exist('params','var')
@@ -1067,7 +1076,6 @@ function Copy(obj, obj2)
10671076
obj = DataClass();
10681077
end
10691078
if isempty(obj2)
1070-
obj = DataClass();
10711079
return;
10721080
end
10731081
if ~isa(obj2, 'DataClass')
@@ -1086,7 +1094,6 @@ function CopyMeasurementList(obj, obj2)
10861094
obj = DataClass();
10871095
end
10881096
if isempty(obj2)
1089-
obj = DataClass();
10901097
return;
10911098
end
10921099
if ~isa(obj2, 'DataClass')

DataTree/AcquiredData/Snirf/MeasListClass.m

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
sourceIndex
66
detectorIndex
77
wavelengthIndex
8+
wavelengthActual
9+
wavelengthEmissionActual
810
dataType
11+
dataUnit
912
dataTypeLabel
1013
dataTypeIndex % Used for condition when dataType=99999 ("Processed") and dataTypeLabel='HRF...'
1114
sourcePower
1215
detectorGain
1316
moduleIndex
17+
sourceModuleIndex
18+
detectorModuleIndex
1419
end
1520

1621

@@ -43,12 +48,17 @@
4348
obj.sourceIndex = 0;
4449
obj.detectorIndex = 0;
4550
obj.wavelengthIndex = 0;
51+
obj.wavelengthActual = 0;
52+
obj.wavelengthEmissionActual = 0;
4653
obj.dataType = 0;
54+
obj.dataUnit = '';
4755
obj.dataTypeLabel = '';
4856
obj.dataTypeIndex = 0;
4957
obj.sourcePower = 0;
5058
obj.detectorGain = 0;
5159
obj.moduleIndex = 0;
60+
obj.sourceModuleIndex = 0;
61+
obj.detectorModuleIndex = 0;
5262

5363
dataTypeValues = DataTypeValues();
5464

@@ -117,13 +127,17 @@
117127
obj.sourceIndex = HDF5_DatasetLoad(gid, 'sourceIndex');
118128
obj.detectorIndex = HDF5_DatasetLoad(gid, 'detectorIndex');
119129
obj.wavelengthIndex = HDF5_DatasetLoad(gid, 'wavelengthIndex');
130+
obj.wavelengthActual = HDF5_DatasetLoad(gid, 'wavelengthActual');
131+
obj.wavelengthEmissionActual = HDF5_DatasetLoad(gid, 'wavelengthEmissionActual');
120132
obj.dataType = HDF5_DatasetLoad(gid, 'dataType');
133+
obj.dataUnit = HDF5_DatasetLoad(gid, 'dataUnit', obj.dataUnit);
121134
obj.dataTypeIndex = HDF5_DatasetLoad(gid, 'dataTypeIndex');
122135
obj.dataTypeLabel = HDF5_DatasetLoad(gid, 'dataTypeLabel', obj.dataTypeLabel);
123-
obj.detectorIndex = HDF5_DatasetLoad(gid, 'detectorIndex');
124-
obj.sourcePower = HDF5_DatasetLoad(gid, 'sourcePower');
125136
obj.sourcePower = HDF5_DatasetLoad(gid, 'sourcePower');
126137
obj.moduleIndex = HDF5_DatasetLoad(gid, 'moduleIndex');
138+
obj.detectorGain = HDF5_DatasetLoad(gid, 'detectorGain');
139+
obj.sourceModuleIndex = HDF5_DatasetLoad(gid, 'sourceModuleIndex');
140+
obj.detectorModuleIndex = HDF5_DatasetLoad(gid, 'detectorModuleIndex');
127141

128142
HDF5_GroupClose(fileobj, gid, fid);
129143
catch

DataTree/AcquiredData/Snirf/ProbeClass.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
properties
44
wavelengths
55
wavelengthsEmission
6+
sourceLabels
67
sourcePos2D
8+
sourcePos3D
9+
detectorLabels
710
detectorPos2D
11+
detectorPos3D
12+
landmarkLabels
813
landmarkPos2D
914
landmarkPos3D
10-
sourcePos3D
11-
detectorPos3D
1215
frequencies
1316
timeDelays
1417
timeDelayWidths
1518
momentOrders
1619
correlationTimeDelays
1720
correlationTimeDelayWidths
18-
sourceLabels
19-
detectorLabels
20-
landmarkLabels
2121
end
2222

2323
properties (Access = private)

DataTree/Version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15.2
1+
1.15.3

Homer3.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
end
4747

4848
PrintSystemInfo(logger, 'Homer3', getArgs(groupDirs, inputFileFormat, unitTest, nargin));
49-
checkForHomerUpdates();
49+
checkForUpdates('Homer3');
5050
gdir = cfg.GetValue('Last Group Folder');
5151
if isempty(gdir)
5252
if isdeployed()

Install/createInstallFile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function createInstallFile(options)
1414

1515
% Generate a LastCheckForUpdates.dat in case that we haven't run Homer
1616
% before creating a build
17-
checkForHomerUpdates()
17+
checkForUpdates('Homer3')
1818

1919
if ~exist('options','var') || isempty(options)
2020
options = 'all';

Install/setup.m

Lines changed: 30 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,31 @@ function main()
5454
nSteps = 100;
5555
iStep = 1;
5656

57-
fprintf('dirnameSrc = %s\n', dirnameSrc)
58-
fprintf('dirnameDst = %s\n', dirnameDst)
59-
6057
logger = Logger([dirnameSrc, 'Setup']);
6158

59+
logger.Write('dirnameSrc = %s\n', dirnameSrc)
60+
logger.Write('dirnameDst = %s\n', dirnameDst)
61+
logger.Write('\n')
62+
63+
% Create destination folders
64+
try
65+
mkdir(dirnameDst);
66+
catch ME
67+
msg{1} = sprintf('Error: Could not create installation folder. It might be in use by other applications.\n');
68+
msg{2} = sprintf('Try closing and reopening file browsers or any other applications that might be using the\n');
69+
msg{3} = sprintf('installation folder and then retry installation.');
70+
MenuBox(msg, 'OK');
71+
close(h);
72+
rethrow(ME)
73+
end
74+
75+
myCopyFile([dirnameSrc, 'Version.txt'], dirnameDst);
76+
logger.Write('\n')
77+
6278
[~, exename] = getAppname();
6379

6480
v = getVernum(exename);
81+
6582
logger.Write('==========================================\n');
6683
logger.Write('Setup script for %s v%s:\n', exename, v);
6784
logger.Write('==========================================\n\n');
@@ -78,34 +95,23 @@ function main()
7895

7996
pause(2);
8097

81-
% Create destination folders
82-
try
83-
mkdir(dirnameDst);
84-
catch ME
85-
msg{1} = sprintf('Error: Could not create installation folder. It might be in use by other applications.\n');
86-
msg{2} = sprintf('Try closing and reopening file browsers or any other applications that might be using the\n');
87-
msg{3} = sprintf('installation folder and then retry installation.');
88-
menu([msg{:}], 'OK');
89-
close(h);
90-
rethrow(ME)
91-
end
9298

9399
% Get full paths for source and destination directories
94100
dirnameSrc = fullpath(dirnameSrc);
95101
dirnameDst = fullpath(dirnameDst);
96102

97103
% Copy files from source folder to destination installation folder
98104
for ii = 1:length(platform.exename)
99-
copyFile([dirnameSrc, platform.exename{ii}], [dirnameDst, platform.exename{ii}]);
105+
myCopyFile([dirnameSrc, platform.exename{ii}], [dirnameDst, platform.exename{ii}]);
100106
end
101-
copyFile([dirnameSrc, 'db2.mat'], dirnameDst);
102-
copyFile([dirnameSrc, 'AppSettings.cfg'], dirnameDst);
103-
copyFile([dirnameSrc, 'DataTree'], [dirnameDst, 'DataTree']);
104-
copyFile([dirnameSrc, 'FuncRegistry'], [dirnameDst, 'FuncRegistry']);
105-
copyFile([dirnameSrc, 'SubjDataSample'], [dirnameDst, 'SubjDataSample']);
106-
copyFile([dirnameSrc, 'SDGcolors.csv'], dirnameDst);
107-
copyFile([dirnameSrc, 'Version.txt'], dirnameDst);
108-
copyFile([dirnameSrc, 'LastCheckForUpdates.dat'], dirnameDst);
107+
myCopyFile([dirnameSrc, 'db2.mat'], dirnameDst);
108+
myCopyFile([dirnameSrc, 'AppSettings.cfg'], dirnameDst);
109+
myCopyFile([dirnameSrc, 'DataTree'], [dirnameDst, 'DataTree']);
110+
myCopyFile([dirnameSrc, 'FuncRegistry'], [dirnameDst, 'FuncRegistry']);
111+
myCopyFile([dirnameSrc, 'SubjDataSample'], [dirnameDst, 'SubjDataSample']);
112+
myCopyFile([dirnameSrc, 'SDGcolors.csv'], dirnameDst);
113+
myCopyFile([dirnameSrc, 'Version.txt'], dirnameDst);
114+
myCopyFile([dirnameSrc, 'LastCheckForUpdates.dat'], dirnameDst);
109115

110116
% Create desktop shortcuts to Homer3
111117
createDesktopShortcuts(dirnameSrc, dirnameDst);
@@ -154,7 +160,7 @@ function main()
154160
if ispathvalid(dirnameSrc)
155161
err = -1;
156162
end
157-
copyFile(dirnameSrc0, dirnameSrc);
163+
myCopyFile(dirnameSrc0, dirnameSrc);
158164
end
159165
rmdir_safe(sprintf('%sDesktop/Test/', homePageFullPath()));
160166

@@ -170,70 +176,6 @@ function main()
170176

171177

172178

173-
174-
175-
% -------------------------------------------------------------------
176-
function copyFile(src, dst, type)
177-
global h
178-
global nSteps
179-
global iStep
180-
global logger
181-
182-
if ~exist('type', 'var')
183-
type = 'file';
184-
end
185-
186-
try
187-
% If src is one of several possible filenames, then src to any one of
188-
% the existing files.
189-
if iscell(src)
190-
for ii=1:length(src)
191-
if ~isempty(dir(src{ii}))
192-
src = src{ii};
193-
break;
194-
end
195-
end
196-
end
197-
198-
assert(logical(exist(src, type)));
199-
200-
% Check if we need to untar the file
201-
k = findstr(src,'.tar.gz'); %#ok<FSTR>
202-
if ~isempty(k)
203-
untar(src,fileparts(src));
204-
src = src(1:k-1);
205-
end
206-
207-
% Copy file from source to destination folder
208-
209-
logmsg = sprintf('Copying %s to %s\n', src, dst);
210-
if isempty(logger)
211-
fprintf(logmsg);
212-
else
213-
logger.Write(logmsg);
214-
end
215-
copyfile(src, dst);
216-
217-
if ~isempty(iStep)
218-
waitbar(iStep/nSteps, h); iStep = iStep+1;
219-
end
220-
pause(1);
221-
catch ME
222-
if ishandles(h)
223-
close(h);
224-
end
225-
printStack(ME);
226-
if iscell(src)
227-
src = src{1};
228-
end
229-
menu(sprintf('Error: Could not copy %s to installation folder.', src), 'OK');
230-
pause(5);
231-
rethrow(ME);
232-
end
233-
234-
235-
236-
237179
% --------------------------------------------------------------
238180
function deleteShortcuts()
239181
global platform

0 commit comments

Comments
 (0)