/ concept-collection / seqlab
Sign in
concept-collection / seqlab
seqlab / src / examples / pulseq / EpiSpinEcho.m
77 lines · 3.0 KBBlameHistoryRaw
1% Define FOV and resolution
2fov=256e-3; Nx=64; Ny=64;
3thickness=3e-3;
4% Set system limits
5lims = mr.opts('MaxGrad', 32, 'GradUnit', 'mT/m',...
6 'MaxSlew', 130, 'SlewUnit', 'T/m/s', 'rfRingdownTime', 20e-6, ...
7 'rfDeadTime', 100e-6, 'adcDeadTime', 20e-6);
8% Create a new sequence object
9seq=mr.Sequence(lims);
11% Create 90 degree slice selection pulse and gradient
12[rf, gz] = mr.makeSincPulse(pi/2,lims,'Duration',3e-3,...
13 'SliceThickness',thickness,'apodization',0.5,'timeBwProduct',4,...
14 'use','excitation');
16% Define other gradients and ADC events
17deltak=1/fov;
18kWidth = Nx*deltak;
19readoutTime = 3.2e-4;
20gx = mr.makeTrapezoid('x',lims,'FlatArea',kWidth,'FlatTime',readoutTime);
21adc = mr.makeAdc(Nx,lims,'Duration',gx.flatTime,'Delay',gx.riseTime);
23% Pre-phasing gradients
24preTime=8e-4;
25%gxPre = mr.makeTrapezoid('x',lims,'Area',-gx.area/2-deltak/2,'Duration',preTime);
26gzReph = mr.makeTrapezoid('z',lims,'Area',-gz.area/2,'Duration',preTime);
27%gyPre = mr.makeTrapezoid('y',lims,'Area',-Ny/2*deltak,'Duration',preTime);
28% we need no minus for in-plane prephasers because of the spin-echo (position reflection in k-space)
29gxPre = mr.makeTrapezoid('x',lims,'Area',gx.area/2-deltak/2,'Duration',preTime);
30gyPre = mr.makeTrapezoid('y',lims,'Area',Ny/2*deltak,'Duration',preTime);
32% Phase blip in shortest possible time
33dur = ceil(2*sqrt(deltak/lims.maxSlew)/10e-6)*10e-6;
34gy = mr.makeTrapezoid('y',lims,'Area',deltak,'Duration',dur);
36% Refocusing pulse with spoiling gradients
37rf180 = mr.makeBlockPulse(pi,lims,'Duration',500e-6,'use','refocusing');
38gzSpoil = mr.makeTrapezoid('z',lims,'Area',gz.area*2,'Duration',3*preTime);
40% Calculate delay time %% MZ: I thisk this is very wrong!
41TE=60e-3;
42durationToCenter = (Nx/2+0.5)*mr.calcDuration(gx) + Ny/2*mr.calcDuration(gy);
43rfCenterInclDelay=rf.delay + mr.calcRfCenter(rf);
44rf180centerInclDelay=rf180.delay + mr.calcRfCenter(rf180);
45delayTE1=TE/2 - mr.calcDuration(gz) + rfCenterInclDelay - preTime - mr.calcDuration(gzSpoil) - rf180centerInclDelay;
46delayTE2=TE/2 - mr.calcDuration(rf180) + rf180centerInclDelay - mr.calcDuration(gzSpoil) - durationToCenter;
48% Define sequence blocks
49seq.addBlock(rf,gz);
50seq.addBlock(gxPre,gyPre,gzReph);
51seq.addBlock(mr.makeDelay(delayTE1));
52seq.addBlock(gzSpoil);
53seq.addBlock(rf180);
54seq.addBlock(gzSpoil);
55seq.addBlock(mr.makeDelay(delayTE2));
56for i=1:Ny
57 seq.addBlock(gx,adc); % Read one line of k-space
58 seq.addBlock(gy); % Phase blip
59 gx.amplitude = -gx.amplitude; % Reverse polarity of read gradient
60end
61seq.addBlock(mr.makeDelay(1e-4));
63%% check whether the timing of the sequence is correct
64[ok, error_report]=seq.checkTiming;
66if (ok)
67 fprintf('Timing check passed successfully\n');
68else
69 fprintf('Timing check failed! Error listing follows:\n');
70 fprintf([error_report{:}]);
71 fprintf('\n');
72end
74%% export and visualization
75seq.setDefinition('FOV', [fov fov thickness]);
76seq.setDefinition('Name', 'epise');
77seq.write('epi_se.seq'); % Output sequence for scanner
moveopenescclose