Skip to content

Commit

Permalink
Merge pull request #685 from HJZollner/develop
Browse files Browse the repository at this point in the history
[FEATURE] - Support CMRR sequence with integrated water refernece
  • Loading branch information
HJZollner authored Dec 21, 2023
2 parents 637b340 + 8d65313 commit 78a7f89
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
17 changes: 16 additions & 1 deletion load/osp_LoadTwix.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,26 @@
if ~(MRSCont.flags.didLoad == 1 && MRSCont.flags.speedUp && isfield(MRSCont, 'raw') && (kk > length(MRSCont.raw))) || ~strcmp(MRSCont.ver.Osp,MRSCont.ver.CheckOsp)
% Read in the raw metabolite data
metab_ll = MRSCont.opts.MultipleSpectra.metab(ll);
raw = io_loadspec_twix(MRSCont.files{metab_ll,kk});
[raw, raw_ref] = io_loadspec_twix(MRSCont.files{metab_ll,kk});
raw = op_leftshift(raw,raw.pointsToLeftshift);
if ~isempty(raw_ref)
raw_ref = op_leftshift(raw_ref,raw_ref.pointsToLeftshift);
ref_ll = MRSCont.opts.MultipleSpectra.metab(ll);
MRSCont.opts.MultipleSpectra.ref(ll) = MRSCont.opts.MultipleSpectra.metab(ll);
end
if strcmp(raw.seq,'SLASER_D')
raw = op_truncate(raw,2068,0);
if ~isempty(raw_ref)
raw_ref = op_leftshift(raw_ref,raw_ref.pointsToLeftshift);
end
end
% Add NIfTI-MRS information
raw = osp_add_nii_mrs_field(raw,MRSCont.ver.Osp);
MRSCont.raw_uncomb{ll,kk} = raw;
if ~isempty(raw_ref)
raw_ref = osp_add_nii_mrs_field(raw_ref,MRSCont.ver.Osp);
MRSCont.raw_ref_uncomb{ll,kk} = raw_ref;
end
% Read in the raw reference data. If a reference exists, perform the
% coil combination based on the reference, and perform an eddy current
% correction. If not, combine metabolite data based on its own signal.
Expand All @@ -83,6 +95,9 @@
MRSCont.raw_ref_uncomb{ref_ll,kk} = raw_ref;
else
ref_ll = 1;
if ~isempty(raw_ref)
MRSCont.flags.hasRef = 1;
end
end
if MRSCont.flags.hasWater
w_ll = MRSCont.opts.MultipleSpectra.w(ll);
Expand Down
2 changes: 1 addition & 1 deletion plot/osp_plotLoad.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
[~,filen,ext] = fileparts(MRSCont.files_mm{ExpIndex,kk});% re_mm
figTitle = sprintf(['Load MM data plot: ' filen ext '\n']);% re_mm
case 'ref'
if ~(strcmp(MRSCont.datatype,'P') || strcmp(MRSCont.datatype,'DATA'))
if ~(strcmp(MRSCont.datatype,'P') || strcmp(MRSCont.datatype,'DATA') || isempty(MRSCont.files_ref))
[~,filen,ext] = fileparts(MRSCont.files_ref{ExpIndex,kk});
figTitle = sprintf(['Load water reference data plot: ' filen ext '\n']);
else
Expand Down
1 change: 1 addition & 0 deletions process/osp_combineCoils.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
else
cweights_w = op_getcoilcombos(MRSCont.raw_w_uncomb{w_ll,kk}, 1, 'h');
end
cweights_w.ref = 'raw_w';
raw_w_comb = op_addrcvrs(MRSCont.raw_w_uncomb{w_ll,kk},1,'h',cweights_w);
raw_w_comb.flags.isUnEdited = 1;
MRSCont.raw_w{w_ll,kk} = raw_w_comb;
Expand Down

0 comments on commit 78a7f89

Please sign in to comment.