Contents
sys = mr.opts('MaxGrad', 28, 'GradUnit', 'mT/m', ...
'MaxSlew', 170, 'SlewUnit', 'T/m/s', 'rfRingdownTime', 0e-6, ...
'rfDeadTime', 100e-6, 'adcDeadTime', 10e-6);
seq=mr.Sequence(sys);
fov=240e-3; Nx=240;
alpha=10;
sliceThickness=5e-3;
TR=20e-3;
Nr=Nx*2;
Ndummy=20;
delta= 2* pi / Nr;
rf_duration=0.5e-3;
ro_duration=0.720e-3;
ro_os=2;
minRF_to_ADC_time=70e-6;
ro_discard=0;
ro_spoil=1;
rfSpoilingInc=117;
Create alpha-degree slice selection pulse and gradient
[rf, gz] = mr.makeSincPulse(alpha*pi/180,'Duration',rf_duration,...
'SliceThickness',sliceThickness,'apodization',0.5,'timeBwProduct',2,...
'centerpos',1,'system',sys);
gza=[0 1 1 0];
gzt=cumsum([0 gz.riseTime gz.flatTime gz.fallTime]);
gzas_0=interp1(gzt+gz.delay,gza,rf.t+rf.delay);
rft_1=[sys.rfRasterTime:sys.rfRasterTime:rf_duration+0.5*gz.fallTime];
gzas_1=interp1(gzt+gz.delay,gza,rft_1+rf.delay+gz.fallTime*0.5);
gzas_1(~isfinite(gzas_1))=0;
kzs_0=cumsum(gzas_0);
kzs_1=cumsum(gzas_1);
kzs_0=kzs_0-max(kzs_0);
kzs_1=kzs_1-max(kzs_1);
rfs_1=diff([0 interp1(kzs_0,cumsum(rf.signal),kzs_1)]);
figure; plot(kzs_1, abs(rfs_1),'r.');
hold; plot(kzs_0, abs(rf.signal),'b-');
rf.t=rft_1;
rf.shape_dur=length(rfs_1)*sys.rfRasterTime;
gz.flatTime=ceil((gz.flatTime-gz.fallTime*0.5)/sys.gradRasterTime)*sys.gradRasterTime;
rf.delay=mr.calcDuration(rf,gz)-rf.shape_dur;
rf.signal=rfs_1;
Nxo=round(ro_os*Nx);
deltak=1/fov/2;
ro_area=Nx*deltak;
gx = mr.makeTrapezoid('x','FlatArea',ro_area,'FlatTime',ro_duration,'system',sys);
adc_dur=floor(gx.flatTime/Nxo*1e7)*1e-7*Nxo;
adc = mr.makeAdc(Nxo,'Duration',adc_dur,'system',sys);
gx.flatTime=gx.flatTime*ro_spoil;
TE = ceil((minRF_to_ADC_time + adc.dwell*ro_discard)/seq.gradRasterTime)*seq.gradRasterTime;
delayTR=ceil((TR - mr.calcDuration(gz) ...
- mr.calcDuration(gx) - TE)/seq.gradRasterTime)*seq.gradRasterTime;
fprintf('TE= %d us; delay in TR:= %d us\n', round(TE*1e6), floor(delayTR*1e6));
gx.delay=mr.calcDuration(gz)+TE;
adc.delay=floor((gx.delay-adc.dwell*0.5-adc.dwell*ro_discard)/sys.gradRasterTime)*sys.gradRasterTime;
rf_phase=0;
rf_inc=0;
if Ndummy>0
seq.addBlock(mr.makeLabel('SET','ONCE', 1));
end
for i=(-Ndummy+1):Nr
if Ndummy>0 && i==1
seq.addBlock(mr.makeLabel('SET','ONCE', 0));
end
for c=1:2
rf.phaseOffset=rf_phase/180*pi;
adc.phaseOffset=rf_phase/180*pi;
rf_inc=mod(rf_inc+rfSpoilingInc, 360.0);
rf_phase=mod(rf_phase+rf_inc, 360.0);
gz.amplitude=-gz.amplitude;
phi=delta*(i-1);
grc=gx; grs=gx; grc.amplitude=gx.amplitude*cos(phi); grs.amplitude=gx.amplitude*sin(phi); grs.channel='y';
if (i>0)
seq.addBlock(rf,gz,grc,grs,adc);
else
seq.addBlock(rf,gz,grc,grs);
end
seq.addBlock(mr.makeDelay(delayTR));
end
end
seq.plot();
Current plot held
TE= 70 us; delay in TR:= 18330 us
check whether the timing of the sequence is correct
[ok, error_report]=seq.checkTiming;
if (ok)
fprintf('Timing check passed successfully\n');
else
fprintf('Timing check failed! Error listing follows:\n');
fprintf([error_report{:}]);
fprintf('\n');
end
Timing check passed successfully
export
seq.setDefinition('FOV', [fov fov sliceThickness]);
seq.setDefinition('Name', 'ute_rs');
seq.write('ute_rs.seq');
return
plot gradients to check for gaps and optimality of the timing
gw=seq.waveforms_and_times();
figure; plot(gw{1}(1,:),gw{1}(2,:),gw{2}(1,:),gw{2}(2,:),gw{3}(1,:),gw{3}(2,:));
title('gradient waveforms');
k-space trajectory calculation
[ktraj_adc, t_adc, ktraj, t_ktraj, t_excitation, t_refocusing] = seq.calculateKspacePP();
figure; plot(t_ktraj, ktraj');
hold; plot(t_adc,ktraj_adc(1,:),'.');
title('k-space components as functions of time');
figure; plot(ktraj(1,:),ktraj(2,:),'b');
hold;plot(ktraj_adc(1,:),ktraj_adc(2,:),'r.');
axis('square');
axis('tight');
title('2D k-space');
very optional slow step, but useful for testing during development e.g. for the real TE, TR or for staying within slewrate limits
rep = seq.testReport;
fprintf([rep{:}]);