Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions code/compMRS_DPload.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,22 @@
for n = 1:check.nSes(m)
sess=dir([DPid filesep subjs(m).name filesep 'ses*']);

%Find the MRS data path and the REF data path:
%Find the MRS data path and the REF data path (if applicable):
svspath = dir([DPid filesep subjs(m).name filesep sess(n).name filesep 'mrs' filesep '*svs']);
refpath = dir([DPid filesep subjs(m).name filesep sess(n).name filesep 'mrs' filesep '*mrsref']);

% need to find out whether the ref data is acquired separately
% or included with the metabolite data
% For PV6 and higher where only one directory is expected to
% exist if water data was acquired automatically, or two
% directories if the water data was acquired separately
% Only one directory is expected to exist if water data was
% acquired automatically, or two directories if the water data
% was acquired separately

% The syntax is different for ParaVision 7: it is usually
% 'PV-7' while in version 6 it is PV 6 with a space...
if contains(check.version{1}, ["PV 6", "PV 7", "PV-7", "PV-360", "PV 360"])

% refscan may be acquired automatically
[out{m,n}, outw_auto{m,n}]=compMRS_loadspecBruker([svspath(length(svspath)).folder filesep svspath(length(svspath)).name],'y');

% If there was a refscan acquired separatly, load it as well
if ~isempty(svspath) && ~isempty(refpath) % refscan acquired separately
[outw{m,n}]=compMRS_loadspecBruker([refpath(length(refpath)).folder filesep refpath(length(refpath)).name],'y');
end

%If PV5, then the water reference scans must be collected
%separately:
elseif str2num(extractBetween(check.version{m,n}, 'PV ', '.')) == 5
if exist([svspath(length(svspath)).folder filesep svspath(length(svspath)).name]) && exist([refpath(length(refpath)).folder filesep refpath(length(refpath)).name]) % refscan acquired separately
[out{m,n}]=compMRS_loadspecBruker([svspath(length(svspath)).folder filesep svspath(length(svspath)).name],'y');
[outw{m,n}]=compMRS_loadspecBruker([refpath(length(refpath)).folder filesep refpath(length(refpath)).name],'y');
else
error(['ERROR: For PV5, must have both svs and ref directories!! Aborting!! '])
end
% refscan may be acquired automatically
[out{m,n}, outw_auto{m,n}]=compMRS_loadspecBruker([svspath(length(svspath)).folder filesep svspath(length(svspath)).name],'y');

% If there was a refscan acquired separatly, load it as well
if ~isempty(svspath) && ~isempty(refpath) % refscan acquired separately
[outw{m,n}]=compMRS_loadspecBruker([refpath(length(refpath)).folder filesep refpath(length(refpath)).name],'y');
end

end
end
elseif strcmp(check.vendor(1),'VARIAN')
Expand Down
Loading