/ concept-collection / seqlab
Sign in
concept-collection / seqlab
seqlab / src / examples / pulseq / GRE_live_demo_step0.m
59 lines · 2.1 KBBlameHistoryRaw
1% Define FOV and resolution
2fov = 256e-3;
3sliceThickness = 5e-3;
4Nx = 128;
5Ny = Nx;
7% Define sequence parameters
8TE = 8e-3;
9TR = 16e-3;
10alpha=30;
12% set system limits
13sys = mr.opts('MaxGrad',20,'GradUnit','mT/m',...
14 'MaxSlew',120,'SlewUnit','T/m/s',...
15 'rfRingdownTime', 20e-6, 'rfDeadtime', 100e-6);
17% Create a new sequence object
18seq=mr.Sequence(sys);
20% Create slice selection alpha-pulse and corresponding gradients
21[rf, gz, gzReph] = mr.makeSincPulse(alpha*pi/180, 'Duration', 4e-3,...
22 'SliceThickness', sliceThickness, 'apodization', 0.5,'timeBwProduct', 4, ...
23 'system' ,sys,...
24 'use', 'excitation');
26% Define other gradients and ADC events
27deltak = 1/fov; % Pulseq toolbox defaults to k-space units of m^-1
28gx = mr.makeTrapezoid('x', 'FlatArea', Nx*deltak, 'FlatTime', 6.4e-3);
29adc = mr.makeAdc(Nx, 'Duration', gx.flatTime, 'Delay', gx.riseTime);
30gxPre = mr.makeTrapezoid('x', 'Area', -gx.area/2, 'Duration', 2e-3);
31phaseAreas = ((0:Ny-1)-Ny/2)*deltak;
33% Calculate timing
34delayTE = round((TE - mr.calcDuration(gxPre) - mr.calcDuration(gz)/2 ...
35 - mr.calcDuration(gx)/2)/seq.gradRasterTime)*seq.gradRasterTime;
36delayTR = round((TR - mr.calcDuration(gxPre) - mr.calcDuration(gz) ...
37 - mr.calcDuration(gx) - delayTE)/seq.gradRasterTime)*seq.gradRasterTime;
38% Loop over phase encodes and define sequence blocks
39for i=1:Ny
40 seq.addBlock(rf, gz);
41 gyPre = mr.makeTrapezoid('y', 'Area', phaseAreas(i), 'Duration', 2e-3);
42 seq.addBlock(gxPre, gyPre, gzReph);
43 seq.addBlock(mr.makeDelay(delayTE));
44 seq.addBlock(gx, adc);
45 seq.addBlock(mr.makeDelay(delayTR));
46end
48% check whether the timing of the sequence is correct
49[ok, error_report]=seq.checkTiming;
51if (~ok)
52 fprintf('Timing check failed! Sequence probably will not run on the scanner.\n');
53end
55% export definitions
56seq.setDefinition('FOV', [fov fov sliceThickness]);
57seq.setDefinition('Name', 'DEMO_gre0'); % if submitting a sequence please write your name to the Name field of the definition section
59seq.write('DEMO_grep0.seq') % Write to pulseq file
moveopenescclose