Skip to content

Commit 287076a

Browse files
committed
Update to v3.2.1
1 parent 511c85c commit 287076a

File tree

14 files changed

+1031
-288
lines changed

14 files changed

+1031
-288
lines changed

AlignSubSpectra.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
case 'GE'
6868
if strcmpi(MRS_struct.p.seqorig,'Lythgoe')
6969
subSpecInd = [3 2 4 1];
70-
elseif strcmpi(MRS_struct.p.seqorig,'Noeske')
71-
subSpecInd = [2 1 3 4];
7270
else
7371
subSpecInd = [3 2 1 4];
7472
end

CoRegStandAlone/CoRegStandAlone.m

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
% 1. Pre-initialise
4444
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4545

46-
MRS_struct.version.Gannet = '3.2.1-rc';
47-
MRS_struct.version.load = '220526';
46+
MRS_struct.version.Gannet = '3.2.1';
47+
MRS_struct.version.load = '220607';
4848
MRS_struct.ii = 0;
4949
if size(metabfile,2) == 1
5050
metabfile = metabfile';
@@ -53,7 +53,8 @@
5353
MRS_struct.p.HERMES = 0;
5454

5555
% Flags
56-
MRS_struct.p.mat = 1; % Save results in *.mat output structure? (0 = NO, 1 = YES (default)).
56+
MRS_struct.p.mat = 1; % Save results in *.mat file? (0 = NO, 1 = YES (default)).
57+
MRS_struct.p.csv = 1; % Save results in *.csv file? (0 = NO, 1 = YES (default)).
5758
MRS_struct.p.vox = {'vox1'}; % Name of the voxel
5859
MRS_struct.p.target = {'GABAGlx'}; % Name of the target metabolite
5960

@@ -69,37 +70,37 @@
6970
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7071

7172
for ii = 1:length(metabfile) % Loop over all files in the batch (from metabfile)
72-
73+
7374
MRS_struct.ii = ii;
74-
75+
7576
switch MRS_struct.p.vendor
76-
77+
7778
case 'GE'
7879
MRS_struct = GERead(MRS_struct, metabfile{ii});
79-
80+
8081
case 'Siemens_twix'
8182
MRS_struct = SiemensTwixRead(MRS_struct, metabfile{ii});
82-
83+
8384
case 'Siemens_dicom'
8485
MRS_struct = SiemensDICOMRead(MRS_struct, metabfile{ii});
85-
86+
8687
case 'dicom'
8788
MRS_struct = DICOMRead(MRS_struct, metabfile{ii});
88-
89+
8990
case 'Siemens_rda'
9091
MRS_struct = SiemensRead(MRS_struct, metabfile{ii}, metabfile{ii});
91-
92+
9293
case 'Philips'
9394
MRS_struct = PhilipsRead(MRS_struct, metabfile{ii});
94-
95+
9596
case 'Philips_data'
9697
MRS_struct = PhilipsRead_data(MRS_struct, metabfile{ii});
97-
98+
9899
case 'Philips_raw'
99100
MRS_struct = PhilipsRawLoad(MRS_struct, metabfile{ii}, 3, 0);
100-
101+
101102
end
102-
103+
103104
end
104105

105106
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -124,6 +125,35 @@
124125
save(fullfile(pwd, 'MRS_struct_CoRegStandAlone.mat'), 'MRS_struct', '-v7.3');
125126
end
126127

128+
% Export MRS_struct fields into csv file
129+
if MRS_struct.p.csv
130+
csv_name = fullfile(pwd, 'MRS_struct.csv');
131+
if exist(csv_name, 'file')
132+
fprintf('\nUpdating results in %s\n\n', 'MRS_struct.csv...');
133+
else
134+
fprintf('\nExporting results to %s\n\n', 'MRS_struct.csv...');
135+
end
136+
137+
if strcmp(MRS_struct.p.vendor, 'Siemens_rda')
138+
filename = MRS_struct.metabfile(:,1:2:end)';
139+
else
140+
filename = MRS_struct.metabfile';
141+
end
142+
for ii = 1:length(filename)
143+
[~,b,c] = fileparts(filename{ii});
144+
out.filename(ii,1) = cellstr([b c]);
145+
end
146+
147+
out.fGM = MRS_struct.out.vox1.tissue.fGM(:);
148+
out.fWM = MRS_struct.out.vox1.tissue.fWM(:);
149+
out.fCSF = MRS_struct.out.vox1.tissue.fCSF(:);
150+
151+
round2 = @(x) round(x*1e3)/1e3;
152+
T = table(out.filename, round2(out.fGM), round2(out.fWM), round2(out.fCSF), ...
153+
'VariableNames', {'Filename', 'fGM', 'fWM', 'fCSF'});
154+
writetable(T, csv_name);
155+
end
156+
127157
end
128158

