Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:toppeMRI/toppe into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dinankg committed Feb 12, 2024
2 parents aed51d9 + 7316269 commit a4e03c3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
26 changes: 26 additions & 0 deletions +toppe/+utils/getk.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function [kxo, kxe] = getk(sysGE, readoutFile, nfid, del)
% Get kspace sample locations from .mod file
%
% Inputs:
% sysGE see toppe.systemspecs()
% readoutFile .mod file name containing ADC window
% nfid number of acquired samples in ADC window
%
% Option:
% del offset by this many samples (default: 0)
%
% Outputs:
% kxo [1 nfid], odd echo k-space, cycles/cm
% kxe [1 nfid], even echo k-space, cycles/cm

if nargin < 4
del = 0.0;
end

[rf,gx,gy,gz,desc,paramsint16,paramsfloat,hdr] = toppe.readmod(readoutFile);
kx = sysGE.raster*1e-6*sysGE.gamma*1e-4*cumsum(gx); % cycles/cm
kx = kx - kx(end)/2;
kx = kx((hdr.npre+1):(hdr.npre+nfid));
kxo = interp1(1:nfid, kx, (1:nfid) - 0.5 - del, 'linear', 'extrap');
kxe = interp1(1:nfid, kx, (1:nfid) + 0.5 + del, 'linear', 'extrap');
kxe = fliplr(kxe);
3 changes: 1 addition & 2 deletions +toppe/plotseq.m
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@

p = loop(n,1); % module id
w = loop(n,16); % waveform index

dur = 0;

% Pure delay block
Expand Down Expand Up @@ -330,7 +329,7 @@

% Calculate RF and gradient waveforms for this block
rho1 = [ia_rf/max_pg_iamp*abs(modules{p}.rf(:,w))];
th1 = [ia_rf/max_pg_iamp*angle(modules{p}.rf(:,w))];
th1 = angle(modules{p}.rf(:,w));
gxit = ia_gx/max_pg_iamp*modules{p}.gx(:,w);
gyit = ia_gy/max_pg_iamp*modules{p}.gy(:,w);
gzit = ia_gz/max_pg_iamp*modules{p}.gz(:,w);
Expand Down
8 changes: 4 additions & 4 deletions +toppe/preflightcheck.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function preflightcheck(entryFile, seqstampFile, sysGE)
modArr = toppe.tryread(@toppe.readmodulelistfile, moduleListFile);

% Check that:
% - all .mod files use the same peak RF limit (e.g., 0.25 Gauss)
% - b1CheckFile represents the RF pulse with peak RF amplitude across the whole the sequence
% - all .mod files used to acquire data have the same number of ADC samples as readoutFilterFile.
[~,~,~,~,~,~,~,hdr] = toppe.readmod(b1CheckFile);
b1limit = hdr.b1max;
Expand All @@ -82,8 +82,8 @@ function preflightcheck(entryFile, seqstampFile, sysGE)
error(sprintf('Number of samples in %s and %s do not match (must be same across all .mod files containing ADC windows)', ...
readoutFilterFile, modArr{ii}.fname));
end
if hdr.b1max ~= b1limit
error(sprintf('B1 limit in %s does not match %s (must be the same across all .mod files)', ...
if modArr{ii}.hasRF & hdr.b1max > b1limit
error(sprintf('Peak B1 limit in %s cannot exceed the b1 scaling .mod file in %s', ...
modArr{ii}.fname, entryFile));
end
end
Expand Down Expand Up @@ -196,7 +196,7 @@ function preflightcheck(entryFile, seqstampFile, sysGE)
fprintf(fout, '%.4f\n', max(abs(rf))); % needed to scale max_seqsar in .e file
fprintf(fout, '%.4f\n', gmax); % max gradient across all .mod files (Gauss)
fprintf(fout, '%.4f\n', slewmax); % max slew across all .mod files (G/cm/ms)
fprintf(fout, '%.4f\n', b1limit); % hardware b1 limit (Gauss)
fprintf(fout, '%.4f\n', b1limit); % peak B1 in sequence (Gauss)

fclose(fout);

Expand Down
3 changes: 2 additions & 1 deletion +toppe/writemod.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ function writemod(sysGE, varargin)
dtycyc = length(find(abs(b1)>0.2236*max(abs(b1)))) / length(b1);
maxpw = dtycyc;
num = 1;
max_b1 = sysGE.maxRF; % Gauss. Full instruction amplitude (32766) should produce max_b1 RF amplitude,
max_b1 = sysGE.maxRF; % Gauss. Full instruction amplitude (32766) should produce max_b1 RF amplitude,
%max_b1 = max(abs(b1(:))); % Gauss
% as long as other RF .mod files (if any) use the same max_b1.
max_int_b1_sq = max( cumsum(abs(b1).^2)*dt*1e3 ); % Gauss^2 - ms
max_rms_b1 = sqrt(mean(abs(b1).^2)); % Gauss
Expand Down

0 comments on commit a4e03c3

Please sign in to comment.