Skip to content

Commit

Permalink
Several minor changes
Browse files Browse the repository at this point in the history
- Updated README.md
- Coil combination of TWIX data now performed using GLS
- Added support for new JHU universal sequence for Siemens data
- Turned off warnings of iteration limits in SpectralRegistrationHERMES.m
- Some cosmetic changes
  • Loading branch information
markmikkelsen committed Oct 20, 2022
1 parent 7612074 commit 1ba4049
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 151 deletions.
60 changes: 31 additions & 29 deletions GERead.m
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
MetabData = ShapeData(:,:,refframes+2:end,:) * mult / 2;

totalframes = totalframes - (refframes + 1);

MRS_struct.p.nrows(ii) = totalframes;
MRS_struct.p.Navg(ii) = dataframes * nex;
MRS_struct.p.Nwateravg(ii) = refframes * nex;
Expand Down Expand Up @@ -335,20 +335,20 @@

ShapeData = reshape(raw_data, [2 MRS_struct.p.npoints(ii) totalframes nreceivers]);

[X1,X2] = ndgrid(1:refframes, 1:nechoes);
X1 = X1'; X1 = X1(:);
X2 = X2'; X2 = X2(:);
Y1 = (-1).^(MRS_struct.p.GE.noadd(ii) * (X1-1));
Y1 = permute(repmat(Y1, [1 MRS_struct.p.npoints(ii) 2 nreceivers]), [3 2 1 4]);
Y2 = 1 + (totalframes/nechoes) * (X2-1) + X1;
[X1,X2] = ndgrid(1:refframes, 1:nechoes);
X1 = X1'; X1 = X1(:);
X2 = X2'; X2 = X2(:);
Y1 = (-1).^(MRS_struct.p.GE.noadd(ii) * (X1-1));
Y1 = permute(repmat(Y1, [1 MRS_struct.p.npoints(ii) 2 nreceivers]), [3 2 1 4]);
Y2 = 1 + (totalframes/nechoes) * (X2-1) + X1;
WaterData = Y1 .* ShapeData(:,:,Y2,:) * multw;

[X1,X2] = ndgrid(1:dataframes, 1:nechoes);
X1 = X1'; X1 = X1(:);
X2 = X2'; X2 = X2(:);
Y1 = (-1).^(MRS_struct.p.GE.noadd(ii) * (X1-1));
Y1 = permute(repmat(Y1, [1 MRS_struct.p.npoints(ii) 2 nreceivers]), [3 2 1 4]);
Y2 = 1 + refframes + (totalframes/nechoes) * (X2-1) + X1;
[X1,X2] = ndgrid(1:dataframes, 1:nechoes);
X1 = X1'; X1 = X1(:);
X2 = X2'; X2 = X2(:);
Y1 = (-1).^(MRS_struct.p.GE.noadd(ii) * (X1-1));
Y1 = permute(repmat(Y1, [1 MRS_struct.p.npoints(ii) 2 nreceivers]), [3 2 1 4]);
Y2 = 1 + refframes + (totalframes/nechoes) * (X2-1) + X1;
MetabData = Y1 .* ShapeData(:,:,Y2,:) * mult;

totalframes = totalframes - (refframes + 1) * nechoes; % RTN 2017
Expand All @@ -362,30 +362,32 @@
WaterData = permute(WaterData, [3 1 2]);

% Generalized least squares method (An et al., JMRI, 2013, doi:10.1002/jmri.23941)
[nCh, nPts, nReps] = size(WaterData);
noise_pts = false(1,nPts);
[nCh, nPts, nReps] = size(WaterData);
noise_pts = false(1,nPts);
noise_pts(ceil(0.75*nPts):end) = true;
noise_pts = repmat(noise_pts, [1 nReps]);
tmpWaterData = reshape(WaterData, [nCh nPts*nReps]);
noise_pts = repmat(noise_pts, [1 nReps]);
tmpWaterData = reshape(WaterData, [nCh nPts*nReps]);

e = tmpWaterData(:,noise_pts);
Psi = e*e';
e = tmpWaterData(:,noise_pts);
Psi = e*e';
WaterData_avg = mean(WaterData,3);
S = WaterData_avg(:,1);
w = (S'*(Psi\S))^-1 * S' / Psi;
WaterData = w.' .* WaterData;
S = WaterData_avg(:,1);
w = (S'*(Psi\S))^-1 * S' / Psi;
WaterData = w.' .* WaterData;

MRS_struct.fids.data_water = mean(squeeze(sum(WaterData,1)),2);

[nCh, nPts, nReps] = size(MetabData);
noise_pts = false(1,nPts);
[nCh, nPts, nReps] = size(MetabData);
noise_pts = false(1,nPts);
noise_pts(ceil(0.75*nPts):end) = true;
noise_pts = repmat(noise_pts, [1 nReps]);
tmpMetabData = reshape(MetabData, [nCh nPts*nReps]);
noise_pts = repmat(noise_pts, [1 nReps]);
tmpMetabData = reshape(MetabData, [nCh nPts*nReps]);

e = tmpMetabData(:,noise_pts);
Psi = e*e';
w = (S'*(Psi\S))^-1 * S' / Psi;
e = tmpMetabData(:,noise_pts);
Psi = e*e';
w = (S'*(Psi\S))^-1 * S' / Psi;
MetabData = w.' .* MetabData;

MRS_struct.fids.data = squeeze(sum(MetabData,1));

end
Expand Down
2 changes: 1 addition & 1 deletion GannetPreInitialise.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
MRS_struct.p.mat = 0; % Save MRS_struct as a .mat file
MRS_struct.p.csv = 0; % Extract useful data from MRS_struct and export them to a .csv file (applies to GannetFit,
% GannetSegment and GannetQuantify)
MRS_struct.p.append = 0; % Append PDF outputs into one PDF (separately for each module) (requires export_fig in the Gannet
MRS_struct.p.append = 1; % Append PDF outputs into one PDF (separately for each module) (requires export_fig in the Gannet
% folder to be added to the search path and GhostScript to be installed)
MRS_struct.p.hide = 0; % Do not display output figures

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ __It is highly recommended that you only add the main SPM12 folder (_spm12_) to

## Compatibility

Gannet is currently being developed in MATLAB R2021a in macOS 11.4 Big Sur. While reasonable effort is made to ensure legacy and cross-OS compatibility, an error-free user experience is not guaranteed.
Gannet is currently being developed in MATLAB R2022b in macOS 12.6 Monterey. While reasonable effort is made to ensure legacy and cross-OS compatibility, an error-free user experience is not guaranteed.

## Supported file formats

Expand Down
Loading

0 comments on commit 1ba4049

Please sign in to comment.