129159

CoRegStandAlone/Seg.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
% This is useful if only the tissue segmentation information is supposed to
1212
% be obtained.
1313

14-
MRS_struct.version.segment = '210331';
14+
MRS_struct.version.segment = '220607';
1515
vox = MRS_struct.p.vox(1);
1616

1717
warning('off'); % temporarily suppress warning messages
@@ -94,18 +94,18 @@
9494
airvol_thresh = airvol_tmp .* T1_tmp;
9595
airvol_thresh = airvol_thresh(:);
9696

97-
MRS_struct.out.tissue.CV_WM(ii) = std(WMvol_thresh, 'omitnan') / mean(WMvol_thresh, 'omitnan');
98-
MRS_struct.out.tissue.CV_GM(ii) = std(GMvol_thresh, 'omitnan') / mean(GMvol_thresh, 'omitnan');
99-
MRS_struct.out.tissue.CJV(ii) = (std(WMvol_thresh, 'omitnan') + std(GMvol_thresh, 'omitnan')) ...
97+
MRS_struct.out.QA.CV_WM(ii) = std(WMvol_thresh, 'omitnan') / mean(WMvol_thresh, 'omitnan');
98+
MRS_struct.out.QA.CV_GM(ii) = std(GMvol_thresh, 'omitnan') / mean(GMvol_thresh, 'omitnan');
99+
MRS_struct.out.QA.CJV(ii) = (std(WMvol_thresh, 'omitnan') + std(GMvol_thresh, 'omitnan')) ...
100100
/ abs(mean(WMvol_thresh, 'omitnan') - mean(GMvol_thresh, 'omitnan'));
101-
MRS_struct.out.tissue.CNR(ii) = abs(mean(WMvol_thresh, 'omitnan') - mean(GMvol_thresh, 'omitnan')) / ...
101+
MRS_struct.out.QA.CNR(ii) = abs(mean(WMvol_thresh, 'omitnan') - mean(GMvol_thresh, 'omitnan')) / ...
102102
sqrt(var(airvol_thresh, 'omitnan') + var(WMvol_thresh, 'omitnan') + var(GMvol_thresh, 'omitnan'));
103103

104104
T1_tmp = T1_tmp(:);
105105
n_vox = numel(T1_tmp);
106106
efc_max = n_vox * (1/sqrt(n_vox)) * log(1/sqrt(n_vox));
107107
b_max = sqrt(sum(T1_tmp.^2));
108-
MRS_struct.out.tissue.EFC(ii) = (1/efc_max) .* sum((T1_tmp ./ b_max) .* log((T1_tmp + eps) ./ b_max));
108+
MRS_struct.out.QA.EFC(ii) = (1/efc_max) .* sum((T1_tmp ./ b_max) .* log((T1_tmp + eps) ./ b_max));
109109

110110
% Loop over voxels if PRIAM
111111
for kk = 1:length(vox)

GannetLoad.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
% 6. Build GannetLoad output
1414
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1515

16-
MRS_struct.version.Gannet = '3.2.1-rc';
17-
MRS_struct.version.load = '220526';
16+
MRS_struct.version.Gannet = '3.2.1';
17+
MRS_struct.version.load = '220607';
1818
VersionCheck(0, MRS_struct.version.Gannet);
1919
ToolboxCheck;
2020

