Contents
fov=256e-3; Nx=96; Ny=Nx;
sliceThickness=3e-3;
Nslices=1;
Oversampling=2;
phi=pi/2;
sys = mr.opts('MaxGrad',30,'GradUnit','mT/m',...
'MaxSlew',120,'SlewUnit','T/m/s',...
'rfRingdownTime', 30e-6, 'rfDeadtime', 100e-6, 'adcDeadTime', 10e-6, 'adcSamplesLimit', 8192);
seq=mr.Sequence(sys);
warning('OFF', 'mr:restoreShape');
B0=2.89;
sat_ppm=-3.45;
sat_freq=sat_ppm*1e-6*B0*sys.gamma;
rf_fs = mr.makeGaussPulse(110*pi/180,'system',sys,'Duration',8e-3,...
'bandwidth',abs(sat_freq),'freqOffset',sat_freq);
gz_fs = mr.makeTrapezoid('z',sys,'delay',mr.calcDuration(rf_fs),'Area',1/1e-4);
[rf, gz] = mr.makeSincPulse(pi/2,'system',sys,'Duration',3e-3,...
'SliceThickness',sliceThickness,'apodization',0.5,'timeBwProduct',4);
deltak=1/fov;
kRadius = round(Nx/2);
kSamples=round(2*pi*kRadius)*Oversampling;
readoutTime = 4.2e-4;
clear ka;
ka(kRadius*kSamples+1)=1i;
for c=0:kRadius*kSamples
r=deltak*c/kSamples;
a=mod(c,kSamples)*2*pi/kSamples;
ka(c+1)=r*exp(1i*a);
end
ka=[real(ka); imag(ka)];
[ga, sa]=mr.traj2grad(ka);
safety_magrin=0.94;
dt_gcomp=abs(ga)/(sys.maxGrad*safety_magrin)*sys.gradRasterTime;
dt_gabs=abs(ga(1,:)+1i*ga(2,:))/(sys.maxGrad*safety_magrin)*sys.gradRasterTime;
dt_scomp=sqrt(abs(sa)/(sys.maxSlew*safety_magrin))*sys.gradRasterTime;
dt_sabs=sqrt(abs(sa(1,:)+1i*sa(2,:))/(sys.maxSlew*safety_magrin))*sys.gradRasterTime;
figure;plot([dt_gabs; max(dt_gcomp); dt_sabs; max(dt_scomp)]');title('time stepping defined by gradient and slew-rate');
dt_smooth=max([dt_gabs;dt_sabs]);
dt_rough=max([dt_gcomp;dt_scomp]);
dt_min=4*sys.gradRasterTime/kSamples;
dt_smooth0=dt_smooth;
dt_rough0=dt_rough;
dt_smooth(dt_smooth<dt_min)=dt_min;
dt_rough(dt_rough<dt_min)=dt_min;
figure;plot([dt_smooth0; dt_smooth; dt_rough0; dt_rough]');title('combined time stepping');
t_smooth=[0 cumsum(dt_smooth,2)];
t_rough=[0 cumsum(dt_rough,2)];
kopt_smooth=interp1(t_smooth, ka', (0:floor(t_smooth(end)/sys.gradRasterTime))*sys.gradRasterTime)';
kopt_rough=interp1(t_rough, ka', (0:floor(t_rough(end)/sys.gradRasterTime))*sys.gradRasterTime)';
fprintf('duration orig %d us\n', round(1e6*sys.gradRasterTime*length(ka)));
fprintf('duration smooth %d us\n', round(1e6*sys.gradRasterTime*length(kopt_smooth)));
fprintf('duration rough %d us\n', round(1e6*sys.gradRasterTime*length(kopt_rough)));
[gos, sos]=mr.traj2grad(kopt_smooth);
[gor, sor]=mr.traj2grad(kopt_rough);
figure;plot([gos;abs(gos(1,:)+1i*gos(2,:))]');title('gradient with smooth (abs) constraint')
figure;plot([gor;abs(gor(1,:)+1i*gor(2,:))]');title('gradient with rough (component) constraint')
figure;plot([sos;abs(sos(1,:)+1i*sos(2,:))]');title('slew rate with smooth (abs) constraint')
figure;plot([sor;abs(sor(1,:)+1i*sor(2,:))]');title('slew rate with rough (component) constraint')
spiral_grad_shape=gos;
[rf, gz] = mr.makeSincPulse(pi/2,'system',sys,'Duration',3e-3,...
'SliceThickness',sliceThickness,'apodization',0.5,'timeBwProduct',4);
gzReph = mr.makeTrapezoid('z',sys,'Area',-gz.area/2);
adcTime = sys.gradRasterTime*size(spiral_grad_shape,2);
adcSamplesDesired=kRadius*kSamples;
adcDwell=round(adcTime/adcSamplesDesired/sys.adcRasterTime)*sys.adcRasterTime;
adcSamplesDesired=ceil(adcTime/adcDwell);
[adcSegments,adcSamplesPerSegment]=mr.calcAdcSeg(adcSamplesDesired,adcDwell,sys);
adcSamples=adcSegments*adcSamplesPerSegment;
adc = mr.makeAdc(adcSamples,'Dwell',adcDwell,'Delay',mr.calcDuration(gzReph));
spiral_grad_shape = [spiral_grad_shape spiral_grad_shape(:,end)];
gx = mr.makeArbitraryGrad('x',spiral_grad_shape(1,:),'Delay',mr.calcDuration(gzReph));
gy = mr.makeArbitraryGrad('y',spiral_grad_shape(2,:),'Delay',mr.calcDuration(gzReph));
gz_spoil=mr.makeTrapezoid('z',sys,'Area',deltak*Nx*4);
gx_spoil=mr.makeExtendedTrapezoid('x','times',[0 mr.calcDuration(gz_spoil)],'amplitudes',[spiral_grad_shape(1,end),0]);
gy_spoil=mr.makeExtendedTrapezoid('y','times',[0 mr.calcDuration(gz_spoil)],'amplitudes',[spiral_grad_shape(2,end),0]);
for s=1:Nslices
seq.addBlock(rf_fs,gz_fs);
rf.freqOffset=gz.amplitude*sliceThickness*(s-1-(Nslices-1)/2);
seq.addBlock(rf,gz);
seq.addBlock(mr.rotate('z',phi,gzReph,gx,gy,adc));
seq.addBlock(mr.rotate('z',phi,gx_spoil,gy_spoil,gz_spoil));
end
[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
seq.setDefinition('FOV', [fov fov sliceThickness]);
seq.setDefinition('Name', 'spiral');
seq.setDefinition('MaxAdcSegmentLength', adcSamplesPerSegment);
seq.write('spiral.seq');
seq.plot();
duration orig 289930 us
duration smooth 39760 us
duration rough 37680 us
Timing check passed successfully
k-space trajectory calculation
[ktraj_adc, t_adc, ktraj, t_ktraj, t_excitation, t_refocusing] = seq.calculateKspacePP();
figure; plot(t_ktraj, ktraj'); title('k-space components as functions of time');
figure; plot(ktraj(1,:),ktraj(2,:),'b');
hold;plot(ktraj_adc(1,:),ktraj_adc(2,:),'r.'); title('2D k-space');
Current plot held