GannetPreInitialise.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% and MEGA-PRESS: {'GABA'}, {'Glx'}, {'GSH'}, {'Lac'}, or {'EtOH'}
1313
% and HERMES: {'GABA','GSH'}, {'Glx','GSH'}, {'Lac','GSH'}, or {'EtOH','GABA','GSH'}
1414
MRS_struct.p.seqorig = 'JHU'; % Origin of Philips MEGA-PRESS or GE HERMES sequences;
15-
% options are 'JHU' or 'Philips' if Philips, or 'Lythgoe' or 'Noeske' if GE (HERMES only)
15+
% options are 'JHU' or 'Philips' if Philips, or 'Lythgoe' if GE (HERMES only)
1616

1717
% Analysis parameters
1818
MRS_struct.p.LB = 3; % Exponential line-broadening (in Hz)
@@ -38,9 +38,9 @@
3838
MRS_struct.p.mat = 0; % Save MRS_struct as a .mat file
3939
MRS_struct.p.csv = 0; % Extract useful data from MRS_struct and export them to a .csv file (applies to GannetFit,
4040
% GannetSegment and GannetQuantify)
41-
MRS_struct.p.append = 1; % Append PDF outputs into one PDF (separately for each module) (requires export_fig in the Gannet
41+
MRS_struct.p.append = 0; % Append PDF outputs into one PDF (separately for each module) (requires export_fig in the Gannet
4242
% folder to be added to the search path and GhostScript to be installed)
43-
MRS_struct.p.hide = 0; % Do not dynamically display output figures
43+
MRS_struct.p.hide = 0; % Do not display output figures
4444

4545
end
4646

GannetSegment.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
% for the GM, WM and CSF segmentations. If these files are present, they
88
% are loaded and used for the voxel segmentation
99

10-
MRS_struct.version.segment = '210331';
10+
MRS_struct.version.segment = '220607';
1111

1212
warning('off'); % temporarily suppress warning messages
1313

@@ -110,18 +110,18 @@
110110
airvol_thresh = airvol_tmp .* T1_tmp;
111111
airvol_thresh = airvol_thresh(:);
112112

113-
MRS_struct.out.tissue.CV_WM(ii) = std(WMvol_thresh, 'omitnan') / mean(WMvol_thresh, 'omitnan');
114-
MRS_struct.out.tissue.CV_GM(ii) = std(GMvol_thresh, 'omitnan') / mean(GMvol_thresh, 'omitnan');
115-
MRS_struct.out.tissue.CJV(ii) = (std(WMvol_thresh, 'omitnan') + std(GMvol_thresh, 'omitnan')) ...
113+
MRS_struct.out.QA.CV_WM(ii) = std(WMvol_thresh, 'omitnan') / mean(WMvol_thresh, 'omitnan');
114+
MRS_struct.out.QA.CV_GM(ii) = std(GMvol_thresh, 'omitnan') / mean(GMvol_thresh, 'omitnan');
115+
MRS_struct.out.QA.CJV(ii) = (std(WMvol_thresh, 'omitnan') + std(GMvol_thresh, 'omitnan')) ...
116116
/ abs(mean(WMvol_thresh, 'omitnan') - mean(GMvol_thresh, 'omitnan'));
117-
MRS_struct.out.tissue.CNR(ii) = abs(mean(WMvol_thresh, 'omitnan') - mean(GMvol_thresh, 'omitnan')) / ...
117+
MRS_struct.out.QA.CNR(ii) = abs(mean(WMvol_thresh, 'omitnan') - mean(GMvol_thresh, 'omitnan')) / ...
118118
sqrt(var(airvol_thresh, 'omitnan') + var(WMvol_thresh, 'omitnan') + var(GMvol_thresh, 'omitnan'));
119119

120120
T1_tmp = T1_tmp(:);
121121
n_vox = numel(T1_tmp);
122122
efc_max = n_vox * (1/sqrt(n_vox)) * log(1/sqrt(n_vox));
123123
b_max = sqrt(sum(T1_tmp.^2));
124-
MRS_struct.out.tissue.EFC(ii) = (1/efc_max) .* sum((T1_tmp ./ b_max) .* log((T1_tmp + eps) ./ b_max));
124+
MRS_struct.out.QA.EFC(ii) = (1/efc_max) .* sum((T1_tmp ./ b_max) .* log((T1_tmp + eps) ./ b_max));
125125

126126
% Voxel mask
127127
voxmaskvol = spm_vol(MRS_struct.mask.(vox{kk}).outfile{ii});

0 commit comments

Comments
 (0)