void pulsesequence() { double pwx; char rcvrsflag[MAXSTR]; pwx = getval("pwx"); getstr("rcvrs",rcvrsflag); /* check decoupling modes */ if ( (dm[C] == 'y') || (dm[D] == 'y') || (h**o[0] == 'y') ) { printf("dm[C], dm[D] should be set to 'n' and/or h**o should set to 'n'"); psg_abort(1); } if (strcmp(rcvrsflag,"yy")) printf("rcvrs parameter should be set to 'yy'\n"); settable(t1,4,ph1); getelem(t1,ct,v1); assign(v1,oph); settable(t2,4,ph2); status(A); obspower(tpwr); decpower(dpwr); delay(d1); status(B); delay(d2); rgpulse(pw, t2, rof1, rof2); status(C); setactivercvrs("yn"); startacq(alfa); acquire(np,1.0/sw); endacq(); status(B); delay(d2); decrgpulse(pwx, t2, rof1, rof2); status(D); setactivercvrs("ny"); startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values MPSEQ dec = getblew("blewH",0,0.0,0.0,0,1); strncpy(dec.ch,"dec",3); putCmd("chHblew='dec'\n"); CP hx = getcp("HX",0.0,0.0,0,1); strncpy(hx.fr,"dec",3); strncpy(hx.to,"obs",3); putCmd("frHX='dec'\n"); putCmd("toHX='obs'\n"); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pwH90") + getval("tHX") + getval("rd") + getval("ad") + at; d.dutyoff = d1 + 4.0e-6; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(phH90,4,table1); settable(phXhx,4,table2); settable(phHhx,4,table3); settable(phRec,4,table4); setreceiver(phRec); // Begin Sequence txphase(phXhx); decphase(phH90); obspwrf(getval("aXhx")); decpwrf(getval("aH90")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // H to X Cross Polarization decrgpulse(getval("pwH90"),phH90,0.0,0.0); decphase(phHhx); _cp_(hx,phHhx,phXhx); // Begin Acquisition _mpseqon(dec, phHhx); obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _mpseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
void pulsesequence() { double tro; char gread,gphase,gslice; char grdname[MAXSTR]; gread = 'z'; if (getorientation(&gread,&gphase,&gslice,"orient") < 0) abort_message("illegal value in orient parameter"); gro = getval("gro"); tro = getval("tro"); getstr("gname",grdname); /* equilibrium period */ status(A); hsdelay(d1); /* --- tau delay --- */ status(B); pulse(p1, zero); hsdelay(d2); /* --- observe period --- */ status(C); pulse(pw,oph); delay(0.0001); shapedgradient(grdname,tro,gro,gread,1,1); hsdelay(d2); startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { double pd, seqtime; initparms_sis(); /* initialize standard imaging parameters */ seqtime = at+pw+rof1+rof2; pd = tr - seqtime; /* predelay based on tr */ if (pd <= 0.0) { abort_message("%s: Requested tr too short. Min tr = %f ms",seqfil,seqtime*1e3); } status(A); delay(pd); xgate(ticks); /* --- observe period --- */ obspower(tpwr); shapedpulse(pwpat,pw,oph,rof1,rof2); startacq(alfa); acquire(np,1.0/sw); endacq(); }
void pulsesequence() { // Define Variables and Objects and Get Parameter Values DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pwX90"); d.dutyoff = d1 + 4.0e-6; d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(phX90,4,table1); settable(phRec,4,table2); setreceiver(phRec); // Begin Sequence txphase(phX90); decphase(zero); obspwrf(getval("aX90")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // X Direct Polarization rgpulse(getval("pwX90"),phX90,0.0,0.0); // Begin Acquisition _dseqon(dec); obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
void pulsesequence() { double pd, seqtime; double n,r,bigtau; double restol, resto_local; init_mri(); restol=getval("restol"); //local frequency offset roff=getval("roff"); //receiver offset init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2); /* hard pulse */ calc_rf(&p1_rf,"tpwr1","tpwr1f"); init_rf(&p2_rf,p2pat,p2,flip2,rof1,rof2); /* hard pulse */ calc_rf(&p2_rf,"tpwr2","tpwr2f"); /* calculate 'big tau' values */ bigtau = getval("bigtau"); n = bigtau/(2.0*d2); n = (double)((int)((n/2.0) + 0.5)) * 2.0; initval(n,v3); seqtime = at+p1+rof1+rof2; seqtime += 2*d2+p2+rof1+rof2; /* cpmg pulse and delay */ pd = tr - seqtime; /* predelay based on tr */ if (pd <= 0.0) { abort_message("%s: Requested tr too short. Min tr = %f ms",seqfil,seqtime*1e3); } resto_local=resto-restol; status(A); delay(pd); xgate(ticks); /* calculate exact delay and phases */ r = d2-p2/2.0-rof2; /* correct delay for pulse width */ mod2(oph,v2); /* 0,1,0,1 */ incr(v2); /* 1,2,1,2 = y,y,-y,-y */ obsoffset(resto_local); obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); rgpulse(p1,oph,rof1,rof2); /* 90deg */ obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); starthardloop(v3); delay(r); rgpulse(p2,v2,rof1,rof2); /* 180deg pulse */ delay(r); endhardloop(); startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { double pd, seqtime; double minte,ted1,ted2; double restol, resto_local; int vph180 = v2; /* Phase of 180 pulse */ init_mri(); /****needed ****/ restol=getval("restol"); //local frequency offset roff=getval("roff"); //receiver offset init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2); /* hard pulse */ calc_rf(&p1_rf,"tpwr1","tpwr1f"); init_rf(&p2_rf,p2pat,p2,flip2,rof1,rof2); /* hard pulse */ calc_rf(&p2_rf,"tpwr2","tpwr2f"); seqtime = at+(p1/2.0)+rof1+d2; pd = tr - seqtime; /* predelay based on tr */ if (pd <= 0.0) { abort_message("%s: Requested tr too short. Min tr = %f ms",seqfil,seqtime*1e3); } minte = p1/2.0 + p2 + 2*rof2 + rof1; if(d2 > 0) { if(d2 < minte+4e-6) abort_message("%s: TE too short. Min te = %f ms",seqfil,minte*1e3); } ted1 = d2/2 - p1/2 - p2/2 + rof2 + rof1; ted2 = d2/2 - p2/2 + rof2; resto_local=resto-restol; status(A); xgate(ticks); delay(pd); /* --- observe period --- */ obsoffset(resto_local); obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); shapedpulse(p1pat,p1,oph,rof1,rof2); /* if d2=0 no 180 pulse applied */ if (d2 > 0) { obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); settable(t2,2,ph180); /* initialize phase tables and variables */ getelem(t2,ct,v6); /* 180 deg pulse phase alternates +/- 90 off the rcvr */ add(oph,v6,vph180); /* oph=zero */ delay(ted1); shapedpulse(p2pat,p2,vph180,rof1,rof2); delay(ted2); } startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { double sign,currentlimit,RMScurrentlimit,dutycycle; int calcpower; /* Initialize paramaters **********************************/ init_mri(); calcpower=(int)getval("calcpower"); dutycycle=getval("dutycycle"); currentlimit=getval("currentlimit"); RMScurrentlimit=getval("RMScurrentlimit"); if (gspoil>0.0) sign = 1.0; else sign = -1.0; init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2); if (calcpower) calc_rf(&p1_rf,"tpwr1","tpwr1f"); if (tspoil>0.0) { gspoil = sqrt(dutycycle/100.0)*gmax*RMScurrentlimit/currentlimit; init_generic(&spoil_grad,"spoil",gspoil,tspoil); spoil_grad.rollOut=FALSE; calc_generic(&spoil_grad,WRITE,"gspoil","tspoil"); } xgate(ticks); rotate(); status(A); mod4(ct,oph); delay(d1); /* TTL scope trigger **********************************/ sp1on(); delay(4e-6); sp1off(); if (calcpower) { obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); } else obspower(tpwr1); delay(4e-6); if (tspoil>0.0) { obl_shapedgradient(spoil_grad.name,spoil_grad.duration,0,0,spoil_grad.amp*sign,WAIT); delay(d2); } shapedpulse(p1pat,p1,ct,rof1,rof2); startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values initval(getval("periods"),v2); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Set Phase Tables settable(phX90,4,table1); settable(phRec,4,table2); setreceiver(phRec); // Begin Sequence txphase(phX90); decphase(zero); obspwrf(getval("aX90")); obsunblank(); decunblank(); _unblank34(); delay(d1); xgate(1.0); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // Apply a Rotorsync Delay rgpulse(getval("pwX90"),phX90,0.0,0.0); rotorsync(v2); rgpulse(getval("pwX90"),phX90,0.0,0.0); xgate(getval("xperiods")); rgpulse(getval("pwX90"),phX90,0.0,0.0); delay(10.0e-6); // X Direct Polarization rgpulse(getval("pwX90"),phX90,0.0,0.0); // Begin Acquisition obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values double pw1Xstmas = getval("pw1Xstmas"); double pw2Xstmas = getval("pw2Xstmas"); double tXzfselinit = getval("tXzfsel"); double tXzfsel = tXzfselinit - 3.0e-6; if (tXzfsel < 0.0) tXzfsel = 0.0; double d2init = getval("d2"); double d2 = d2init - pw1Xstmas/2.0 - pw2Xstmas/2.0; if (d2 < 0.0) d2 = 0.0; DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); // Set Constant-time Period for d2. if (d2_index == 0) d2_init = getval("d2"); double d2_ = (ni - 1)/sw1 + d2_init; putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9)); putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9)); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pw1Xstmas") + getval("pw2Xstmas") + getval("pwXzfsel"); d.dutyoff = d1 + 4.0e-6; d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = d2_ + tXzfsel + getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = d2_ + tXzfsel + getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(ph1Xstmas,4,table1); settable(ph2Xstmas,4,table2); settable(phXzfsel,8,table3); settable(phRec,8,table4); if (phase1 == 2) { tsadd(ph1Xstmas,1,4); } setreceiver(phRec); // Begin Sequence txphase(ph1Xstmas); decphase(zero); obspower(getval("tpwr")); obspwrf(getval("aXstmas")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // H Decoupler on Before STMAS _dseqon(dec); // Two-Pulse STMAS rgpulse(getval("pw1Xstmas"),ph1Xstmas,0.0,0.0); txphase(ph2Xstmas); delay(d2); rgpulse(getval("pw2Xstmas"),ph2Xstmas,0.0,0.0); // Z-filter Pulse txphase(phXzfsel); obsblank(); obspower(getval("dbXzfsel")); obspwrf(getval("aXzfsel")); delay(3.0e-6); obsunblank(); delay(tXzfsel); rgpulse(getval("pwXzfsel"),phXzfsel,0.0,0.0); // Begin Acquisition obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
void pulsesequence() { /* DECLARE AND LOAD VARIABLES */ char f1180[MAXSTR], /* Flag to start t1 @ halfdwell */ mag_flg[MAXSTR], /*magic angle gradient*/ f2180[MAXSTR], /* Flag to start t2 @ halfdwell */ stCdec[MAXSTR], /* calls STUD+ waveforms from shapelib */ STUD[MAXSTR]; /* apply automatically calculated STUD decoupling */ int icosel1, /* used to get n and p type */ icosel2, t1_counter, /* used for states tppi in t1 */ t2_counter, /* used for states tppi in t2 */ ni2 = getval("ni2"); double tau1, /* t1 delay */ tau2, /* t2 delay */ del = getval("del"), /* time delays for CH coupling evolution */ BPdpwrspinlock, /* user-defined upper limit for spinlock(Hz) */ BPpwrlimits, /* =0 for no limit, =1 for limit */ del1 = getval("del1"), del2 = getval("del2"), /* STUD+ waveforms automatically calculated by macro "biocal" */ /* and string parameter stCdec calls them from your shapelib. */ stdmf, /* dmf for STUD decoupling */ studlvl, /* coarse power for STUD+ decoupling */ rf80 = getval("rf80"), /* rf in Hz for 80ppm STUD+ */ bw, ofs, ppm, /* temporary Pbox parameters */ pwClvl = getval("pwClvl"), /* coarse power for C13 pulse */ pwC = getval("pwC"), /* C13 90 degree pulse length at pwClvl */ rf0, /* maximum fine power when using pwC pulses */ /* p_d is used to calculate the isotropic mixing on the Cab region */ spinlock = getval("spinlock"), /* DIPSI-3 spinlock field strength in Hz */ p_d, /* 50 degree pulse for DIPSI-2 at rfd */ rfd, /* fine power for 7 kHz rf for 500MHz magnet */ ncyc = getval("ncyc"), /* no. of cycles of DIPSI-3 */ /* the following pulse lengths for SLP pulses are automatically calculated */ /* by the macro "ghcch_tocsy" . SLP pulse shapes, "offC10" etc are called */ /* directly from your shapelib. */ pwC10, /* 180 degree selective sinc pulse on CO(174ppm) */ pwZ, /* the largest of pwC10 and 2.0*pwN */ rf10, /* fine power for the pwC10 ("offC10") pulse */ compC = getval("compC"), /* adjustment for C13 amplifier compression */ pwNlvl = getval("pwNlvl"), /* power for N15 pulses */ pwN = getval("pwN"), /* N15 90 degree pulse length at pwNlvl */ sw1 = getval("sw1"), sw2 = getval("sw2"), gt1 = getval("gt1"), /* coherence pathway gradients */ gzcal = getval("gzcal"), /* G/cm to DAC coversion factor*/ gzlvl1 = getval("gzlvl1"), gzlvl2 = getval("gzlvl2"), gt3 = getval("gt3"), /* other gradients */ gt5 = getval("gt5"), gzlvl3 = getval("gzlvl3"), gzlvl4 = getval("gzlvl4"), gzlvl5 = getval("gzlvl5"), gzlvl6 = getval("gzlvl6"); getstr("STUD",STUD); getstr("mag_flg",mag_flg); getstr("f1180",f1180); getstr("f2180",f2180); strcpy(stCdec, "stCdec80"); stdmf = getval("dmf80"); studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf80); studlvl = (int) (studlvl + 0.5); P_getreal(GLOBAL,"BPpwrlimits",&BPpwrlimits,1); P_getreal(GLOBAL,"BPdpwrspinlock",&BPdpwrspinlock,1); /* LOAD PHASE TABLE */ settable(t3,2,phi3); settable(t6,1,phi6); settable(t5,4,phi5); settable(t10,1,phi10); settable(t11,4,rec); /* INITIALIZE VARIABLES */ if (BPpwrlimits > 0.5) { if (spinlock > BPdpwrspinlock) { spinlock = BPdpwrspinlock; printf("spinlock too large, reset to user-defined limit (BPdpwrspinlock)"); psg_abort(1); } } if( dpwrf < 4095 ) { printf("reset dpwrf=4095 and recalibrate C13 90 degree pulse"); psg_abort(1); } /* maximum fine power for pwC pulses */ rf0 = 4095.0; setautocal(); /* activate auto-calibration flags */ if (autocal[0] == 'n') { /* "offC10": 180 degree one-lobe sinc pulse on CO, null at Ca 139ppm away */ pwC10 = getval("pwC10"); rf10 = (compC*4095.0*pwC*2.0*1.65)/pwC10; /* needs 1.65 times more */ rf10 = (int) (rf10 + 0.5); /* power than a square pulse */ if( pwC > (24.0e-6*600.0/sfrq) ) { printf("Increase pwClvl so that pwC < 24*600/sfrq"); psg_abort(1); } } else /* if autocal = 'y'(yes), 'q'(quiet), r(read), or 's'(semi) */ { if(FIRST_FID) /* call Pbox */ { ppm = getval("dfrq"); bw = 118.0*ppm; ofs = 139.0*ppm; offC10 = pbox_make("offC10", "sinc180n", bw, ofs, compC*pwC, pwClvl); if(dm3[B] == 'y') H2ofs = 3.2; ofs_check(H1ofs, C13ofs, N15ofs, H2ofs); } rf10 = offC10.pwrf; pwC10 = offC10.pw; } /* dipsi-3 decoupling on CbCa */ p_d = (5.0)/(9.0*4.0*spinlock); /* DIPSI-3 Field Strength */ rfd = (compC*4095.0*pwC*5.0)/(p_d*9.0); rfd = (int) (rfd + 0.5); ncyc = (int) (ncyc + 0.5); /* CHECK VALIDITY OF PARAMETER RANGES */ if( gt1 > 0.5*del - 1.0e-4) { printf(" gt1 is too big. Make gt1 less than %f.\n", (0.5*del - 1.0e-4)); psg_abort(1); } if( dm[A] == 'y' ) { printf("incorrect dec1 decoupler flag! Should be 'nny' or 'nnn' "); psg_abort(1); } if((dm2[A] == 'y' || dm2[C] == 'y')) { printf("incorrect dec2 decoupler flags! Should be 'nnn' "); psg_abort(1); } if((dm3[A] == 'y' || dm3[C] == 'y')) { printf("incorrect dec3 decoupler flags! Should be 'nnn' or 'nyn' "); psg_abort(1); } if( dpwr > 52 ) { printf("don't fry the probe, DPWR too large! "); psg_abort(1); } if( pw > 50.0e-6 ) { printf("dont fry the probe, pw too high ! "); psg_abort(1); } if( pwN > 100.0e-6 ) { printf("dont fry the probe, pwN too high ! "); psg_abort(1); } /* PHASES AND INCREMENTED TIMES */ /* Phase incrementation for hypercomplex 2D data, States-Haberkorn element */ icosel1 = -1; icosel2 = -1; if (phase1 == 2) { tsadd(t6,2,4); icosel1 = -1*icosel1; } if (phase2 == 2) { tsadd(t10,2,4); icosel2 = -1*icosel2; tsadd(t6,2,4); } /* Set up f1180 */ tau1 = d2; if((f1180[A] == 'y') && (ni > 1.0)) { tau1 += ( 1.0 / (2.0*sw1) ); if(tau1 < 0.2e-6) tau1 = 0.0; } tau1 = tau1/2.0; /* Set up f2180 */ tau2 = d3; if((f2180[A] == 'y') && (ni2 > 1.0)) { tau2 += ( 1.0 / (2.0*sw2) ); if(tau2 < 0.2e-6) tau2 = 0.0; } tau2 = tau2/2.0; /* Calculate modifications to phases for States-TPPI acquisition */ if( ix == 1) d2_init = d2; t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 ); if(t1_counter % 2) { tsadd(t3,2,4); tsadd(t11,2,4); } if( ix == 1) d3_init = d3; t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 ); if(t2_counter % 2) { tsadd(t5,2,4); tsadd(t11,2,4); } /* BEGIN PULSE SEQUENCE */ status(A); if ( dm3[B] == 'y' ) lk_sample(); if ((ni/sw1-d2)>0) delay(ni/sw1-d2); /*decreases as t1 increases for const.heating*/ if ((ni2/sw2-d3)>0) delay(ni2/sw2-d3); /*decreases as t2 increases for const.heating*/ delay(d1); if ( dm3[B] == 'y' ) { lk_hold(); lk_sampling_off();} /*freezes z0 correction, stops lock pulsing*/ rcvroff(); obspower(tpwr); decpower(pwClvl); dec2power(pwNlvl); decpwrf(rf0); obsoffset(tof); txphase(t3); delay(1.0e-5); decrgpulse(pwC, zero, 0.0, 0.0); /*destroy C13 magnetization*/ zgradpulse(gzlvl1, 0.5e-3); delay(1.0e-4); decrgpulse(pwC, one, 0.0, 0.0); zgradpulse(0.7*gzlvl1, 0.5e-3); delay(5.0e-4); if ( dm3[B] == 'y' ) /* begins optional 2H decoupling */ { dec3rgpulse(1/dmf3,one,10.0e-6,2.0e-6); dec3unblank(); dec3phase(zero); delay(2.0e-6); setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3); } rgpulse(pw, t3, 0.0, 0.0); /* 1H pulse excitation */ decphase(zero); delay(0.5*del + tau1 - 2.0*pwC); decrgpulse(2.0*pwC, zero, 0.0, 0.0); txphase(zero); delay(tau1); rgpulse(2.0*pw, zero, 0.0, 0.0); if (mag_flg[A] == 'y') { magradpulse(icosel1*gzcal*gzlvl1,0.1*gt1); } else { zgradpulse(icosel1*gzlvl1, 0.1*gt1); } decphase(t5); delay(0.5*del - 0.1*gt1); simpulse(pw, pwC, zero, t5, 0.0, 0.0); zgradpulse(gzlvl3, gt3); decphase(zero); delay(0.5*del2 - gt3); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl3, gt3); txphase(t6); decphase(one); delay(0.5*del2 - gt3); simpulse(pw, pwC, t6, one, 0.0, 0.0); zgradpulse(gzlvl4, gt3); txphase(zero); decphase(zero); delay(0.5*del1 - gt3); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl4, gt3); delay(0.5*del1 - gt3); decrgpulse(pwC, zero, 0.0, 0.0); decpwrf(rfd); delay(2.0e-6); initval(ncyc, v2); starthardloop(v2); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); decrgpulse(5.0*p_d,zero,0.0,0.0); decrgpulse(5.5*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.6*p_d,two,0.0,0.0); decrgpulse(7.2*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.4*p_d,zero,0.0,0.0); decrgpulse(6.8*p_d,two,0.0,0.0); decrgpulse(7.0*p_d,zero,0.0,0.0); decrgpulse(5.2*p_d,two,0.0,0.0); decrgpulse(5.4*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.5*p_d,zero,0.0,0.0); decrgpulse(7.3*p_d,two,0.0,0.0); decrgpulse(5.1*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(5.0*p_d,two,0.0,0.0); decrgpulse(5.5*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.6*p_d,zero,0.0,0.0); decrgpulse(7.2*p_d,two,0.0,0.0); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.4*p_d,two,0.0,0.0); decrgpulse(6.8*p_d,zero,0.0,0.0); decrgpulse(7.0*p_d,two,0.0,0.0); decrgpulse(5.2*p_d,zero,0.0,0.0); decrgpulse(5.4*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.5*p_d,two,0.0,0.0); decrgpulse(7.3*p_d,zero,0.0,0.0); decrgpulse(5.1*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(5.0*p_d,two,0.0,0.0); decrgpulse(5.5*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.6*p_d,zero,0.0,0.0); decrgpulse(7.2*p_d,two,0.0,0.0); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.4*p_d,two,0.0,0.0); decrgpulse(6.8*p_d,zero,0.0,0.0); decrgpulse(7.0*p_d,two,0.0,0.0); decrgpulse(5.2*p_d,zero,0.0,0.0); decrgpulse(5.4*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.5*p_d,two,0.0,0.0); decrgpulse(7.3*p_d,zero,0.0,0.0); decrgpulse(5.1*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); decrgpulse(5.0*p_d,zero,0.0,0.0); decrgpulse(5.5*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.6*p_d,two,0.0,0.0); decrgpulse(7.2*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.4*p_d,zero,0.0,0.0); decrgpulse(6.8*p_d,two,0.0,0.0); decrgpulse(7.0*p_d,zero,0.0,0.0); decrgpulse(5.2*p_d,two,0.0,0.0); decrgpulse(5.4*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.5*p_d,zero,0.0,0.0); decrgpulse(7.3*p_d,two,0.0,0.0); decrgpulse(5.1*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); endhardloop(); dec2phase(zero); decphase(zero); txphase(zero); decpwrf(rf10); delay(tau2); /* WFG3_START_DELAY */ sim3shaped_pulse("", "offC10", "", 2.0*pw, pwC10, 2.0*pwN, zero, zero, zero, 0.0, 0.0); if(pwC10>2.0*pwN) pwZ=0.0; else pwZ=2.0*pwN - pwC10; delay(tau2); decpwrf(rf0); if (mag_flg[A] == 'y') { magradpulse(-icosel2*gzcal*gzlvl2, 1.8*gt1); } else { zgradpulse(-icosel2*gzlvl2, 1.8*gt1); } delay(2.02e-4); decrgpulse(2.0*pwC, zero, 0.0, 0.0); decpwrf(rf10); if (mag_flg[A] == 'y') { magradpulse(icosel2*gzcal*gzlvl2, 1.8*gt1); } else { zgradpulse(icosel2*gzlvl2, 1.8*gt1); } delay(2.0e-4 + WFG3_START_DELAY + pwZ); decshaped_pulse("offC10", pwC10, zero, 0.0, 0.0); decpwrf(rf0); decrgpulse(pwC, zero, 2.0e-6, 0.0); zgradpulse(gzlvl5, gt5); delay(0.5*del1 - gt5); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl5, gt5); txphase(one); decphase(t10); delay(0.5*del1 - gt5); simpulse(pw, pwC, one, t10, 0.0, 0.0); zgradpulse(gzlvl6, gt5); txphase(zero); decphase(zero); delay(0.5*del2 - gt5); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl6, gt5); delay(0.5*del2 - gt5); simpulse(pw, pwC, zero, zero, 0.0, 0.0); delay(0.5*del - 0.5*pwC); simpulse(2.0*pw,2.0*pwC, zero, zero, 0.0, 0.0); if (mag_flg[A] == 'y') magradpulse(gzcal*gzlvl1, gt1); else zgradpulse(gzlvl1, gt1); rcvron(); if ((STUD[A]=='n') && (dm[C] == 'y')) decpower(dpwr); if ( dm3[B] == 'y' ) /* turns off 2H decoupling */ { delay(0.5*del-40.0e-6 -gt1 -1/dmf3); setstatus(DEC3ch, FALSE, 'c', FALSE, dmf3); dec3rgpulse(1/dmf3,three,2.0e-6,2.0e-6); dec3blank(); lk_autotrig(); /* resumes lock pulsing */ lk_sample(); if (mag_flg[A] == 'y') statusdelay(C,40.0e-6 - 2.0*VAGRADIENT_DELAY - POWER_DELAY); else statusdelay(C,40.0e-6 - 2.0*GRADIENT_DELAY - POWER_DELAY); } else { delay(0.5*del-40.0e-6 -gt1); if (mag_flg[A] == 'y') statusdelay(C,40.0e-6 - 2.0*VAGRADIENT_DELAY - POWER_DELAY); else statusdelay(C,40.0e-6 - 2.0*GRADIENT_DELAY - POWER_DELAY); } if ((STUD[A]=='y') && (dm[C] == 'y')) {decpower(studlvl); decunblank(); decon(); decprgon(stCdec,1/stdmf, 1.0); startacq(alfa); acquire(np, 1.0/sw); decprgoff(); decoff(); decblank(); } setreceiver(t11); }
pulsesequence() { double pd, seqtime; double mintDELTA,ted1,ted2,gf; double restol, resto_local; init_mri(); /****needed ****/ restol=getval("restol"); //local frequency offset roff=getval("roff"); //receiver offset init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2); /* hard pulse */ calc_rf(&p1_rf,"tpwr1","tpwr1f"); init_rf(&p2_rf,p2pat,p2,flip2,rof1,rof2); /* hard pulse */ calc_rf(&p2_rf,"tpwr2","tpwr2f"); gf=1.0; if(diff[0] == 'n') gf=0; int vph180 = v2; /* Phase of 180 pulse */ mintDELTA = tdelta + trise + rof1 + p2 + rof2; if(tDELTA <= mintDELTA) { abort_message("%s: tDELTA too short. Min tDELTA = %f ms",seqfil,mintDELTA*1e3); } ted1 = tDELTA - tdelta + trise + p2 + rof1 + rof2; te = p1/2 + rof2 + tdelta + trise + ted1 + rof1 + p2/2; /* first half-te */ ted2 = te - p2/2 - rof2 - tdelta - trise; if((ted1 <= 0)||(ted2 <= 0) ) { abort_message("%s: tDELTA too short. Min tDELTA = %f ms",seqfil,mintDELTA*1e3); } te = te*2.0; putvalue("te",te); seqtime = at+(p1/2.0)+rof1+te; pd = tr - seqtime; /* predelay based on tr */ if (pd <= 0.0) { abort_message("%s: Requested tr too short. Min tr = %f ms",seqfil,seqtime*1e3); } resto_local=resto-restol; status(A); rotate(); delay(pd); xgate(ticks); /* --- observe period --- */ obsoffset(resto_local); obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); shapedpulse(p1pat,p1,oph,rof1,rof2); obl_gradient(0,0,gdiff*gf); /* x,y,z gradients selected via orient */ delay(tdelta); zero_all_gradients(); delay(trise); delay(ted1); obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); settable(t2,2,ph180); /* initialize phase tables and variables */ getelem(t2,ct,v6); /* 180 deg pulse phase alternates +/- 90 off the rcvr */ add(oph,v6,vph180); /* oph=zero */ shapedpulse(p2pat,p2,vph180,rof1,rof2); obl_gradient(0,0,gdiff); /* x,y,z gradients selected via orient */ delay(tdelta); zero_all_gradients(); delay(trise); delay(ted2); startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { // Set the Maximum Dynamic Table and v-var Numbers settablenumber(10); setvvarnumber(30); // Define Variables and Objects and Get Parameter Values double aXprep1 = getval("aXprep1"); // Define Tilted Pulses using "prep1X". double pw1Xprep1 = getval("pw1Xprep1"); double pw2Xprep1 = getval("pw2Xprep1"); double phXprep1 = getval("phXprep1"); WMPA wpmlg = getwpmlg("wpmlgX"); strncpy(wpmlg.ch,"obs",3); putCmd("chXwpmlg='obs'\n"); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pw1Xprep1") + getval("pw2Xprep1") + 2.0*wpmlg.q*wpmlg.cycles*wpmlg.pw; d.dutyoff = d1 + 4.0e-6 + 5.0e-6 + wpmlg.r1 + wpmlg.r2 + at - 2.0*wpmlg.q*wpmlg.cycles*wpmlg.pw; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(ph1Xprep1,4,table1); settable(ph2Xprep1,4,table2); settable(phXwpmlg,4,table3); settable(phRec,4,table4); setreceiver(phRec); // Set the Small-Angle Step double obsstep = 360.0/(PSD*8192); obsstepsize(obsstep); int phfXprep1 = initphase(phXprep1, obsstep); int phXzero = initphase(0.0, obsstep); // Begin Sequence xmtrphase(phfXprep1); txphase(ph1Xprep1); obspwrf(aXprep1); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // Tilted Preparation Pulse for FSLG or PMLG "prep1X" startacq(5.0e-6); rcvroff(); delay(wpmlg.r1); rgpulse(pw1Xprep1, ph1Xprep1, 0.0, 0.0); rgpulse(pw2Xprep1, ph2Xprep1, 0.0, 0.0); xmtrphase(phXzero); delay(wpmlg.r2); // Apply WPMLG Cycles decblank(); _blank34(); _wpmlg(wpmlg, phXwpmlg); endacq(); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { /*******************************************************/ /* Internal variable declarations */ /*******************************************************/ double predelay; double agss,grate,gssint, gssrint; double t_after, acq_delay, min_tr; double t_rampslice, t_plateau_sr, t_plateau_min, t_ramp_sr; double slice_offset,f_offset; double pss0; char slice_select[MAXSTR]; initparms_sis(); /* Sets default state of receiver to ON */ /*- will be obsolete on future VNMR versions */ /***************************/ /* initialize variables */ /***************************/ gssf = 1.0; /* slice select fractional refocus */ predelay = PREDELAY; /* define predelay [s] */ acq_delay = ACQ_DELAY; /* time delay between end of refocus and acq */ slice_offset = 0.0; /* force slice offset to 0.0 [cm] */ t_rampslice = 0.0; /* slice select ramp time */ t_ramp_sr = 0.0; /* slice refocusing ramp time */ t_plateau_min = 0.0005; /* min time slice refocusing plateau */ t_plateau_sr =0.0; /* slice refocusing plateau time*/ f_offset=getval("resto"); agss = fabs(gss); /* absolute slice select gradient */ gssr = gmax; /* maximum slice refocusing gradient */ grate = trise/gmax; /* define gradient slew rate [s*cm/g] trise = gradient rise time gmax = maximum gradient strength [G/cm] */ ticks = IGNORE_TRIGGER; /* ignore trigger pulses */ /***************************/ /* Get parameter */ /***************************/ at = getval("at"); pss0 = getval("pss0"); getstr("slice_select",slice_select); /* slice select flag [y] = ON, [n] = OFF */ /*******************************************************/ /* Slice Select gradient area */ /*******************************************************/ t_rampslice = grate * agss; gssint = (agss*p1/2.0) + (agss*t_rampslice/2.0); gssrint=gssint; /******************************************************* * Calculate slice refocussing gradient * *******************************************************/ t_plateau_sr = (gssint / gssr) - trise; if (t_plateau_sr <= 0.0) /* traingular gradients */ { t_plateau_sr = 0.0; gssr = sqrt(gssint / grate); } t_ramp_sr = gssr * grate; /* ramp time for refocusing gradient*/ gssrint = (gssr * t_plateau_sr) + (t_ramp_sr * gssr); /*************************************************************************** * timing calculation * ***************************************************************************/ if (slice_select[0] == 'y') { t_after = tr - (predelay + p1 + t_plateau_sr + at + acq_delay + 2* (t_rampslice + t_ramp_sr)); min_tr = predelay + p1 + t_plateau_sr + at + acq_delay + 2* (t_rampslice + t_ramp_sr); } else { t_after = tr - (predelay + p1 + at + acq_delay ); min_tr = predelay + p1 + at + acq_delay ; } if (t_after < 0.0) { abort_message("Requested repetition time (TR) too short. Min tr = %.f[ms]\n",min_tr*1000); } /******************************************************/ /* */ /* S T A R T */ /* P U L S E S E Q U E N C E */ /* */ /******************************************************/ obspower(tpwr1); /* set tranmitter power */ /*************************************************************************** * Predelay * ***************************************************************************/ obsoffset(f_offset); /* set transmitter offset */ delay(predelay); xgate(ticks); /* set gating */ if (slice_select[0] == 'y') { /*************************************************************************** * Slice select gradient & RF pulse * ***************************************************************************/ obl_gradient(0.0,0.0,gss); /* slice select gradient */ delay(t_rampslice); /* delay - time to ramp up gradient */ shaped_pulse(p1pat,p1,oph,rof1,rof1); zero_all_gradients(); /* force all gradients back to 0 [G/cm] */ delay(t_rampslice); /* time to ramp down gradient */ /*************************************************************************** * Slice refocus gradient * ***************************************************************************/ obl_gradient(0.0,0.0,-gssr); /* slice refocus gradient */ delay(t_ramp_sr+t_plateau_sr); /* ramp up of refocus gradient */ zero_all_gradients(); /* force refocus gradient back to 0 [G/cm] */ delay(t_ramp_sr); /* time to ramp down gradient */ } else { shaped_pulse(p1pat,p1,oph,rof1,rof1); } /*************************************************************************** * Pre-acquire delay * ***************************************************************************/ delay(acq_delay); /*************************************************************************** * Acquire echo * ***************************************************************************/ startacq(alfa); acquire(np,1.0/sw); /* acquire FID */ endacq(); delay(t_after); /* time padding to fill TR */ /******************************************************/ /* */ /* E N D */ /* P U L S E S E Q U E N C E */ /* */ /******************************************************/ }
void pulsesequence() { // Define Variables and Objects and Get Parameter Values CP hx = getcp("HX",0.0,0.0,0,1); strncpy(hx.fr,"dec",3); strncpy(hx.to,"obs",3); putCmd("frHX='dec'\n"); putCmd("toHX='obs'\n"); MPSEQ spc5 = getspc5("spc5X",0,0.0,0.0,0,1); MPSEQ spc5ref = getspc5("spc5X",spc5.iSuper,spc5.phAccum,spc5.phInt,1,1); strncpy(spc5.ch,"obs",3); putCmd("chXspc5='obs'\n"); DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); // Set Constant-time Period for d2. if (d2_index == 0) d2_init = getval("d2"); double d2_ = (ni - 1)/sw1 + d2_init; putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9)); putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9)); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pwH90") + getval("tHX") + getval("pwX90") + spc5.t + spc5ref.t; d.dutyoff = d1 + 4.0e-6 + 2.0*getval("tZF"); d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = d2_ + getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = d2_ + getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Create Phasetables settable(phH90,4,table1); settable(phHhx,4,table2); settable(phXhx,4,table3); settable(phXmix1,4,table4); settable(phXmix2,4,table5); settable(phRec,4,table6); setreceiver(phRec); if (phase1 == 2) tsadd(phXhx,1,4); // Begin Sequence txphase(phXhx); decphase(phH90); obspwrf(getval("aXhx")); decpwrf(getval("aH90")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // H to X Cross Polarization decrgpulse(getval("pwH90"),phH90,0.0,0.0); decphase(phHhx); _cp_(hx,phHhx,phXhx); // F2 Indirect Period for X obspwrf(getval("aX90")); _dseqon(dec); delay(d2); _dseqoff(dec); // Mixing with SPC5 Recoupling rgpulse(getval("pwX90"),phXmix1,0.0,0.0); obspwrf(getval("aXspc5")); xmtrphase(v1); txphase(phXmix1); delay(getval("tZF")); decpwrf(getval("aHmix")); decon(); _mpseq(spc5, phXmix1); xmtrphase(v2); txphase(phXmix2); _mpseq(spc5ref, phXmix2); decoff(); obspwrf(getval("aX90")); xmtrphase(zero); txphase(phXmix2); delay(getval("tZF")); rgpulse(getval("pwX90"),phXmix2,0.0,0.0); // Begin Acquisition _dseqon(dec); obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
void pulsesequence() { char c1d[MAXSTR]; /* option to record only 1D C13 spectrum */ int ncyc; double tau1 = 0.002, /* t1 delay */ post_del = 0.0, pwClvl = getval("pwClvl"), /* coarse power for C13 pulse */ pwC = getval("pwC"), /* C13 90 degree pulse length at pwClvl */ compC = getval("compC"), compH = getval("compH"), mixpwr = getval("mixpwr"), jCH = getval("jCH"), gt0 = getval("gt0"), gt1 = getval("gt1"), gt2 = getval("gt2"), gzlvl0 = getval("gzlvl0"), gzlvl1 = getval("gzlvl1"), gzlvl2 = getval("gzlvl2"), grec = getval("grec"), phase = getval("phase"); getstr("c1d",c1d); ncyc=1; if(jCH > 0.0) tau1 = 0.25/jCH; dbl(ct, v1); /* v1 = 0 */ mod4(v1,oph); hlv(ct,v2); add(v2,v1,v2); if (phase > 1.5) incr(v1); /* hypercomplex phase increment */ initval(2.0*(double)((int)(d2*getval("sw1")+0.5)%2),v10); add(v1,v10,v1); add(oph,v10,oph); mod4(v1,v1); mod4(v2,v2); mod4(oph,oph); assign(zero,v3); if(FIRST_FID) { HHmix = pbox_mix("HHmix", "DIPSI2", mixpwr, pw*compH, tpwr); if(c1d[A] == 'n') { opx("CHdec"); setwave("WURST2 30k/1.2m"); pbox_par("steps","600"); cpx(pwC*compC, pwClvl); CHdec = getDsh("CHdec"); } } ncyc = (int) (at/HHmix.pw) + 1; post_del = ncyc*HHmix.pw - at; /* BEGIN PULSE SEQUENCE */ status(A); zgradpulse(gzlvl0, gt0); rgpulse(pw, zero, 0.0, 0.0); /* destroy H-1 magnetization*/ zgradpulse(gzlvl0, gt0); delay(1.0e-4); obspower(tpwr); txphase(v1); decphase(zero); dec2phase(zero); presat(); obspower(tpwr); delay(1.0e-5); status(B); if(c1d[A] == 'y') { rgpulse(pw,v1,0.0,0.0); /* 1H pulse excitation */ delay(d2); rgpulse(pw,two,0.0,0.0); /* 1H pulse excitation */ assign(oph,v3); } else { decunblank(); pbox_decon(&CHdec); rgpulse(pw,v1,0.0,0.0); /* 1H pulse excitation */ txphase(zero); delay(d2); pbox_decoff(); decblank(); decpower(pwClvl); decpwrf(4095.0); delay(tau1 - POWER_DELAY); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); txphase(one); decphase(one); dec2phase(one); delay(tau1); simpulse(pw, pwC, one, one, 0.0, 0.0); txphase(zero); decphase(zero); dec2phase(zero); delay(tau1); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); delay(tau1); simpulse(0.0, pwC, zero, zero, 0.0, 0.0); } zgradpulse(gzlvl1, gt1); delay(grec); simpulse(0.0, pwC, zero, v3, 0.0, rof2); txphase(v2); obsunblank(); pbox_xmtron(&HHmix); status(C); setactivercvrs("ny"); startacq(alfa); acquire(np,1.0/sw); endacq(); delay(post_del); pbox_xmtroff(); obsblank(); zgradpulse(gzlvl2, gt2); obspower(tpwr); delay(grec); rgpulse(pw,zero,0.0,rof2); /* 1H pulse excitation */ status(D); setactivercvrs("yn"); startacq(alfa); acquire(np,1.0/sw); endacq(); }
pulsesequence() { /* DECLARE AND LOAD VARIABLES */ char f1180[MAXSTR], /* Flag to start t1 @ halfdwell */ f2180[MAXSTR], /* Flag to start t2 @ halfdwell */ rna_stCdec[MAXSTR], /* calls STUD+ waveforms from shapelib */ STUD[MAXSTR]; /* apply automatically calculated STUD decoupling */ int icosel1, /* used to get n and p type */ icosel2, t1_counter, /* used for states tppi in t1 */ t2_counter, /* used for states tppi in t2 */ ni2 = getval("ni2"); double tau1, /* t1 delay */ tau2, /* t2 delay */ del = getval("del"), /* time delays for CH coupling evolution */ del1 = getval("del1"), del2 = getval("del2"), /* STUD+ waveforms automatically calculated by macro "rnacal" */ /* and string parameter rna_stCdec calls them from your shapelib.*/ stdmf, /* dmf for STUD decoupling */ studlvl, /* coarse power for STUD+ decoupling */ rf80 = getval("rf80"), /* rf in Hz for 80ppm STUD+ */ pwClvl = getval("pwClvl"), /* coarse power for C13 pulse */ pwC = getval("pwC"), /* C13 90 degree pulse length at pwClvl */ rfC, /* maximum fine power when using pwC pulses */ dofa, /* dof shifted to 80 ppm for ribose */ /* p_d is used to calculate the isotropic mixing on the Cab region */ p_d, /* 50 degree pulse for DIPSI-3 at rfd */ rfd, /* fine power for 35 ppm */ ncyc = getval("ncyc"), /* no. of cycles of DIPSI-3 */ compC = getval("compC"), /* adjustment for C13 amplifier compression */ pwNlvl = getval("pwNlvl"), /* power for N15 pulses */ pwN = getval("pwN"), /* N15 90 degree pulse length at pwNlvl */ sw1 = getval("sw1"), sw2 = getval("sw2"), grecov = getval("grecov"), /* Gradient recovery delay, typically 150-200us */ gt1 = getval("gt1"), /* coherence pathway gradients */ gzlvl1 = getval("gzlvl1"), gzlvl2 = getval("gzlvl2"), gt3 = getval("gt3"), /* other gradients */ gt5 = getval("gt5"), gzlvl3 = getval("gzlvl3"), gzlvl4 = getval("gzlvl4"), gzlvl5 = getval("gzlvl5"), gzlvl6 = getval("gzlvl6"); getstr("STUD",STUD); getstr("f1180",f1180); getstr("f2180",f2180); /* LOAD PHASE TABLE */ settable(t3,2,phi3); settable(t6,1,phi6); settable(t5,4,phi5); settable(t10,1,phi10); settable(t11,4,rec); /* INITIALIZE VARIABLES */ if( dpwrf < 4095 ) { text_error("reset dpwrf=4095 and recalibrate C13 90 degree pulse"); psg_abort(1); } /* maximum fine power for pwC pulses */ rfC = 4095.0; /* Center dof in RIBOSE region on 80 ppm. */ dofa = dof - 30.0*dfrq; /* dipsi-3 decoupling C-ribose */ p_d = (5.0)/(9.0*4.0*7000.0*(sfrq/800.0)); /* DIPSI-3 covers 35 ppm */ rfd = (compC*4095.0*pwC*5.0)/(p_d*9.0); rfd = (int) (rfd + 0.5); ncyc = (int) (ncyc + 0.5); /* 80 ppm STUD+ decoupling */ strcpy(rna_stCdec, "wurst80"); stdmf = getval("dmf80"); studlvl = pwClvl + 20.0*log10(compC*pwC*4.0*rf80); studlvl = (int) (studlvl + 0.5); /* CHECK VALIDITY OF PARAMETER RANGES */ if( gt1 > 0.5*del - 0.5*grecov ) { text_error(" gt1 is too big. Make gt1 less than %f.\n", (0.5*del - 0.5*grecov)); psg_abort(1);} if((dm3[A] == 'y' || dm3[C] == 'y' )) { text_error("incorrect dec1 decoupler flags! Should be 'nyn' or 'nnn' "); psg_abort(1); } if((dm2[A] == 'y' || dm2[B] == 'y')) { text_error("incorrect dec2 decoupler flags! Should be 'nnn' or 'nny' "); psg_abort(1); } if((dm[A] == 'y' || dm[B] == 'y')) { text_error("incorrect dec1 decoupler flags! Should be 'nny' "); psg_abort(1); } if( (((dm[C] == 'y') && (dm2[C] == 'y')) && (STUD[A] == 'y')) ) { text_error("incorrect dec2 decoupler flags! Should be 'nnn' if STUD='y'"); psg_abort(1); } if( dpwr > 50 ) { text_error("don't fry the probe, DPWR too large! "); psg_abort(1); } if( dpwr2 > 50 ) { text_error("don't fry the probe, DPWR2 too large! "); psg_abort(1); } if( (pw > 20.0e-6) && (tpwr > 56) ) { text_error("don't fry the probe, pw too high ! "); psg_abort(1); } if( (pwC > 40.0e-6) && (pwClvl > 56) ) { text_error("don't fry the probe, pwN too high ! "); psg_abort(1); } if( (pwN > 100.0e-6) && (pwNlvl > 56) ) { text_error("don't fry the probe, pwN too high ! "); psg_abort(1); } if ((dm3[B] == 'y' && dpwr3 > 44 )) { text_error ("Deuterium decoupling power too high ! "); psg_abort(1); } if ((ncyc > 1 ) && (ix == 1)) { text_error("mixing time is %f ms.\n",(ncyc*97.8*4*p_d)); } /* PHASES AND INCREMENTED TIMES */ /* Phase incrementation for hypercomplex 2D data, States-Haberkorn element */ icosel1 = -1; icosel2 = -1; if (phase1 == 2) { tsadd(t6,2,4); icosel1 = -1*icosel1; } if (phase2 == 2) { tsadd(t10,2,4); icosel2 = -1*icosel2; tsadd(t6,2,4); } /* Set up f1180 */ tau1 = d2; if((f1180[A] == 'y') && (ni > 1.0)) { tau1 += ( 1.0 / (2.0*sw1) ); if(tau1 < 0.2e-6) tau1 = 0.0; } tau1 = tau1/2.0; /* Set up f2180 */ tau2 = d3; if((f2180[A] == 'y') && (ni2 > 1.0)) { tau2 += ( 1.0 / (2.0*sw2) ); if(tau2 < 0.2e-6) tau2 = 0.0; } tau2 = tau2/2.0; /* Calculate modifications to phases for States-TPPI acquisition */ if( ix == 1) d2_init = d2; t1_counter = (int) ( (d2-d2_init)*sw1 + 0.5 ); if(t1_counter % 2) { tsadd(t3,2,4); tsadd(t11,2,4); } if( ix == 1) d3_init = d3; t2_counter = (int) ( (d3-d3_init)*sw2 + 0.5 ); if(t2_counter % 2) { tsadd(t5,2,4); tsadd(t11,2,4); } /* BEGIN PULSE SEQUENCE */ status(A); if (dm3[B]=='y') lk_sample(); delay(d1); if (dm3[B]=='y') lk_hold(); rcvroff(); obspower(tpwr); decpower(pwClvl); dec2power(pwNlvl); decpwrf(rfC); obsoffset(tof); decoffset(dofa); dec2offset(dof2); txphase(t3); delay(1.0e-5); decrgpulse(pwC, zero, 0.0, 0.0); /*destroy C13 magnetization*/ zgradpulse(gzlvl1, 0.5e-3); delay(grecov/2); decrgpulse(pwC, one, 0.0, 0.0); zgradpulse(0.7*gzlvl1, 0.5e-3); delay(5.0e-4); if(dm3[B] == 'y') /*optional 2H decoupling on */ { dec3unblank(); dec3rgpulse(1/dmf3, one, 0.0, 0.0); dec3unblank(); setstatus(DEC3ch, TRUE, 'w', FALSE, dmf3); } rgpulse(pw, t3, 0.0, 0.0); /* 1H pulse excitation */ decphase(zero); delay(0.5*del + tau1 - 2.0*pwC); decrgpulse(2.0*pwC, zero, 0.0, 0.0); txphase(zero); delay(tau1); rgpulse(2.0*pw, zero, 0.0, 0.0); zgradpulse(icosel1*gzlvl1, 0.1*gt1); decphase(t5); delay(0.5*del - 0.1*gt1); simpulse(pw, pwC, zero, t5, 0.0, 0.0); zgradpulse(gzlvl3, gt3); decphase(zero); delay(0.5*del2 - gt3); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl3, gt3); txphase(t6); decphase(one); delay(0.5*del2 - gt3); simpulse(pw, pwC, t6, one, 0.0, 0.0); zgradpulse(gzlvl4, gt3); txphase(zero); decphase(zero); delay(0.5*del1 - gt3); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl4, gt3); delay(0.5*del1 - gt3); decrgpulse(pwC, zero, 0.0, 0.0); decpwrf(rfd); delay(2.0e-6); initval(ncyc, v2); starthardloop(v2); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); decrgpulse(5.0*p_d,zero,0.0,0.0); decrgpulse(5.5*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.6*p_d,two,0.0,0.0); decrgpulse(7.2*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.4*p_d,zero,0.0,0.0); decrgpulse(6.8*p_d,two,0.0,0.0); decrgpulse(7.0*p_d,zero,0.0,0.0); decrgpulse(5.2*p_d,two,0.0,0.0); decrgpulse(5.4*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.5*p_d,zero,0.0,0.0); decrgpulse(7.3*p_d,two,0.0,0.0); decrgpulse(5.1*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(5.0*p_d,two,0.0,0.0); decrgpulse(5.5*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.6*p_d,zero,0.0,0.0); decrgpulse(7.2*p_d,two,0.0,0.0); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.4*p_d,two,0.0,0.0); decrgpulse(6.8*p_d,zero,0.0,0.0); decrgpulse(7.0*p_d,two,0.0,0.0); decrgpulse(5.2*p_d,zero,0.0,0.0); decrgpulse(5.4*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.5*p_d,two,0.0,0.0); decrgpulse(7.3*p_d,zero,0.0,0.0); decrgpulse(5.1*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(5.0*p_d,two,0.0,0.0); decrgpulse(5.5*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.6*p_d,zero,0.0,0.0); decrgpulse(7.2*p_d,two,0.0,0.0); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.4*p_d,two,0.0,0.0); decrgpulse(6.8*p_d,zero,0.0,0.0); decrgpulse(7.0*p_d,two,0.0,0.0); decrgpulse(5.2*p_d,zero,0.0,0.0); decrgpulse(5.4*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.5*p_d,two,0.0,0.0); decrgpulse(7.3*p_d,zero,0.0,0.0); decrgpulse(5.1*p_d,two,0.0,0.0); decrgpulse(7.9*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); decrgpulse(5.0*p_d,zero,0.0,0.0); decrgpulse(5.5*p_d,two,0.0,0.0); decrgpulse(0.6*p_d,zero,0.0,0.0); decrgpulse(4.6*p_d,two,0.0,0.0); decrgpulse(7.2*p_d,zero,0.0,0.0); decrgpulse(4.9*p_d,two,0.0,0.0); decrgpulse(7.4*p_d,zero,0.0,0.0); decrgpulse(6.8*p_d,two,0.0,0.0); decrgpulse(7.0*p_d,zero,0.0,0.0); decrgpulse(5.2*p_d,two,0.0,0.0); decrgpulse(5.4*p_d,zero,0.0,0.0); decrgpulse(0.6*p_d,two,0.0,0.0); decrgpulse(4.5*p_d,zero,0.0,0.0); decrgpulse(7.3*p_d,two,0.0,0.0); decrgpulse(5.1*p_d,zero,0.0,0.0); decrgpulse(7.9*p_d,two,0.0,0.0); endhardloop(); dec2phase(zero); decphase(zero); txphase(zero); decpwrf(rfC); delay(tau2); sim3pulse(2.0*pw, 0.0, 2.0*pwN, zero, zero, zero, 0.0, 0.0); delay(tau2); decpwrf(rfC); zgradpulse(-icosel2*gzlvl2, 1.8*gt1); delay(grecov+2.0e-6); decrgpulse(2.0*pwC, zero, 0.0, 0.0); decpwrf(rfC); zgradpulse(icosel2*gzlvl2, 1.8*gt1); delay(grecov + pwN); decrgpulse(pwC, zero, 0.0, 0.0); decpwrf(rfC); decrgpulse(pwC, zero, 2.0e-6, 0.0); zgradpulse(gzlvl5, gt5); delay(0.5*del1 - gt5); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl5, gt5); txphase(one); decphase(t10); delay(0.5*del1 - gt5); simpulse(pw, pwC, one, t10, 0.0, 0.0); zgradpulse(gzlvl6, gt5); txphase(zero); decphase(zero); delay(0.5*del2 - gt5); simpulse(2.0*pw, 2.0*pwC, zero, zero, 0.0, 0.0); zgradpulse(gzlvl6, gt5); delay(0.5*del2 - gt5); simpulse(pw, pwC, zero, zero, 0.0, 0.0); delay(0.5*del - 0.5*pwC); simpulse(2.0*pw,2.0*pwC, zero, zero, 0.0, 0.0); if (STUD[A]=='y') decpower(studlvl); else { decpower(dpwr); dec2power(dpwr2); } zgradpulse(gzlvl1, gt1); /* 2.0*GRADIENT_DELAY */ if(dm3[B] == 'y') delay(0.5*del - gt1 -1/dmf3 - 2.0*GRADIENT_DELAY - POWER_DELAY); else delay(0.5*del - gt1 - 2.0*GRADIENT_DELAY - POWER_DELAY); if(dm3[B] == 'y') /*optional 2H decoupling off */ { dec3rgpulse(1/dmf3, three, 0.0, 0.0); dec3blank(); setstatus(DEC3ch, FALSE, 'w', FALSE, dmf3); dec3blank(); } decpower(dpwr); /* POWER_DELAY */ if (dm3[B]=='y') lk_sample(); if ((STUD[A]=='y') && (dm[C] == 'y')) {decpower(studlvl); decunblank(); decon(); decprgon(rna_stCdec,1/stdmf, 1.0); startacq(alfa); acquire(np, 1.0/sw); decprgoff(); decoff(); decblank(); } else status(C); setreceiver(t11); }
void pulsesequence() { // Set the Maximum Dynamic Table and v-var Numbers settablenumber(20); setvvarnumber(30); // Define Variables and Objects and Get Parameter Values MPSEQ dumbo = getdumbogen("dumboX","dcf1X",0,0.0,0.0,0,1); strncpy(dumbo.ch,"obs",3); putCmd("chXdumbo='obs'\n"); MPSEQ c7 = getpostc7("c7X",0,0.0,0.0,0,1); MPSEQ c7ref = getpostc7("c7X",c7.iSuper,c7.phAccum,c7.phInt,1,1); strncpy(c7.ch,"obs",3); putCmd("chXc7='obs'\n"); WMPA wdumbo = getwdumbogen("wdumboX","dcfX"); strncpy(wdumbo.ch,"obs",3); putCmd("chXwdumbo='obs'\n"); double tXzfinit = getval("tXzf"); //Define the Z-filter delay in the sequence double tXzf = tXzfinit - 5.0e-6 - wdumbo.r1; // Set Constant-time Period for d2. if (d2_index == 0) d2_init = getval("d2"); double d2_ = (ni - 1)/sw1 + d2_init; putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9)); putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9)); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = c7.t + getval("pwXtilt") + d2_ + getval("pwXtilt") + c7ref.t + getval("pwX90") + + wdumbo.q*wdumbo.cycles*wdumbo.pw; d.dutyoff = 4.0e-6 + d1 + tXzfinit + wdumbo.r2 + at - wdumbo.q*wdumbo.cycles*wdumbo.pw; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(ph1Xc7,4,table1); settable(phXdumbo,4,table2); settable(ph2Xc7,4,table3); settable(phX90,16,table4); settable(phXwdumbo,4,table5); settable(phRec,16,table6); settable(ph1Xtilt,4,table7); settable(ph2Xtilt,4,table8); // Set the Small-Angle Prep Phase double obsstep = 360.0/(PSD*8192); obsstepsize(obsstep); int phfX90 = initphase(0.0, obsstep); //Add STATES Quadrature Phase if (phase1 == 2) initval((45.0/obsstep),v1); else initval(0.0,v1); initval((d2*c7.of[0]*360.0/obsstep),v2); initval(0.0,v3); obsstepsize(obsstep); setreceiver(phRec); // Begin Sequence xmtrphase(v1); txphase(ph1Xc7); obspwrf(getval("aXc7")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // C7 Recoupling of 2Q coherence _mpseq(c7, ph1Xc7); // F1 Evolution With DUMBO xmtrphase(v3); if (!getval("scXdcf1")){ obspwrf(getval("aX90")); rgpulse(getval("pwXtilt"),ph1Xtilt,0.0,0.0); } obspwrf(getval("aXdumbo")); obsunblank(); _mpseqon(dumbo,phXdumbo); delay(d2); _mpseqoff(dumbo); if (!getval("scXdcf1")){ obspwrf(getval("aX90")); rgpulse(getval("pwXtilt"),ph2Xtilt,0.0,0.0); } obspwrf(getval("aX90")); obsunblank(); // C7 Transfer to 1Q Coherence xmtrphase(v2); _mpseq(c7ref, ph2Xc7); // Z-filter Delay delay(tXzf); // Detection Pulse txphase(phX90); obspwrf(getval("aX90")); startacq(5.0e-6); rcvroff(); delay(wdumbo.r1); rgpulse(getval("pwX90"), phX90, 0.0, 0.0); obsunblank(); xmtrphase(v3); delay(wdumbo.r2); // Apply WPMLG Cycles During Acqusition decblank(); _blank34(); _wdumbo(wdumbo,phXwdumbo); endacq(); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { /* Internal variable declarations *************************/ /*timing*/ double tr_delay; double te_d1,te_d2,te_d3; /* delays */ double tau1,tau2,tau3; /*voxel crusher multipliers */ double fx,fy,fz; /*localization parameters*/ double freq1,freq2,freq3; double vox1_cr,vox2_cr, vox3_cr; int nDim; double rprof,pprof,sprof; char profile_vox[MAXSTR],profile_ovs[MAXSTR]; double restol, resto_local, csd_ppm; /*phase cycle****/ int counter,noph; char autoph[MAXSTR], pcflag[MAXSTR]; int rf1_phase[64] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}; int rf2_phase[64] = {0,0,0,0,2,2,2,2,1,1,1,1,3,3,3,3,0,0,0,0,2,2,2,2,1,1,1,1,3,3,3,3, 0,0,0,0,2,2,2,2,1,1,1,1,3,3,3,3,0,0,0,0,2,2,2,2,1,1,1,1,3,3,3,3}; int rf3_phase[64] = {0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3, 0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3,0,2,1,3}; /* Initialize paramaters **********************************/ init_mri(); //this gets all the parameters that are defined in acqparms.h, etc get_wsparameters(); get_ovsparameters(); rprof = getval("rprof"); pprof = getval("pprof"); sprof = getval("sprof"); //read the crusher factors that are designed to create grad on the same axis without refoc fx=getval("fx"); fy=getval("fy"); fz=getval("fz"); getstr("profile_vox",profile_vox); getstr("profile_ovs",profile_ovs); /*set voxel sizes for butterfly crushers to 10^6 to set the slice portion to zero ***/ vox1_cr=1000000; vox2_cr=1000000; vox3_cr=1000000; /***** RF power initialize *****/ init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2); init_rf(&p2_rf,p2pat,p2,flip2,rof1,rof2); /***** Initialize gradient structs *****/ trampfixed=trise; //rise time =trise tcrush=granularity(tcrush,GRADIENT_RES); //this is to avoid the granularity errors //if trampfixed is used, rise time needs to be checked if (trise*2>tcrush){ abort_message("tcrush too short. Minimum tcrush = %fms \n",1000*trise*2); } if (gcrush>gmax){ abort_message("gcrush too large. Max gcrush = %f \n",gmax*0.95); } init_slice_butterfly(&vox1_grad,"vox1",vox1,gcrush,tcrush); init_slice_butterfly(&vox2_grad,"vox2",vox2,gcrush,tcrush); init_slice_butterfly(&vox3_grad,"vox3",vox3,gcrush,tcrush); init_slice_butterfly(&vox1_crush,"vox1_crush",vox1_cr,gcrush,tcrush); init_slice_butterfly(&vox2_crush,"vox2_crush",vox2_cr,gcrush,tcrush); init_slice_butterfly(&vox3_crush,"vox3_crush",vox3_cr,gcrush,tcrush); if (profile_vox[0] == 'y') { init_readout_butterfly(&ro_grad,"ro",lro,np,sw,gcrushro,tcrushro); init_readout_refocus(&ror_grad,"ror"); } /***** RF and Gradient calculations *****/ calc_rf(&p1_rf,"tpwr1","tpwr1f"); calc_rf(&p2_rf,"tpwr2","tpwr2f"); calc_slice(&vox1_grad,&p2_rf,WRITE,"gvox1"); calc_slice(&vox2_grad,&p2_rf,WRITE,"gvox2"); calc_slice(&vox3_grad,&p2_rf,WRITE,"gvox3"); calc_slice(&vox1_crush,&p2_rf,WRITE,"vox1_crush"); calc_slice(&vox2_crush,&p2_rf,WRITE,"vox2_crush"); calc_slice(&vox3_crush,&p2_rf,WRITE,"vox3_crush"); if (profile_vox[0] == 'y') { calc_readout(&ro_grad,WRITE,"gro","sw","at"); putvalue("gro",ro_grad.roamp); // RO grad calc_readout_refocus(&ror_grad,&ro_grad,WRITE,"gror"); putvalue("tror",ror_grad.duration); // ROR duration } //set all gradients along a particular direction to zero if profile is needed if (profile_ovs[0]=='y'){ if (rprof==1) { vox1_grad.amp=0; //set slice selection in read direction to none vox3_crush.amp=0; // set corresponding crusher gradients to none } else if(pprof==1) { vox2_grad.amp=0; vox1_crush.amp=0; } else if(sprof==1) { vox3_grad.amp=0; vox2_crush.amp=0; } } /* Optional OVS and Water Suppression */ if (ovs[0] == 'y') create_ovsbands(); if (sat[0] == 'y') create_satbands(); if (ws[0] == 'y') create_watersuppress(); //Read in parameters not defined in acqparms.h and sglHelper nDim=getval("nDim"); restol=getval("restol"); //local frequency offset roff=getval("roff"); //receiver offset csd_ppm=getval("csd_ppm"); //chemical shift displacement factor noph=getval("noph"); getstr("autoph",autoph); getstr("pcflag",pcflag); settable(t3,noph,rf1_phase); settable(t2,noph,rf2_phase); settable(t1,noph,rf3_phase); /* tau1, tau2 and tau3 are sums of all events in TE*/ tau1 = vox1_grad.rfCenterFront+GDELAY+rof2; tau2 = vox1_grad.rfCenterBack + vox1_grad.rfCenterFront+2*(GDELAY+rof2); tau3 = vox3_grad.rfCenterBack+GDELAY+rof2; temin = tau1+5.0*tau2+tau3; if (minte[0] == 'y') { te = temin; putvalue("te",te); } if (te < temin) { abort_message("te too short. Minimum te = %.2f ms\n",temin*1000); } /***** Calculate TE delays *****/ te_d1 = te/12.0 - tau1+GDELAY; te_d2 = te/6.0 - tau2+2*(GDELAY+rof2); te_d3 = te/12.0 - tau3+GDELAY+rof2; //Calculate delta from resto to include local frequency line+ chemical shift offset resto_local=resto-restol; /***** Min TR *****/ trmin = GDELAY + p1 + te + at+rof1+rof2; if (ws[0] == 'y') trmin += wsTime; if (ovs[0] == 'y') trmin += ovsTime; if (sat[0] == 'y') trmin += satTime; if (profile_vox[0] == 'y') trmin += ror_grad.duration + ro_grad.duration - at; if (mintr[0] == 'y') { tr = trmin; // ensure at least 4us between gradient events putvalue("tr",tr); } if ((trmin-tr) > 12.5e-9) { abort_message("TR too short. Minimum TR= %.2fms\n",trmin*1000); } /***** Calculate TR delay *****/ tr_delay = tr - trmin; /* Frequency offsets */ freq1 = poffset(pos1,vox1_grad.ssamp); // First RF pulse freq2 = poffset(pos2,vox2_grad.ssamp); // Second RF pulse freq3 = poffset(pos3,vox3_grad.ssamp); // Third RF pulse freq1=freq1-csd_ppm*sfrq; freq2=freq2-csd_ppm*sfrq; freq3=freq3-csd_ppm*sfrq; /* Frequency offsets */ if (profile_vox[0] == 'y') { /* Shift DDR for pro ************************************/ roff = -poffset(pro,ro_grad.roamp); } /* Put gradient information back into VnmrJ parameters */ putvalue("gvox1",vox1_grad.ssamp); putvalue("gvox2",vox2_grad.ssamp); putvalue("gvox3",vox3_grad.ssamp); putvalue("rgvox1",vox1_grad.tramp); putvalue("rgvox2",vox2_grad.tramp); putvalue("rgvox3",vox3_grad.tramp); sgl_error_check(sglerror); if (ss<0) g_setExpTime(tr*(nt-ss)*arraydim); else g_setExpTime(tr*(nt*arraydim+ss)); /**[2.7] PHASE CYCLING ******************************************************/ assign(zero, oph); counter=(double)nt*(ix-1); if (autoph[0] == 'n') counter=0.0; //only goes through nt, if 'y' goes through nt*array initval(counter,v1); initval(noph,v3); add(v1,ct,v2); modn(v2,v3,v2); /* Full phase cycling requires 64 steps*/ if (pcflag[0] == 'n') { assign(zero,v2); getelem(t1,v2,v10); getelem(t2,v2,v11); getelem(t3,v2,v12); } else { getelem(t1,v2,v10); getelem(t2,v2,v11); getelem(t3,v2,v12); } /*Start of the sequence*/ obsoffset(resto_local); // need it here for water suppression to work delay(GDELAY); rot_angle(vpsi,vphi,vtheta); if (ticks) { xgate(ticks); grad_advance(gpropdelay); delay(4e-6); } /* TTL scope trigger **********************************/ //sp1on(); delay(4e-6); sp1off(); /* Saturation bands ***********************************/ if (ovs[0] == 'y') ovsbands(); if (sat[0] == 'y') satbands(); /* Water suppression **********************************/ if (ws[0] == 'y') watersuppress(); /* Slice selective 90 degree RF pulse *****/ obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); delay(GDELAY); shaped_pulse(p1pat,p1,zero,rof1,rof2); /* start localization */ obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); if (nDim > 2.5) { delay(te_d1); //this is at least GDELAY == 4 us obl_shaped3gradient(vox1_grad.name,vox1_crush.name,"",vox1_grad.duration,vox1_grad.amp,fy*vox1_crush.amp,0,NOWAIT); delay(vox1_grad.rfDelayFront); if (profile_ovs[0]=='y'&& rprof==1) freq1=0.0; shapedpulseoffset(p2_rf.pulseName,vox1_grad.rfDuration,v12,rof1,rof2,freq1); delay(vox1_grad.rfDelayBack); delay(te_d2); obl_shaped3gradient (vox1_grad.name,vox1_crush.name,"",vox1_grad.duration,vox1_grad.amp,fy*0.777*vox1_crush.amp,0,NOWAIT); delay(vox1_grad.rfDelayFront); if (profile_ovs[0]=='y'&& rprof==1) freq1=0.0; shapedpulseoffset(p2_rf.pulseName,vox1_grad.rfDuration,v12,rof1,rof2,freq1); delay(vox1_grad.rfDelayBack); delay(te_d2); } if (nDim > 1.5) { //this is 2nd slice selection obl_shaped3gradient("",vox2_grad.name,vox2_crush.name,vox2_grad.duration,0,vox2_grad.amp,fz*vox2_crush.amp,NOWAIT); delay(vox2_grad.rfDelayFront); if (profile_ovs[0]=='y'&& pprof==1) freq2=0.0; shapedpulseoffset(p2_rf.pulseName,vox2_grad.rfDuration,v11,rof1,rof2,freq2); delay(vox2_grad.rfDelayBack); delay(te_d2); obl_shaped3gradient("",vox2_grad.name,vox2_crush.name,vox2_grad.duration,0,vox2_grad.amp,fz*0.777*vox2_crush.amp,NOWAIT); delay(vox2_grad.rfDelayFront); if (profile_ovs[0]=='y'&& pprof==1) freq2=0.0; shapedpulseoffset(p2_rf.pulseName,vox2_grad.rfDuration,v11,rof1,rof2,freq2); delay(vox2_grad.rfDelayBack); delay(te_d2); } if (nDim > 0.5){ //this is 3rd slice selection obl_shaped3gradient(vox3_crush.name,"",vox3_grad.name,vox3_grad.duration,fx*vox3_crush.amp,0,vox3_grad.amp,NOWAIT); delay(vox3_grad.rfDelayFront); if (profile_ovs[0]=='y'&& sprof==1) freq3=0.0; shapedpulseoffset(p2_rf.pulseName,vox3_grad.rfDuration,v10,rof1,rof2,freq3); delay(vox3_grad.rfDelayBack); delay(te_d2); obl_shaped3gradient(vox3_crush.name,"",vox3_grad.name,vox3_grad.duration,fx*vox3_crush.amp,0,vox3_grad.amp,NOWAIT); delay(vox3_grad.rfDelayFront); if (profile_ovs[0]=='y'&& sprof==1) freq3=0.0; shapedpulseoffset(p2_rf.pulseName,vox3_grad.rfDuration,v10,rof1,rof2,freq3); delay(vox3_grad.rfDelayBack); delay(te_d3); } if (profile_vox[0] == 'y') { obl_shapedgradient(ror_grad.name,ror_grad.duration, -rprof*ror_grad.amp,-pprof*ror_grad.amp,-sprof*ror_grad.amp,WAIT); delay(GDELAY); obl_shapedgradient(ro_grad.name,ro_grad.duration, rprof*ro_grad.amp,pprof*ro_grad.amp,sprof*ro_grad.amp,NOWAIT); delay(ro_grad.atDelayFront); startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); } else { startacq(alfa); acquire(np,1.0/sw); endacq(); } delay(tr_delay);
pulsesequence() { /* Internal variable declarations *************************/ double freqEx[MAXNSLICE]; double maxgradtime,spoilMoment,perTime,tau1,te_delay,tr_delay; double te2=0.0,te3=0.0,te2min,te3min,tau2,tau3,te2_delay,te3_delay=0; char minte2[MAXSTR],minte3[MAXSTR],spoilflag[MAXSTR]; int sepSliceRephase,sepReadRephase=0,readrev,table,shapeEx; int i; /* Real-time variables used in this sequence **************/ int vpe_steps = v1; // Number of PE steps int vpe_ctr = v2; // PE loop counter int vms_slices = v3; // Number of slices int vms_ctr = v4; // Slice loop counter int vpe_offset = v5; // PE/2 for non-table offset int vpe_mult = v6; // PE multiplier, ranges from -PE/2 to PE/2 int vper_mult = v7; // PE rewinder multiplier; turn off rewinder when 0 int vssc = v8; // Compressed steady-states int vacquire = v9; // Argument for setacqvar, to skip steady state acquires int vrfspoil_ctr = v10; // RF spoil counter int vrfspoil = v11; // RF spoil multiplier int vtrimage = v12; // Counts down from nt, trimage delay when 0 int vne = v13; // Number of echoes int vne_ctr = v14; // Echo loop counter int vneindex = v15; // Echo index, odd or even int vnelast = v16; // Check for last echo int vtrigblock = v17; // Number of slices per trigger block /* Initialize paramaters **********************************/ init_mri(); getstr("spoilflag",spoilflag); te2=getval("te2"); te3=getval("te3"); getstr("minte2",minte2); getstr("minte3",minte3); readrev=(int)getval("readrev"); /* Check for external PE table ***************************/ table = 0; if (strcmp(petable,"n") && strcmp(petable,"N") && strcmp(petable,"")) { loadtable(petable); table = 1; } /* Set Rcvr/Xmtr phase increments for RF Spoiling ********/ /* Ref: Zur, Y., Magn. Res. Med., 21, 251, (1991) *******/ if (rfspoil[0] == 'y') { rcvrstepsize(rfphase); obsstepsize(rfphase); } /* Initialize gradient structures *************************/ shape_rf(&p1_rf,"p1",p1pat,p1,flip1,rof1,rof2 ); // excitation pulse init_slice(&ss_grad,"ss",thk); // slice select gradient init_slice_refocus(&ssr_grad,"ssr"); // slice refocus gradient init_readout(&ro_grad,"ro",lro,np,sw); // readout gradient ro_grad.pad1=alfa; ro_grad.pad2=alfa; init_readout_refocus(&ror_grad,"ror"); // dephase gradient init_phase(&pe_grad,"pe",lpe,nv); // phase encode gradient init_dephase(&spoil_grad,"spoil"); // optimized spoiler init_dephase(&ref_grad,"ref"); // readout rephase /* RF Calculations ****************************************/ calc_rf(&p1_rf,"tpwr1","tpwr1f"); /* Gradient calculations **********************************/ calc_slice(&ss_grad,&p1_rf,WRITE,"gss"); calc_slice_refocus(&ssr_grad, &ss_grad,WRITE,"gssr"); calc_readout(&ro_grad, WRITE,"gro","sw","at"); calc_readout_refocus(&ror_grad,&ro_grad,NOWRITE,"gror"); calc_phase(&pe_grad, NOWRITE,"gpe","tpe"); calc_dephase(&ref_grad,WRITE,ro_grad.m0,"",""); spoilMoment = ro_grad.acqTime*ro_grad.roamp; // Optimal spoiling is at*gro for 2pi per pixel spoilMoment -= ro_grad.m0def; // Subtract partial spoiling from back half of readout calc_dephase(&spoil_grad,WRITE,spoilMoment,"gspoil","tspoil"); /* Is TE long enough for separate slice refocus? ******/ maxgradtime = MAX(ror_grad.duration,pe_grad.duration); if (spoilflag[0] == 'y') maxgradtime = MAX(maxgradtime,spoil_grad.duration); tau1 = ss_grad.rfCenterBack + ssr_grad.duration + maxgradtime + ro_grad.timeToEcho + GRADIENT_RES; /* Equalize refocus and PE gradient durations *********/ if ((te >= tau1) && (minte[0] != 'y')) { sepSliceRephase = 1; // Set flag for separate slice rephase calc_sim_gradient(&ror_grad,&pe_grad,&spoil_grad,tpemin,WRITE); } else { sepSliceRephase = 0; calc_sim_gradient(&ror_grad,&pe_grad,&ssr_grad,tpemin,WRITE); calc_sim_gradient(&ror_grad,&spoil_grad,&null_grad,tpemin,NOWRITE); } perTime = 0.0; if ((perewind[0] == 'y') || (spoilflag[0] == 'y')) perTime = spoil_grad.duration; if (spoilflag[0] == 'n') spoil_grad.amp = 0.0; /* Create optional prepulse events ************************/ if (sat[0] == 'y') create_satbands(); if (fsat[0] == 'y') create_fatsat(); if (mt[0] == 'y') create_mtc(); if (ir[0] == 'y') create_inversion_recovery(); /* Set up frequency offset pulse shape list ********/ offsetlist(pss,ss_grad.ssamp,0,freqEx,ns,seqcon[1]); shapeEx = shapelist(p1_rf.pulseName,ss_grad.rfDuration,freqEx,ns,ss_grad.rfFraction,seqcon[1]); /* Check that all Gradient calculations are ok ************/ sgl_error_check(sglerror); /* Min TE ******************************************/ tau1 = ss_grad.rfCenterBack + pe_grad.duration + ro_grad.timeToEcho; tau1 += (sepSliceRephase) ? ssr_grad.duration : 0.0; // Add slice refocusing if separate event temin = tau1 + GRADIENT_RES; /* ensure that te_delay is at least GRADIENT_RES */ te = granularity(te,GRADIENT_RES); if (minte[0] == 'y') { te = temin; putvalue("te",te); } if (FP_LT(te,temin)) { abort_message("TE too short. Minimum TE= %.3fms\n",temin*1000); } te_delay = te - tau1; /* Min TE2 *****************************************/ tau2 = (readrev) ? 2*ro_grad.timeFromEcho : ro_grad.duration+ref_grad.duration; te2min = tau2 + GRADIENT_RES; te2 = granularity(te2,GRADIENT_RES); if (minte2[0] == 'y') { te2 = te2min; putvalue("te2",te2); } if (FP_LT(te2,te2min)) { abort_message("TE2 too short. Minimum TE2= %.3fms\n",te2min*1000); } if (readrev) te2_delay = te2 - tau2; else { tau2 = ro_grad.duration + 3*ror_grad.duration; if (te2 >= tau2) { sepReadRephase = 1; // Set flag for separate read rephase te2_delay = te2 - ro_grad.duration - 2*ror_grad.duration; } else { sepReadRephase = 0; if (te2 > te2min+GRADIENT_RES) { ref_grad.duration = granularity(te2-ro_grad.duration-2*GRADIENT_RES,GRADIENT_RES); ref_grad.calcFlag = AMPLITUDE_FROM_MOMENT_DURATION; calc_dephase(&ref_grad,WRITE,ro_grad.m0,"",""); } te2_delay = te2 - ro_grad.duration - ref_grad.duration; } } /* Min TE3 *****************************************/ if (readrev) { tau3 = 2*ro_grad.timeToEcho; te3min = tau3 + GRADIENT_RES; te3 = granularity(te3,GRADIENT_RES); if (minte3[0] == 'y') { te3 = te3min; putvalue("te3",te3); } if (FP_LT(te3,te3min)) { abort_message("TE3 too short. Minimum TE3= %.3fms\n",te3min*1000); } te3_delay = te3 - tau3; } /* Now set the TE array accordingly */ putCmd("TE = 0"); /* Re-initialize TE */ putCmd("TE[1] = %f",te*1000); if (readrev) { for (i=1;i<ne;i++) { if (i%2 == 0) putCmd("TE[%d] = TE[%d]+%f",i+1,i,te3*1000); else putCmd("TE[%d] = TE[%d]+%f",i+1,i,te2*1000); } } else { for (i=1;i<ne;i++) putCmd("TE[%d] = TE[%d]+%f",i+1,i,te2*1000); } /* Check nsblock, the number of slices blocked together (used for triggering and/or inversion recovery) */ check_nsblock(); /* Min TR ******************************************/ trmin = ss_grad.duration + te_delay + pe_grad.duration + ne*ro_grad.duration + perTime + 2*GRADIENT_RES; trmin += (sepSliceRephase) ? ssr_grad.duration : 0.0; // Add slice refocusing if separate event if (readrev) trmin += (ne/2)*te2_delay + ((ne-1)/2)*te3_delay; else trmin += (sepReadRephase) ? (ne-1)*(te2_delay+2*ror_grad.duration) : (ne-1)*(te2_delay+ref_grad.duration); /* Increase TR if any options are selected *********/ if (sat[0] == 'y') trmin += satTime; if (fsat[0] == 'y') trmin += fsatTime; if (mt[0] == 'y') trmin += mtTime; if (ticks > 0) trmin += GRADIENT_RES; /* Adjust for all slices ***************************/ trmin *= ns; /* Inversion recovery *********************************/ if (ir[0] == 'y') { /* tauti is the additional time beyond IR component to be included in ti */ /* satTime, fsatTime and mtTime all included as those modules will be after IR */ tauti = satTime + fsatTime + mtTime + GRADIENT_RES + ss_grad.rfCenterFront; /* calc_irTime checks ti and returns the time of all IR components */ trmin += calc_irTime(tauti,trmin,mintr[0],tr,&trtype); } if (mintr[0] == 'y') { tr = trmin; putvalue("tr",tr); } if (FP_LT(tr,trmin)) { abort_message("TR too short. Minimum TR = %.3fms\n",trmin*1000); } /* Calculate tr delay */ tr_delay = granularity((tr-trmin)/ns,GRADIENT_RES); /* Set pe_steps for profile or full image **********/ pe_steps = prep_profile(profile[0],nv,&pe_grad,&per_grad); F_initval(pe_steps/2.0,vpe_offset); /* Shift DDR for pro *******************************/ roff = -poffset(pro,ro_grad.roamp); /* Adjust experiment time for VnmrJ *********************/ if (ssc<0) { if (seqcon[2] == 'c') g_setExpTime(trmean*(ntmean*pe_steps*arraydim - ssc*arraydim)); else g_setExpTime(trmean*(ntmean*pe_steps*arraydim - ssc*pe_steps*arraydim)); } else g_setExpTime(trmean*ntmean*pe_steps*arraydim + tr*ssc); /* PULSE SEQUENCE ***************************************/ status(A); rotate(); triggerSelect(trigger); // Select trigger input 1/2/3 obsoffset(resto); delay(GRADIENT_RES); initval(fabs(ssc),vssc); // Compressed steady-state counter if (seqcon[2]=='s') assign(zero,vssc); // Zero for standard peloop assign(zero,vrfspoil_ctr); // RF spoil phase counter assign(zero,vrfspoil); // RF spoil multiplier assign(one,vacquire); // real-time acquire flag setacqvar(vacquire); // Turn on acquire when vacquire is zero /* trigger */ if (ticks > 0) F_initval((double)nsblock,vtrigblock); /* Begin phase-encode loop ****************************/ peloop(seqcon[2],pe_steps,vpe_steps,vpe_ctr); if (trtype) delay(ns*tr_delay); // relaxation delay /* Compressed steady-states: 1st array & transient, all arrays if ssc is negative */ if ((ix > 1) && (ssc > 0)) assign(zero,vssc); sub(vpe_ctr,vssc,vpe_ctr); // vpe_ctr counts up from -ssc assign(zero,vssc); if (seqcon[2] == 's') assign(zero,vacquire); // Always acquire for non-compressed loop else { ifzero(vpe_ctr); assign(zero,vacquire); // Start acquiring when vpe_ctr reaches zero endif(vpe_ctr); } /* Set rcvr/xmtr phase for RF spoiling *******************/ if (rfspoil[0] == 'y') { incr(vrfspoil_ctr); // vrfspoil_ctr = 1 2 3 4 5 6 add(vrfspoil,vrfspoil_ctr,vrfspoil); // vrfspoil = 1 3 6 10 15 21 xmtrphase(vrfspoil); rcvrphase(vrfspoil); } /* Read external kspace table if set ******************/ if (table) getelem(t1,vpe_ctr,vpe_mult); else { ifzero(vacquire); sub(vpe_ctr,vpe_offset,vpe_mult); elsenz(vacquire); sub(zero,vpe_offset,vpe_mult); // Hold PE mult at initial value for steady states endif(vacquire); } /* PE rewinder follows PE table; zero if turned off ***/ if (perewind[0] == 'y') assign(vpe_mult,vper_mult); else assign(zero,vper_mult); /* Begin multislice loop ******************************/ msloop(seqcon[1],ns,vms_slices,vms_ctr); if (!trtype) delay(tr_delay); // Relaxation delay if (ticks > 0) { modn(vms_ctr,vtrigblock,vtest); ifzero(vtest); // if the beginning of an trigger block xgate(ticks); grad_advance(gpropdelay); delay(GRADIENT_RES); elsenz(vtest); delay(GRADIENT_RES); endif(vtest); } /* TTL scope trigger **********************************/ sp1on(); delay(GRADIENT_RES); sp1off(); /* Prepulse options ***********************************/ if (ir[0] == 'y') inversion_recovery(); if (sat[0] == 'y') satbands(); if (fsat[0] == 'y') fatsat(); if (mt[0] == 'y') mtc(); /* Slice select RF pulse ******************************/ obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); delay(GRADIENT_RES); obl_shapedgradient(ss_grad.name,ss_grad.duration,0,0,ss_grad.amp,NOWAIT); delay(ss_grad.rfDelayFront); shapedpulselist(shapeEx,ss_grad.rfDuration,oph,rof1,rof2,seqcon[1],vms_ctr); delay(ss_grad.rfDelayBack); /* Phase encode, refocus, and dephase gradient ********/ if (sepSliceRephase) { // separate slice refocus gradient obl_shapedgradient(ssr_grad.name,ssr_grad.duration,0,0,-ssr_grad.amp,WAIT); delay(te_delay); // delay between slab refocus and pe pe_shapedgradient(pe_grad.name,pe_grad.duration,-ror_grad.amp,0,0, -pe_grad.increment,vpe_mult,WAIT); } else { pe_shapedgradient(pe_grad.name,pe_grad.duration,-ror_grad.amp,0,-ssr_grad.amp, -pe_grad.increment,vpe_mult,WAIT); delay(te_delay); // delay after refocus/pe } F_initval(ne,vne); loop(vne,vne_ctr); if (readrev) { mod2(vne_ctr,vneindex); ifzero(vneindex); /* Shift DDR for pro *******************************/ roff = -poffset(pro,ro_grad.roamp); /* Readout gradient ********************************/ obl_shapedgradient(ro_grad.name,ro_grad.duration,ro_grad.amp,0,0,NOWAIT); delay(ro_grad.atDelayFront-alfa); /* Acquisition ***************************************/ startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); sub(vne,vne_ctr,vnelast); sub(vnelast,one,vnelast); ifzero(vnelast); elsenz(vnelast); delay(te2_delay); endif(vnelast); elsenz(vneindex); /* Shift DDR for pro *******************************/ roff = -poffset(pro,-ro_grad.roamp); /* Readout gradient ********************************/ obl_shapedgradient(ro_grad.name,ro_grad.duration,-ro_grad.amp,0,0,NOWAIT); delay(ro_grad.atDelayFront-alfa); /* Acquisition ***************************************/ startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); sub(vne,vne_ctr,vnelast); sub(vnelast,one,vnelast); ifzero(vnelast); elsenz(vnelast); delay(te3_delay); endif(vnelast); endif(vneindex); } else { /* Shift DDR for pro *******************************/ roff = -poffset(pro,ro_grad.roamp); /* Readout gradient ********************************/ obl_shapedgradient(ro_grad.name,ro_grad.duration,ro_grad.amp,0,0,NOWAIT); delay(ro_grad.atDelayFront-alfa); /* Acquisition ***************************************/ startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); sub(vne,vne_ctr,vnelast); sub(vnelast,one,vnelast); ifzero(vnelast); elsenz(vnelast); if (sepReadRephase) { obl_shapedgradient(ror_grad.name,ror_grad.duration,-ror_grad.amp,0,0,WAIT); delay(te2_delay); obl_shapedgradient(ror_grad.name,ror_grad.duration,-ror_grad.amp,0,0,WAIT); } else { obl_shapedgradient(ref_grad.name,ref_grad.duration,-ref_grad.amp,0,0,WAIT); delay(te2_delay); } endif(vnelast); } endloop(vne_ctr); /* Rewind / spoiler gradient **************************/ if ((perewind[0] == 'y') || (spoilflag[0] == 'y')) { pe_shapedgradient(pe_grad.name,pe_grad.duration,spoil_grad.amp,0,0,pe_grad.increment,vper_mult,WAIT); } endmsloop(seqcon[1],vms_ctr); endpeloop(seqcon[2],vpe_ctr); /* Inter-image delay **********************************/ sub(ntrt,ct,vtrimage); decr(vtrimage); ifzero(vtrimage); delay(trimage); endif(vtrimage); }
pulsesequence() { /* declaration of SGL kernel structures */ SGL_KERNEL_INFO_T read, phase, slice, ss_pre, ss_post; /* declaration of internal variables */ double freqlist[MAXNSLICE]; double pe_steps; int shapelist1, table; double xtime, grad_duration, ror_pad,rod_pad; double temp_tr; double readAmp, phaseAmp, sliceAmp; double tepad, tepad2, temin2, htrmin, delayToRF, delayRFToAcq, delayAcqToRF; double rof_pad, delRof; double sliceRephTrim, sliceDephTrim; double readRephTrim, readDephTrim; int rfPhase[2] = {0,2}; /* declaration of realtime variables */ int vpe_steps = v1; int vpe_ctr = v2; int vms_slices = v3; int vms_ctr = v4; int vpe_offset = v5; int vpe_index = v6; int vss = v7; int vssc = v8; int vacquire = v9; int vphase = v10; settable(t2,2,rfPhase); /* setup phase encoding order */ table = set_pe_order(); init_mri(); if( (sliceRephTrim = getvalnwarn("sliceRephTrim")) == 0.0 ) { sliceRephTrim = 1.0; } if( (sliceDephTrim = getvalnwarn("sliceDephTrim")) == 0.0 ) { sliceDephTrim = 1.0; } if( (readRephTrim = getvalnwarn("readRephTrim")) == 0.0 ) { readRephTrim = 1.0; } if( (readDephTrim = getvalnwarn("readDephTrim")) == 0.0 ) { readDephTrim = 1.0; } shape_rf( &p1_rf, "p1", p1pat, p1, flip1, rof1, rof2 ); // excitation pulse init_slice( &ss_grad, "ss", thk ); // slice gradient init_slice_refocus( &ssr_grad, "ssr" ); // slice refocus init_slice_refocus( &ssd_grad, "ssd" ); // slice refocus init_readout( &ro_grad, "ro", lro, np, sw ); // read gradient init_readout_refocus( &ror_grad, "ror" ); // read dephase init_readout_refocus( &rod_grad, "ror" ); // read dephase init_phase( &pe_grad, "pe", lpe, nv ); // phase gradient ss_grad.maxGrad = gmax * 0.57; ssr_grad.maxGrad = gmax * 0.57; ssd_grad.maxGrad = gmax * 0.57; ro_grad.maxGrad = gmax * 0.57; ror_grad.maxGrad = gmax * 0.57; rod_grad.maxGrad = gmax * 0.57; pe_grad.maxGrad = glimpe < 0.57? gmax*glimpe : gmax * 0.57; /* calculate the RF pulses, gradient pulses and their interdependencies */ calc_rf( &p1_rf, "tpwr1", "tpwr1f" ); calc_slice( &ss_grad, &p1_rf, NOWRITE, "gss" ); ssr_grad.amp = ss_grad.amp; ssr_grad.gmult = sliceRephTrim; ssr_grad.calcFlag = DURATION_FROM_MOMENT_AMPLITUDE; calc_slice_refocus( &ssr_grad, &ss_grad, NOWRITE, "gssr" ); ssd_grad.amp = ss_grad.amp; ssd_grad.gmult = sliceDephTrim; ssd_grad.calcFlag = DURATION_FROM_MOMENT_AMPLITUDE; calc_slice_dephase( &ssd_grad, &ss_grad, NOWRITE, "gssd" ); calc_readout( &ro_grad, NOWRITE, "gro", "sw", "at" ); ror_grad.amp = ro_grad.amp; ror_grad.calcFlag = DURATION_FROM_MOMENT_AMPLITUDE; rod_grad.amp = ro_grad.amp; rod_grad.calcFlag = DURATION_FROM_MOMENT_AMPLITUDE; ror_grad.gmult = readRephTrim; calc_readout_refocus( &ror_grad, &ro_grad, NOWRITE, "gror" ); rod_grad.gmult = readDephTrim; calc_readout_rephase( &rod_grad, &ro_grad, NOWRITE, "grod" ); calc_phase( &pe_grad, NOWRITE, "gpe", "tpe" ); /* work out the position of the markers */ /* markerA */ /* ss_grad.rfDelayFront indicates the starting point of the RF pulse measured from the start of the slice gradient ( rof1:pulse length:rof2 ) */ double granulatedRFDelayFront = granularity( ss_grad.rfDelayFront, GRADIENT_RES ); if( granulatedRFDelayFront > ss_grad.rfDelayFront ) { granulatedRFDelayFront -= GRADIENT_RES; } /* ss_grad.rfDelayBack indicates the end point of the RF pulse measured to the end of the slice gradient ( rof1:pulse length:rof2 ) */ double granulatedRFDelayBack = granularity( ss_grad.rfDelayBack, GRADIENT_RES ); if( granulatedRFDelayBack > ss_grad.rfDelayBack ) { granulatedRFDelayBack -= GRADIENT_RES; } double granulatedRFDelay = granulatedRFDelayFront < granulatedRFDelayBack ? granulatedRFDelayFront : granulatedRFDelayBack; double markerADelay = granulatedRFDelay; /* read and phase gradients can overlap the start or end of the slice gradient by max of granulatedRFDElay */ double granulatedATDelayFront = granularity(ro_grad.atDelayFront, GRADIENT_RES); if( granulatedATDelayFront > ro_grad.atDelayFront ) { granulatedATDelayFront -= GRADIENT_RES; } double granulatedATDelayBack = granularity(ro_grad.atDelayBack, GRADIENT_RES); if( granulatedATDelayBack > ro_grad.atDelayBack ) { granulatedATDelayBack -= GRADIENT_RES; } double granulatedATDelay = granulatedATDelayFront < granulatedATDelayBack ? granulatedATDelayFront : granulatedATDelayBack; /* longest gradient between RF pulse and acquire dominates */ xtime = ssr_grad.duration + granulatedRFDelay; xtime = xtime > ssd_grad.duration + granulatedRFDelay ? xtime : ssd_grad.duration + granulatedRFDelay; xtime = xtime > ror_grad.duration + granulatedATDelay ? xtime : ror_grad.duration + granulatedATDelay; xtime = xtime > rod_grad.duration + granulatedATDelay ? xtime : rod_grad.duration + granulatedATDelay; xtime = xtime > pe_grad.duration ? xtime : pe_grad.duration; ror_pad = xtime - ror_grad.duration - granulatedATDelay; rod_pad = xtime - rod_grad.duration - granulatedATDelay; /* make a gradient list */ start_kernel( &sk ); add_gradient( (void*)&ss_grad, "slice", SLICE, START_TIME, "", 0.0, PRESERVE ); add_gradient( (void*)&ssr_grad, "sliceReph", SLICE, BEHIND, "slice", 0.0, INVERT ); add_gradient( (void*)&ror_grad, "readDeph", READ, BEHIND, "slice", -granulatedRFDelay + ror_pad, INVERT ); add_gradient( (void*)&ro_grad, "read", READ, BEHIND, "readDeph", 0.0, PRESERVE ); add_gradient( (void*)&pe_grad, "phase", PHASE, SAME_START, "readDeph", 0.0, PRESERVE ); add_gradient( (void*)&rod_grad, "readReph", READ, BEHIND, "read", 0.0, INVERT ); add_gradient( (void*)&pe_grad, "rewind", PHASE, SAME_END, "readReph", 0.0, INVERT ); add_gradient( (void*)&ss_grad, "nextSlice", SLICE, BEHIND, "readReph", rod_pad - granulatedRFDelay, PRESERVE ); add_gradient( (void*)&ssd_grad, "sliceDeph", SLICE, BEFORE, "nextSlice", 0, INVERT ); add_marker( "markerA", SAME_START, "slice", granulatedRFDelay ); add_marker( "markerB", SAME_START, "nextSlice", granulatedRFDelay ); /* get the minimum echo time */ temin = get_timing( FROM_RF_CENTER_OF, "slice", TO_ECHO_OF, "read" ); temin2 = get_timing( FROM_ECHO_OF, "read", TO_RF_CENTER_OF, "nextSlice" ); htrmin = MAX( temin, temin2 ); if( minte[0] == 'y' ){ te = htrmin; } tepad = granularity( te - temin, GRADIENT_RES ); tepad2 = granularity( te - temin2, GRADIENT_RES ); te = temin + tepad; putCmd("setvalue('te', %f, 'current')\n", te ); if( tepad>0.0 ) change_timing( "readDeph", tepad ); if( tepad2>0.0 ) change_timing( "nextSlice", tepad2 ); tr = get_timing( FROM_START_OF, "slice", TO_START_OF, "nextSlice" ); putvalue("tr", tr ); delayRFToAcq = get_timing( FROM_RF_PULSE_OF, "slice", TO_ACQ_OF, "read" ); delayAcqToRF = get_timing( FROM_ACQ_OF, "read", TO_RF_PULSE_OF, "nextSlice" ); set_comp_info( &ss_pre, "ss_pre" ); write_comp_grads_snippet( NULL, NULL, &ss_pre, "START_OF_KERNEL", "markerA" ); set_comp_info( &read, "ro" ); set_comp_info( &phase, "pe" ); set_comp_info( &slice, "ss" ); write_comp_grads_snippet( &read, &phase, &slice, "markerA", "markerB" ); set_comp_info( &ss_post, "ss_post" ); write_comp_grads_snippet( NULL, NULL, &ss_post, "markerB", "END_OF_KERNEL" ); /* Set up frequency offset pulse shape list ********/ offsetlist(pss,ss_grad.ssamp,0,freqlist,ns,seqcon[1]); shapelist1 = shapelist(p1_rf.pulseName,ss_grad.rfDuration,freqlist,ns,ss_grad.rfFraction, seqcon[1]); /* Set pe_steps for profile or full image **********/ pe_steps = prep_profile(profile[0],nv,&pe_grad,&pe_grad);/* profile[0] is n y or r */ F_initval(pe_steps/2.0,vpe_offset); g_setExpTime(trmean*(ntmean*pe_steps*arraydim + (1+fabs(ssc))*arraydim)); /* Shift DDR for pro *******************************/ roff = -poffset(pro,ro_grad.roamp); /* PULSE SEQUENCE */ status( A ); rotate(); triggerSelect(trigger); obsoffset( resto ); delay( GRADIENT_RES ); initval( 1+fabs( ssc ), vss ); obspower( p1_rf.powerCoarse ); obspwrf( p1_rf.powerFine ); delay( GRADIENT_RES ); assign(one,vacquire); // real-time acquire flag setacqvar(vacquire); // Turn on acquire when vacquire is zero obl_shapedgradient(ss_pre.name,ss_pre.dur,0,0,ss_pre.amp,NOWAIT); sp1on(); delay(GRADIENT_RES); sp1off(); delay(ss_pre.dur-GRADIENT_RES ); msloop( seqcon[1], ns, vms_slices, vms_ctr ); assign(vss,vssc); peloop( seqcon[2], pe_steps, vpe_steps, vpe_ctr ); sub(vpe_ctr,vssc,vpe_ctr); // vpe_ctr counts up from -ssc assign(zero,vssc); if (seqcon[2] == 's') assign(zero,vacquire); // Always acquire for non-compressed loop else { ifzero(vpe_ctr); assign(zero,vacquire); // Start acquiring when vpe_ctr reaches zero endif(vpe_ctr); } if (table) getelem(t1,vpe_ctr,vpe_index); else { ifzero(vacquire); sub(vpe_ctr,vpe_offset,vpe_index); elsenz(vacquire); sub(zero,vpe_offset,vpe_index); endif(vacquire); } pe_shaped3gradient( read.name, phase.name, slice.name, read.dur, read.amp, 0, slice.amp, -pe_grad.increment, vpe_index, NOWAIT ); delay(ss_grad.rfDelayFront - granulatedRFDelay); shapedpulselist( shapelist1, ss_grad.rfDuration, oph, rof1, rof2, seqcon[1], vms_ctr ); delay( delayRFToAcq - alfa ); startacq(alfa); acquire( np, 1/ro_grad.bandwidth ); endacq(); delay( delayAcqToRF - ss_grad.rfDelayFront + granulatedRFDelay - GRADIENT_RES ); sp1on(); delay(GRADIENT_RES); sp1off(); endpeloop( seqcon[2], vpe_ctr ); endmsloop( seqcon[1], vms_ctr ); obl_shapedgradient(ss_post.name,ss_post.dur,0,0,ss_post.amp,WAIT); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values double aYxy8 = getval("aYxy8"); double pwYxy8 = getval("pwYxy8"); double nYxy8 = getval("nYxy8"); int cycles = (int) nYxy8/2.0; nYxy8 = 2.0*cycles; int counter = (int) (nYxy8 - 1.0); initval((nYxy8 - 1.0),v8); double onYxy8 = getval("onYxy8"); double srate = getval("srate"); DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); DSEQ mix = getdseq("Hmix"); strncpy(mix.t.ch,"dec",3); putCmd("chHmixtppm='mix'\n"); strncpy(mix.s.ch,"dec",3); putCmd("chHmixspinal='mix'\n"); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pwX90") + 4.0*nYxy8*pwYxy8 + getval("pwX180"); d.dutyoff = d1 + 4.0e-6; d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = getval("rd") + getval("ad") + at; d.c3 = d.c3 + (!strcmp(mix.seq,"tppm")); d.c3 = d.c3 + ((!strcmp(mix.seq,"tppm")) && (mix.t.a > 0.0)); d.t3 = 2.0*nYxy8*(1.0/srate - 2.0*pwYxy8) + 1.0/srate - getval("pwX180"); d.c4 = d.c4 + (!strcmp(mix.seq,"spinal")); d.c4 = d.c4 + ((!strcmp(mix.seq,"spinal")) && (mix.s.a > 0.0)); d.t4 = 2.0*nYxy8*(1.0/srate - 2.0*pwYxy8) + 1.0/srate - getval("pwX180"); d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(phX90,4,table1); settable(ph1Yxy8,8,table2); settable(ph2Yxy8,4,table3); settable(phX180,4,table4); settable(phRec,4,table5); if (counter < 0) tsadd(phRec,2,4); setreceiver(phRec); // Begin Sequence txphase(phX90); decphase(zero); obspwrf(getval("aX90")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // X Single Pulse rgpulse(getval("pwX90"),phX90,0.0,0.0); // xy8Y Period One obspwrf(getval("aX180")); txphase(phX180); if (counter >= 0) { _dseqon(mix); delay(pwYxy8/2.0); dec2pwrf(aYxy8); sub(v1,v1,v1); if (counter >= 1) { if (counter > 1) loop(v8,v9); getelem(ph1Yxy8,v1,v4); incr(v1); getelem(ph2Yxy8,ct,v2); add(v4,v2,v2); dec2phase(v2); delay(0.5/srate - pwYxy8); if (onYxy8 == 2) dec2rgpulse(pwYxy8,v2,0.0,0.0); else delay(pwYxy8); if (counter > 1) endloop(v9); } // X Refocussing Pulse delay(0.5/srate - pwYxy8/2.0 - getval("pwX180")/2.0); rgpulse(getval("pwX180"),phX180,0.0,0.0); dec2pwrf(aYxy8); delay(0.5/srate - pwYxy8/2.0 - getval("pwX180")/2.0); // xy8Y Period Two if (counter >= 1) { if (counter > 1) loop(v8,v9); if (onYxy8 == 2) dec2rgpulse(pwYxy8,v2,0.0,0.0); else delay(pwYxy8); getelem(ph1Yxy8,v1,v4); incr(v1); getelem(ph2Yxy8,ct,v2); add(v4,v2,v2); dec2phase(v2); delay(0.5/srate - pwYxy8); if (counter > 1) endloop(v9); } delay(pwYxy8/2.0); _dseqoff(mix); } // Begin Acquisition _dseqon(dec); obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { /* Internal variable declarations *************************/ int shapelist90,shapelist180,shapelistIR; double nseg; double seqtime,tau1,tau2,tau3, te1_delay,te2_delay,te3_delay, iti_delay, ti_delay, tr_delay; double kzero; double freq90[MAXNSLICE], freq180[MAXNSLICE], freqIR[MAXNSLICE]; /* Real-time variables used in this sequence **************/ int vpe_ctr = v2; // PE loop counter int vpe_mult = v3; // PE multiplier, ranges from -PE/2 to PE/2 int vms_slices = v4; // Number of slices int vms_ctr = v5; // Slice loop counter int vseg = v6; // Number of ETL segments int vseg_ctr = v7; // Segment counter int vetl = v8; // Echo train length int vetl_ctr = v9; // Echo train loop counter int vssc = v10; // Compressed steady-states int vtrimage = v11; // Counts down from nt, trimage delay when 0 int vacquire = v12; // Argument for setacqvar, to skip steady state acquires int vphase180 = v13; // phase of 180 degree refocusing pulse /* Initialize paramaters **********************************/ init_mri(); /* Load external PE table ********************************/ if (strcmp(petable,"n") && strcmp(petable,"N") && strcmp(petable,"")) { loadtable(petable); } else { abort_message("petable undefined"); } seqtime = 0.0; espmin = 0.0; kzero = getval("kzero"); /* RF Power & Bandwidth Calculations **********************/ init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2); init_rf(&p2_rf,p2pat,p2,flip2,rof1,rof2); calc_rf(&p1_rf,"tpwr1","tpwr1f"); calc_rf(&p2_rf,"tpwr2","tpwr2f"); /* Initialize gradient structures *************************/ init_readout_butterfly(&ro_grad,"ro",lro,np,sw,gcrushro,tcrushro); init_readout_refocus(&ror_grad,"ror"); init_phase(&pe_grad,"pe",lpe,nv); init_slice(&ss_grad,"ss",thk); /* NOTE assume same band widths for p1 and p2 */ init_slice_butterfly(&ss2_grad,"ss2",thk,gcrush,tcrush); init_slice_refocus(&ssr_grad,"ssr"); /* Gradient calculations **********************************/ calc_readout(&ro_grad,WRITE,"gro","sw","at"); calc_readout_refocus(&ror_grad,&ro_grad,NOWRITE,"gror"); calc_phase(&pe_grad,WRITE,"gpe","tpe"); calc_slice(&ss_grad,&p1_rf,WRITE,"gss"); calc_slice(&ss2_grad,&p1_rf,WRITE,""); calc_slice_refocus(&ssr_grad,&ss_grad,NOWRITE,"gssr"); /* Equalize refocus and PE gradient durations *************/ calc_sim_gradient(&ror_grad,&null_grad,&ssr_grad,0.0,WRITE); /* Create optional prepulse events ************************/ if (sat[0] == 'y') create_satbands(); if (fsat[0] == 'y') create_fatsat(); if (mt[0] == 'y') create_mtc(); if (ir[0] == 'y') { init_rf(&ir_rf,pipat,pi,flipir,rof1,rof2); calc_rf(&ir_rf,"tpwri","tpwrif"); init_slice_butterfly(&ssi_grad,"ssi",thk,gcrushir,tcrushir); calc_slice(&ssi_grad,&ir_rf,WRITE,"gssi"); } /* Set up frequency offset pulse shape list ********/ offsetlist(pss,ss_grad.ssamp, 0,freq90, ns,seqcon[1]); offsetlist(pss,ss2_grad.ssamp,0,freq180,ns,seqcon[1]); offsetlist(pss,ssi_grad.ssamp,0,freqIR, ns,seqcon[1]); shapelist90 = shapelist(p1pat,ss_grad.rfDuration, freq90, ns,0,seqcon[1]); shapelist180 = shapelist(p2pat,ss2_grad.rfDuration,freq180,ns,0,seqcon[1]); shapelistIR = shapelist(pipat,ssi_grad.rfDuration,freqIR, ns,0,seqcon[1]); /* same slice selection gradient and RF pattern used */ if (ss_grad.rfFraction != 0.5) abort_message("ERROR %s: RF pulse must be symmetric (RF fraction = %.2f)", seqfil,ss_grad.rfFraction); if (ro_grad.echoFraction != 1) abort_message("ERROR %s: Echo Fraction must be 1",seqfil); /* Find sum of all events in each half-echo period ********/ tau1 = ss_grad.rfCenterBack + ssr_grad.duration + ss2_grad.rfCenterFront; tau2 = ss2_grad.rfCenterBack + pe_grad.duration + ro_grad.timeToEcho; tau3 = ro_grad.timeFromEcho + pe_grad.duration + ss2_grad.rfCenterFront; espmin = 2*MAX(MAX(tau1,tau2),tau3); // Minimum echo spacing if (minesp[0] == 'y') { esp = espmin + 8e-6; // ensure at least 4us delays in both TE periods putvalue("esp",esp); } else if (((espmin+8e-6)-esp) > 12.5e-9) { abort_message("ERROR %s: Echo spacing too small, minimum is %.2fms\n",seqfil,(espmin+8e-6)*1000); } te1_delay = esp/2.0 - tau1; // Intra-esp delays te2_delay = esp/2.0 - tau2; te3_delay = esp/2.0 - tau3; te = kzero*esp; // Return effective TE putvalue("te",te); /* Minimum TR **************************************/ /* seqtime is total time per slice */ seqtime = 2*4e-6 + ss_grad.rfCenterFront + etl*esp + ro_grad.timeFromEcho + pe_grad.duration + te3_delay; /* Increase TR if any options are selected****************/ if (sat[0] == 'y') seqtime += ns*satTime; if (fsat[0] == 'y') seqtime += ns*fsatTime; if (mt[0] == 'y') seqtime += ns*mtTime; if (ir[0] == 'y') { /* Inter-IR delay */ if (ns > 1) iti_delay = seqtime - ssi_grad.duration; /* it is probably safe to assume that seqtime is always > the pulse widths */ else iti_delay = 0; /* Inversion Recovery */ timin = ssi_grad.rfCenterBack + ss_grad.rfCenterFront; timin += 8e-6; // from sp1on/off and after 90 pulse power setting timin += seqtime*(ns-1) + iti_delay; if (ti < timin + 4e-6) // ensure at least a 4us delay abort_message("%s: ti too short, minimum is %.2fms",seqfil,timin*1000); /* Delay after the last IR pulse */ ti_delay = ti - timin; /* force all slices to be acquired back-to-back, with a single TR delay at end */ trtype = 1; } else { iti_delay = ti_delay = 0; } trmin = ns*(seqtime + 4e-6); if (ir[0] == 'y') { trmin += (4e-6 + ssi_grad.rfCenterFront + ti); } if (mintr[0] == 'y'){ tr = trmin; putvalue("tr",tr); } if ((trmin-tr) > 12.5e-9) { abort_message("TR too short. Minimum TR = %.2fms\n",trmin*1000); } tr_delay = (tr - trmin)/ns; /* Set number of segments for profile or full image **********/ nseg = prep_profile(profile[0],nv/etl,&pe_grad,&per_grad); /* Shift DDR for pro *******************************/ roff = -poffset(pro,ro_grad.roamp); /* Calculate total acquisition time */ g_setExpTime(tr*(nt*nseg*getval("arraydim") + ssc) + trimage*getval("arraydim")); /* Return parameters to VnmrJ */ putvalue("rgss",ss_grad.tramp); //90 slice ramp if (ss2_grad.enableButterfly) { //180 slice ramps putvalue("rcrush",ss2_grad.crusher1RampToCrusherDuration); putvalue("rgss2",ss2_grad.crusher1RampToSsDuration); } else { putvalue("rgss2",ss2_grad.tramp); } if (ro_grad.enableButterfly) { putvalue("rgro",ro_grad.crusher1RampToSsDuration); } else { putvalue("rgro",ro_grad.tramp); //RO ramp } putvalue("tror",ror_grad.duration); //ROR duration putvalue("rgror",ror_grad.tramp); //ROR ramp putvalue("gpe",pe_grad.peamp); //PE max amp putvalue("gss",ss_grad.ssamp); putvalue("gro",ro_grad.roamp); /* PULSE SEQUENCE *************************************/ initval(fabs(ssc),vssc); // Compressed steady-state counter assign(one,vacquire); // real-time acquire flag /* Phase cycle: Alternate 180 phase to cancel residual FID */ mod2(ct,vphase180); // 0101 dbl(vphase180,vphase180); // 0202 add(vphase180,one,vphase180); // 1313 Phase difference from 90 add(vphase180,oph,vphase180); obsoffset(resto); delay(4e-6); initval(nseg,vseg); loop(vseg,vseg_ctr); /* TTL scope trigger **********************************/ sp1on(); delay(4e-6); sp1off(); /* Compressed steady-states: 1st array & transient, all arrays if ssc is negative */ if ((ix > 1) && (ssc > 0)) assign(zero,vssc); sub(vseg_ctr,vssc,vseg_ctr); // vpe_ctr counts up from -ssc assign(zero,vssc); ifzero(vseg_ctr); assign(zero,vacquire); // Start acquiring when vseg_ctr reaches zero endif(vseg_ctr); setacqvar(vacquire); // Turn on acquire when vacquire is zero if (ticks) { xgate(ticks); grad_advance(gpropdelay); delay(4e-6); } if(ir[0] == 'y') { /* IR for all slices prior to data acquisition */ obspower(ir_rf.powerCoarse); obspwrf(ir_rf.powerFine); delay(4e-6); msloop(seqcon[1],ns,vms_slices,vms_ctr); obl_shapedgradient(ssi_grad.name,ssi_grad.duration,0,0,ssi_grad.amp,NOWAIT); delay(ssi_grad.rfDelayFront); shapedpulselist(shapelistIR,ssi_grad.rfDuration,oph,rof1,rof2,seqcon[1],vms_ctr); delay(ssi_grad.rfDelayBack); delay(iti_delay); endmsloop(seqcon[1],vms_ctr); delay(ti_delay); } msloop(seqcon[1],ns,vms_slices,vms_ctr); /* Prepulse options ***********************************/ if (sat[0] == 'y') satbands(); if (fsat[0] == 'y') fatsat(); if (mt[0] == 'y') mtc(); /* 90 degree pulse ************************************/ rotate(); obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); delay(4e-6); obl_shapedgradient(ss_grad.name,ss_grad.duration,0,0,ss_grad.amp,NOWAIT); delay(ss_grad.rfDelayFront); shapedpulselist(shapelist90,ss_grad.rfDuration,oph,rof1,rof2,seqcon[1],vms_ctr); delay(ss_grad.rfDelayBack); /* Read dephase and Slice refocus *********************/ obl_shapedgradient(ssr_grad.name,ssr_grad.duration,ror_grad.amp,0.0,-ssr_grad.amp,WAIT); /* First half-TE delay ********************************/ obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); delay(te1_delay); peloop(seqcon[2],etl,vetl,vetl_ctr); mult(vseg_ctr,vetl,vpe_ctr); add(vpe_ctr,vetl_ctr,vpe_ctr); getelem(t1,vpe_ctr,vpe_mult); /* 180 degree pulse *******************************/ /* Note, ss2_grad.amp is max gradient for butterfly shape; flat top = _.ssamp */ obl_shapedgradient(ss2_grad.name,ss2_grad.duration,0,0,ss2_grad.amp,NOWAIT); delay(ss2_grad.rfDelayFront); shapedpulselist(shapelist180,ss2_grad.rfDuration,vphase180,rof1,rof2,seqcon[1],vms_ctr); delay(ss2_grad.rfDelayBack); /* Phase-encode gradient ******************************/ pe_shapedgradient(pe_grad.name,pe_grad.duration,0,0,0,-pe_grad.increment,vpe_mult,WAIT); /* Second half-TE period ******************************/ delay(te2_delay); /* Readout gradient ************************************/ obl_shapedgradient(ro_grad.name,ro_grad.duration,ro_grad.amp,0,0,NOWAIT); delay(ro_grad.atDelayFront); /* Acquire data ****************************************/ startacq(alfa); acquire(np,1.0/sw); endacq(); delay(ro_grad.atDelayBack); /* Rewinding phase-encode gradient ********************/ /* Phase encode, refocus, and dephase gradient ******************/ pe_shapedgradient(pe_grad.name,pe_grad.duration,0,0,0,pe_grad.increment,vpe_mult,WAIT); /* Second half-TE delay *******************************/ delay(te3_delay); endpeloop(seqcon[2],vetl_ctr); /* Relaxation delay ***********************************/ if (!trtype) delay(tr_delay); endmsloop(seqcon[1],vms_ctr); if (trtype) delay(ns*tr_delay); endloop(vseg_ctr); /* Inter-image delay **********************************/ sub(ntrt,ct,vtrimage); decr(vtrimage); ifzero(vtrimage); delay(trimage); endif(vtrimage); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values CP hx = getcp("HX",0.0,0.0,0,1); strncpy(hx.fr,"dec",3); strncpy(hx.to,"obs",3); putCmd("frHX='dec'\n"); putCmd("toHX='obs'\n"); DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pw1Hhytrap") + getval("pw2Hhytrap") + getval("tHX"); d.dutyoff = d1 + 4.0e-6 + getval("t1HYtrap") + getval("t2HYtrap"); d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(ph1Hhytrap,4,table1); settable(phYhytrap,4,table2); settable(ph2Hhytrap,4,table3); settable(phXhx,4,table4); settable(phHhx,4,table5); settable(phRec,4,table6); setreceiver(phRec); // Begin Sequence txphase(phXhx); decphase(ph1Hhytrap); dec2phase(phYhytrap); obspwrf(getval("aXhx")); decpwrf(getval("aHhytrap")); dec2pwrf(getval("aYhytrap")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // TRAPDOR on H with Y Modulation decrgpulse(getval("pw1Hhytrap"),ph1Hhytrap,0.0,0.0); decphase(ph2Hhytrap); decunblank(); dec2on(); delay(getval("t1HYtrap")); dec2off(); decrgpulse(getval("pw2Hhytrap"),ph2Hhytrap,0.0,0.0); decphase(phHhx); decunblank(); decphase(phHhx); decpwrf(getval("aHhx")); delay(getval("t2HYtrap")); // H to X Cross Polarization _cp_(hx,phHhx,phXhx); // Begin Acquisition _dseqon(dec); obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values double aXfam2 = getval("aXfam2"); double pw1Xfam2 = getval("pw1Xfam2"); double pw2Xfam2 = getval("pw2Xfam2"); double pw3Xfam2 = getval("pw3Xfam2"); double pw4Xfam2 = getval("pw4Xfam2"); double nXfam2 = getval("nXfam2"); initval(nXfam2,v4); putCmd("pw2Xmqmas=pwXfam1"); // Sequence uses pwXfam1 and sets pw2Xmqmas double d2init = getval("d2"); // Define the Split d2 in the Pulse Sequence double ival = getval("ival"); double d20 = 1.0; double d21 = 0.0; double d22 = 0.0; if (ival == 1.5) { d20 = 9.0*d2init/16.0; d21 = 7.0*d2init/16.0; d22 = 0.0; } else if (ival == 2.5) { d20 = 12.0*d2init/31.0; d21 = 0.0*d2init/31.0; d22 = 19.0*d2init/31.0; } else { d20 = 1.0*d2init; d21 = 0.0*d2init; d22 = 0.0*d2init; } double tXechselinit = getval("tXechsel"); // Adjust the selective echo delay for the double tXechsel = tXechselinit - 3.0e-6; // attenuator switch time. if (tXechsel < 0.0) tXechsel = 0.0; DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); // Set Constant-time Period for d2. if (d2_index == 0) d2_init = getval("d2"); double d2_ = (ni - 1)/sw1 + d2_init; putCmd("d2acqret = %f\n",roundoff(d2_,12.5e-9)); putCmd("d2dwret = %f\n",roundoff(1.0/sw1,12.5e-9)); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pw1Xmqmas") + nXfam2*(pw1Xfam2 + pw2Xfam2 + pw3Xfam2 +pw4Xfam2) + getval("pwXechsel"); d.dutyoff = d1 + 4.0e-6; d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = d2_ + tXechselinit + getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = d2_ + tXechselinit + getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables if (phase1 == 0) { settable(phf1Xmqmas,12,table1); settable(ph1Xfam2,6,table2); settable(ph2Xfam2,6,table3); settable(phfXechsel,96,table4); settable(phRec,48,table5); } else { settable(phf1Xmqmas,6,table6); settable(ph1Xfam2,6,table7); settable(ph2Xfam2,6,table8); settable(phfXechsel,48,table9); settable(phRec,24,table10); if (phase1 == 2) { tsadd(phf1Xmqmas,30,360); } } setreceiver(phRec); obsstepsize(1.0); // Begin Sequence xmtrphase(phf1Xmqmas); decphase(zero); obspower(getval("tpwr")); obspwrf(getval("aXmqmas")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // H Decoupler on Before MQMAS _dseqon(dec); // Two-Pulse MQMAS with DFS Conversion rgpulse(getval("pw1Xmqmas"),zero,0.0,0.0); xmtrphase(zero); txphase(ph1Xfam2); obspwrf(aXfam2); delay(d20); // X FAM2 Pulse loop(v4,v5); xmtron(); delay(pw1Xfam2); xmtroff(); txphase(ph2Xfam2); delay(pw2Xfam2); xmtron(); delay(pw3Xfam2); xmtroff(); txphase(ph2Xfam2); delay(pw4Xfam2); endloop(v5); // Tau Delay and Second Selective Echo Pulse xmtrphase(phfXechsel); obsblank(); obspower(getval("dbXechsel")); obspwrf(getval("aXechsel")); delay(3.0e-6); obsunblank(); delay(d21 + tXechsel); rgpulse(getval("pwXechsel"),zero,0.0,0.0); delay(d22); // Begin Acquisition obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { /* Internal variable declarations *********************/ double freq90[MAXNSLICE],freq180[MAXNSLICE]; double te_delay1,te_delay2,tr_delay,tau1,tau2,thk2fact,te_delay3=0.0,te_delay4=0.0,navTime=0.0; double crushm0,pem0,gcrushr,gcrushp,gcrushs,pecrush; double refsign=1,crushsign=1,navsign=1; int shape90,shape180,table=0,sepRefocus; char slprofile[MAXSTR]; /* sequence dependent diffusion variables */ double Gro,Gss; // "gdiff" for readout/readout refocus and slice/slice refocus double dgro,dgss; // "delta" for readout/readout refocus and slice/slice refocus double Dgro,Dgss; // "DELTA" for readout/readout refocus and slice/slice refocus double dcrush,dgss2; // "delta" for crusher and gss2 gradients double Dcrush,Dgss2; // "DELTA" for crusher and gss2 gradients int i; /* Real-time variables used in this sequence **********/ int vpe_steps = v1; // Number of PE steps int vpe_ctr = v2; // PE loop counter int vms_slices = v3; // Number of slices int vms_ctr = v4; // Slice loop counter int vpe_offset = v5; // PE/2 for non-table offset int vpe_mult = v6; // PE multiplier, ranges from -PE/2 to PE/2 int vph180 = v7; // Phase of 180 pulse int vph2 = v8; // alternate phase of 180 on odd transients int vssc = v9; // Compressed steady-states int vtrimage = v10; // Counts down from nt, trimage delay when 0 int vacquire = v11; // Argument for setacqvar, to skip steady state acquires int vtrigblock = v12; // Number of slices per trigger block /* Initialize paramaters *****************************/ init_mri(); thk2fact=getval("thk2fact"); pecrush=getval("pecrush"); sepRefocus=getvalnwarn("sepRefocus"); getstrnwarn("slprofile",slprofile); /* Check for external PE table ***********************/ init_tablepar("pelist"); // Initialize pelist parameter if (strcmp(petable,"n") && strcmp(petable,"N") && strcmp(petable,"")) { loadtable(petable); writetabletopar(t1,"pelist"); // Write t1 table to pelist parameter table = 1; } /* RF Power & Bandwidth Calculations ******************/ shape_rf(&p1_rf,"p1",p1pat,p1,flip1,rof1,rof2); shape_rf(&p2_rf,"p2",p2pat,p2,flip2,rof1,rof2); calc_rf(&p1_rf,"tpwr1","tpwr1f"); calc_rf(&p2_rf,"tpwr2","tpwr2f"); /* Initialize gradient structures *********************/ init_slice(&ss_grad,"ss",thk); init_slice(&ss2_grad,"ss2",thk*thk2fact); init_dephase(&crush_grad,"crush"); init_slice_refocus(&ssr_grad,"ssr"); if (FP_LT(tcrushro,alfa)) tcrushro=alfa; init_readout_butterfly(&ro_grad,"ro",lro,np,sw,gcrushro,tcrushro); init_readout_refocus(&ror_grad,"ror"); init_phase(&pe_grad,"pe",lpe,nv); init_generic(&spoil_grad,"spoil",gspoil,tspoil); /* Gradient calculations ******************************/ calc_readout(&ro_grad, WRITE,"gro","sw","at"); ro_grad.m0ref *= grof; calc_readout_refocus(&ror_grad,&ro_grad,NOWRITE,"gror"); calc_phase(&pe_grad,NOWRITE,"gpe","tpe"); calc_slice(&ss_grad,&p1_rf,WRITE,"gss"); calc_slice(&ss2_grad,&p2_rf,WRITE,"gss2"); calc_slice_refocus(&ssr_grad,&ss_grad,WRITE,"gssr"); calc_generic(&spoil_grad,WRITE,"",""); /* Make sure crushing in PE dimension does not refocus signal from 180 */ crushm0=fabs(gcrush*tcrush); pem0=0.0; gcrushp=0.0; if (pecrush) pem0=pe_grad.m0; calc_dephase(&crush_grad,WRITE,crushm0+pem0,"",""); gcrushr = crush_grad.amp*crushm0/crush_grad.m0; if (pecrush) gcrushp = crush_grad.amp; gcrushs = crush_grad.amp*crushm0/crush_grad.m0; /* Allow phase encode and read dephase to be separated from slice refocus */ if (sepRefocus) { /* Equalize read dephase and PE gradient durations */ calc_sim_gradient(&ror_grad,&pe_grad,&null_grad,0,WRITE); crushsign=-1; } else { if (slprofile[0] == 'y') { /* Combined slice refocusing and read dephasing, reverse gradient sign if ror > ssr integral */ refsign = (ss_grad.m0ref > ro_grad.m0ref) ? 1.0 : -1.0; ss_grad.m0ref -= ro_grad.m0ref; calc_slice_refocus(&ssr_grad,&ss_grad,NOWRITE,"gssr"); } /* Equalize both refocus and PE gradient durations */ calc_sim_gradient(&ror_grad,&pe_grad,&ssr_grad,0,WRITE); } /* Create optional prepulse events ********************/ if (fsat[0] == 'y') create_fatsat(); if (sat[0] == 'y') create_satbands(); if (mt[0] == 'y') create_mtc(); if (ir[0] == 'y') create_inversion_recovery(); if (diff[0] == 'y') init_diffusion(&diffusion,&diff_grad,"diff",gdiff,tdelta); sgl_error_check(sglerror); /* Min TE *********************************************/ te = granularity(te,2*GRADIENT_RES); /* tau1, tau2 are the sum of events in each half echo period */ /* tau1, tau2 include a GRADIENT_RES as this is minimum delay time */ tau1 = ss_grad.rfCenterBack + ssr_grad.duration + crush_grad.duration + ss2_grad.rfCenterFront + 2*GRADIENT_RES; tau2 = ss2_grad.rfCenterBack + crush_grad.duration + ro_grad.timeToEcho + GRADIENT_RES; if (sepRefocus) tau2 += ror_grad.duration; temin = 2*MAX(tau1,tau2); /* Diffusion ******************************************/ if (diff[0] == 'y') { /* granulate tDELTA */ tDELTA = granularity(tDELTA,GRADIENT_RES); /* taudiff is the duration of events between diffusion gradients */ taudiff = ss2_grad.duration + 2*crush_grad.duration + GRADIENT_RES; /* set minimum diffusion structure requirements for gradient echo: taudiff, tDELTA, te and minte[0] */ set_diffusion(&diffusion,taudiff,tDELTA,te,minte[0]); /* set additional diffusion structure requirements for spin echo: tau1 and tau2 */ set_diffusion_se(&diffusion,tau1,tau2); /* calculate the diffusion structure delays. address &temin is required in order to update temin accordingly */ calc_diffTime(&diffusion,&temin); } /* TE delays ******************************************/ if (minte[0] == 'y') { te = temin; putvalue("te",te); } if (FP_LT(te,temin)) { abort_message("TE too short, minimum TE = %.3f ms\n",temin*1000); } te_delay1 = te/2 - tau1 + GRADIENT_RES; te_delay2 = te/2 - tau2 + GRADIENT_RES; if (navigator[0] == 'y') { /* tau1, tau2 are the sum of events in each half echo period */ tau1 = ro_grad.timeFromEcho + pe_grad.duration + crush_grad.duration + ss2_grad.rfCenterFront; tau2 = ss2_grad.rfCenterBack + crush_grad.duration + ro_grad.timeToEcho; if (FP_GT(tau1,tau2)) { te_delay3 = GRADIENT_RES; te_delay4 = tau1-tau2+GRADIENT_RES; } else { te_delay3 = tau2-tau1+GRADIENT_RES; te_delay4 = GRADIENT_RES; } navTime = te_delay3 + ss2_grad.duration + 2*crush_grad.duration + ro_grad.duration + te_delay4 + 2*GRADIENT_RES; } /* Check nsblock, the number of slices blocked together (used for triggering and/or inversion recovery) */ check_nsblock(); /* Min TR *********************************************/ trmin = ss_grad.rfCenterFront + te + ro_grad.timeFromEcho + pe_grad.duration + 2*GRADIENT_RES; /* Increase TR if any options are selected ************/ if (spoilflag[0] == 'y') trmin += spoil_grad.duration; if (navigator[0] == 'y') trmin += navTime; if (sat[0] == 'y') trmin += satTime; if (fsat[0] == 'y') trmin += fsatTime; if (mt[0] == 'y') trmin += mtTime; if (ticks > 0) trmin += GRADIENT_RES; /* Adjust for all slices ******************************/ trmin *= ns; /* Inversion recovery *********************************/ if (ir[0] == 'y') { /* tauti is the additional time beyond IR component to be included in ti */ /* satTime, fsatTime and mtTime all included as those modules will be after IR */ tauti = satTime + fsatTime + mtTime + GRADIENT_RES + ss_grad.rfCenterFront; /* calc_irTime checks ti and returns the time of all IR components */ trmin += calc_irTime(tauti,trmin,mintr[0],tr,&trtype); } if (mintr[0] == 'y') { tr = trmin; putvalue("tr",tr); } if (FP_LT(tr,trmin)) { abort_message("TR too short, minimum TR = %.3f ms\n",trmin*1000); } /* TR delay *******************************************/ tr_delay = granularity((tr-trmin)/ns,GRADIENT_RES); /* Calculate B values *********************************/ if (ix == 1) { /* Calculate bvalues according to main diffusion gradients */ calc_bvalues(&diffusion,"dro","dpe","dsl"); /* Add components from additional diffusion encoding imaging gradients peculiar to this sequence */ /* Initialize variables */ dgro = 0.5*(ror_grad.duration+ro_grad.timeToEcho); Gro = ro_grad.m0ref/dgro; Dgro = dgro; if (!sepRefocus) Dgro = te-ss_grad.rfCenterBack-ro_grad.timeToEcho; dgss = 0.5*(ss_grad.rfCenterBack+ssr_grad.duration); Gss = ss_grad.m0ref/dgss; Dgss = dgss; dgss2 = ss2_grad.duration/2; Dgss2 = dgss2; dcrush = crush_grad.duration-crush_grad.tramp; Dcrush = crush_grad.duration+ss2_grad.duration; for (i = 0; i < diffusion.nbval; i++) { /* set droval, dpeval and dslval */ set_dvalues(&diffusion,&droval,&dpeval,&dslval,i); /* Readout */ diffusion.bro[i] += bval(Gro,dgro,Dgro); diffusion.bro[i] += bval(crushsign*gcrushr,dcrush,Dcrush); diffusion.bro[i] += bval_nested(gdiff*droval,tdelta,tDELTA,crushsign*gcrushr,dcrush,Dcrush); if (!sepRefocus) { diffusion.bro[i] += bval_nested(Gro,dgro,Dgro,gdiff*droval,tdelta,tDELTA); diffusion.bro[i] += bval_nested(Gro,dgro,Dgro,crushsign*gcrushr,dcrush,Dcrush); } /* Phase */ if (pecrush) { diffusion.bpe[i] += bval(gcrushp,dcrush,Dcrush); diffusion.bpe[i] += bval_nested(gdiff*dpeval,tdelta,tDELTA,gcrushp,dcrush,Dcrush); } /* Slice */ diffusion.bsl[i] += bval(Gss,dgss,Dgss); diffusion.bsl[i] += bval(gcrushs,dcrush,Dcrush); diffusion.bsl[i] += bval(ss2_grad.ssamp,dgss2,Dgss2); diffusion.bsl[i] += bval_nested(gdiff*dslval,tdelta,tDELTA,gcrushs,dcrush,Dcrush); diffusion.bsl[i] += bval_nested(gdiff*dslval,tdelta,tDELTA,ss2_grad.ssamp,dgss2,Dgss2); diffusion.bsl[i] += bval_nested(gcrushs,dcrush,Dcrush,ss2_grad.ssamp,dgss2,Dgss2); /* Readout/Phase Cross-terms */ diffusion.brp[i] += bval_cross(gdiff*dpeval,tdelta,tDELTA,crushsign*gcrushr,dcrush,Dcrush); diffusion.brp[i] += bval_cross(gdiff*dpeval,tdelta,tDELTA,crushsign*gcrushr,dcrush,Dcrush); if (pecrush) diffusion.brp[i] += bval_cross(gdiff*droval,tdelta,tDELTA,gcrushp,dcrush,Dcrush); if (!sepRefocus) { diffusion.brp[i] += bval_cross(Gro,dgro,Dgro,gdiff*dpeval,tdelta,tDELTA); if (pecrush) diffusion.brp[i] += bval_cross(Gro,dgro,Dgro,gcrushp,dcrush,Dcrush); } /* Readout/Slice Cross-terms */ diffusion.brs[i] += bval2(crushsign*gcrushr,gcrushs,dcrush,Dcrush); diffusion.brs[i] += bval_cross(gdiff*droval,tdelta,tDELTA,gcrushs,dcrush,Dcrush); diffusion.brs[i] += bval_cross(gdiff*dslval,tdelta,tDELTA,crushsign*gcrushr,dcrush,Dcrush); diffusion.brs[i] += bval_cross(gdiff*droval,tdelta,tDELTA,ss2_grad.ssamp,dgss2,Dgss2); if (!sepRefocus) { diffusion.brs[i] += bval_cross(Gro,dgro,Dgro,gdiff*dslval,tdelta,tDELTA); diffusion.brs[i] += bval_cross(Gro,dgro,Dgro,gcrushs,dcrush,Dcrush); diffusion.brs[i] += bval_cross(Gro,dgro,Dgro,ss2_grad.ssamp,dgss2,Dgss2); } /* Slice/Phase Cross-terms */ diffusion.bsp[i] += bval_cross(gdiff*dpeval,tdelta,tDELTA,gcrushs,dcrush,Dcrush); diffusion.bsp[i] += bval_cross(gdiff*dpeval,tdelta,tDELTA,ss2_grad.ssamp,dgss2,Dgss2); if (pecrush) { diffusion.bsp[i] += bval2(gcrushs,gcrushp,dcrush,Dcrush); diffusion.bsp[i] += bval_cross(gdiff*dslval,tdelta,tDELTA,gcrushp,dcrush,Dcrush); diffusion.bsp[i] += bval_cross(gcrushp,dcrush,Dcrush,ss2_grad.ssamp,dgss2,Dgss2); } } /* End for-all-directions */ /* Write the values */ write_bvalues(&diffusion,"bval","bvalue","max_bval"); } /* Generate phase-ramped pulses ***********************/ offsetlist(pss,ss_grad.ssamp,0,freq90,ns,seqcon[1]); offsetlist(pss,ss2_grad.ssamp,0,freq180,ns,seqcon[1]); shape90 = shapelist(p1_rf.pulseName,ss_grad.rfDuration,freq90,ns,ss_grad.rfFraction,seqcon[1]); shape180 = shapelist(p2_rf.pulseName,ss2_grad.rfDuration,freq180,ns,ss2_grad.rfFraction,seqcon[1]); /* Set pe_steps for profile or full image *************/ pe_steps = prep_profile(profile[0],nv,&pe_grad,&null_grad); F_initval(pe_steps/2.0,vpe_offset); /* Shift DDR for pro **********************************/ roff = -poffset(pro,ro_grad.roamp); /* Adjust experiment time for VnmrJ *******************/ if (ssc<0) { if (seqcon[2] == 'c') g_setExpTime(trmean*(ntmean*pe_steps*arraydim - ssc*arraydim)); else g_setExpTime(trmean*(ntmean*pe_steps*arraydim - ssc*pe_steps*arraydim)); } else g_setExpTime(trmean*ntmean*pe_steps*arraydim + tr*ssc); /* Slice profile **************************************/ if (slprofile[0] == 'y' && !sepRefocus) ror_grad.amp = 0; /* Set phase cycle table ******************************/ if (sepRefocus) settable(t2,1,ph180); // Phase encode is just before readout else settable(t2,2,ph180); /* PULSE SEQUENCE *************************************/ status(A); // Set status A rotate(); // Set gradient rotation according to psi, phi and theta triggerSelect(trigger); // Select trigger input 1/2/3 obsoffset(resto); // Set spectrometer frequency delay(GRADIENT_RES); // Delay for frequency setting initval(fabs(ssc),vssc); // Compressed steady-state counter if (seqcon[2]=='s') assign(zero,vssc); // Zero for standard peloop assign(one,vacquire); // real-time acquire flag setacqvar(vacquire); // Turn on acquire when vacquire is zero /* trigger */ if (ticks > 0) F_initval((double)nsblock,vtrigblock); /* Begin phase-encode loop ****************************/ peloop(seqcon[2],pe_steps,vpe_steps,vpe_ctr); if (trtype) delay(ns*tr_delay); // relaxation delay /* Compressed steady-states: 1st array & transient, all arrays if ssc is negative */ if ((ix > 1) && (ssc > 0)) assign(zero,vssc); sub(vpe_ctr,vssc,vpe_ctr); // vpe_ctr counts up from -ssc assign(zero,vssc); if (seqcon[2] == 's') assign(zero,vacquire); // Always acquire for non-compressed loop else { ifzero(vpe_ctr); assign(zero,vacquire); // Start acquiring when vpe_ctr reaches zero endif(vpe_ctr); } /* Read external kspace table if set ******************/ if (table) getelem(t1,vpe_ctr,vpe_mult); else { ifzero(vacquire); sub(vpe_ctr,vpe_offset,vpe_mult); elsenz(vacquire); sub(zero,vpe_offset,vpe_mult); // Hold PE mult at initial value for steady states endif(vacquire); } /* Phase cycle ****************************************/ getelem(t2,vpe_ctr,vph180); // For phase encoding with slice rephase add(oph,vph180,vph180); // 180 deg pulse phase alternates +/- 90 from receiver mod2(ct,vph2); dbl(vph2,vph2); add(vph180,vph2,vph180); // Alternate phase for 180 on odd transients /* Begin multislice loop ******************************/ msloop(seqcon[1],ns,vms_slices,vms_ctr); if (!trtype) delay(tr_delay); // Relaxation delay if (ticks > 0) { modn(vms_ctr,vtrigblock,vtest); ifzero(vtest); // if the beginning of an trigger block xgate(ticks); grad_advance(gpropdelay); delay(GRADIENT_RES); elsenz(vtest); delay(GRADIENT_RES); endif(vtest); } sp1on(); delay(GRADIENT_RES); sp1off(); // Scope trigger /* Prepulse options ***********************************/ if (ir[0] == 'y') inversion_recovery(); if (sat[0] == 'y') satbands(); if (fsat[0] == 'y') fatsat(); if (mt[0] == 'y') mtc(); /* Slice select RF pulse ******************************/ obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); delay(GRADIENT_RES); obl_shapedgradient(ss_grad.name,ss_grad.duration,0,0,ss_grad.amp,NOWAIT); delay(ss_grad.rfDelayFront); shapedpulselist(shape90,ss_grad.rfDuration,oph,rof1,rof2,seqcon[1],vms_ctr); delay(ss_grad.rfDelayBack); /* Slice refocus gradient *****************************/ if (sepRefocus) obl_shapedgradient(ssr_grad.name,ssr_grad.duration,0,0,-ssr_grad.amp,WAIT); else /* Include phase encode and readout dephase gradient if refocus gradients not separated */ pe_shapedgradient(pe_grad.name,pe_grad.duration,ror_grad.amp,0,-ssr_grad.amp*refsign,pe_grad.increment,vpe_mult,WAIT); if (diff[0] == 'y') { delay(diffusion.d1); diffusion_dephase(&diffusion,dro,dpe,dsl); delay(diffusion.d2); } else delay(te_delay1); /* Refocusing RF pulse ********************************/ obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); delay(GRADIENT_RES); obl_shapedgradient(crush_grad.name,crush_grad.duration,crushsign*gcrushr,gcrushp,gcrushs,WAIT); obl_shapedgradient(ss2_grad.name,ss2_grad.duration,0,0,ss2_grad.amp,NOWAIT); delay(ss2_grad.rfDelayFront); shapedpulselist(shape180,ss2_grad.rfDuration,vph180,rof2,rof2,seqcon[1],vms_ctr); delay(ss2_grad.rfDelayBack); obl_shapedgradient(crush_grad.name,crush_grad.duration,crushsign*gcrushr,gcrushp,gcrushs,WAIT); if (diff[0] == 'y') { delay(diffusion.d3); diffusion_rephase(&diffusion,dro,dpe,dsl); delay(diffusion.d4); } else delay(te_delay2); /* Readout dephase, phase encode & readout gradients **/ roff = -poffset(pro,ro_grad.roamp); // incase inverted navigator is acquired if (slprofile[0] == 'y') { /* Readout gradient only if refocus gradients not separated */ if (sepRefocus) obl_shapedgradient(ror_grad.name,ror_grad.duration,0,0,-ror_grad.amp,WAIT); obl_shapedgradient(ro_grad.name,ro_grad.duration,0,0,ro_grad.amp,NOWAIT); } else { /* Readout gradient only if refocus gradients not separated */ if (sepRefocus) pe_shapedgradient(pe_grad.name,pe_grad.duration,-ror_grad.amp,0,0,-pe_grad.increment,vpe_mult,WAIT); obl_shapedgradient(ro_grad.name,ro_grad.duration,ro_grad.amp,0,0,NOWAIT); } /* Acquisition ****************************************/ delay(ro_grad.atDelayFront-alfa); startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); /* Rewind Phase encoding ******************************/ pe_shapedgradient(pe_grad.name,pe_grad.duration,0,0,0,pe_grad.increment,vpe_mult,WAIT); /* Navigator acquisition ******************************/ if (navigator[0] == 'y') { delay(te_delay3); obl_shapedgradient(crush_grad.name,crush_grad.duration,-crushsign*gcrushr,0,-gcrushs,WAIT); obl_shapedgradient(ss2_grad.name,ss2_grad.duration,0,0,ss2_grad.amp,NOWAIT); delay(ss2_grad.rfDelayFront); shapedpulselist(shape180,ss2_grad.rfDuration,vph180,rof2,rof2,seqcon[1],vms_ctr); delay(ss2_grad.rfDelayBack); obl_shapedgradient(crush_grad.name,crush_grad.duration,-crushsign*gcrushr,0,-gcrushs,WAIT); delay(te_delay4); obl_shapedgradient(ro_grad.name,ro_grad.duration,navsign*ro_grad.amp,0,0,NOWAIT); delay(ro_grad.atDelayFront-alfa); startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); } if (spoilflag[0] == 'y') { obl_shapedgradient(spoil_grad.name,spoil_grad.duration,navsign*spoil_grad.amp,0,spoil_grad.amp,WAIT); } endmsloop(seqcon[1],vms_ctr); endpeloop(seqcon[2],vpe_ctr); /* Inter-image delay **********************************/ sub(ntrt,ct,vtrimage); decr(vtrimage); ifzero(vtrimage); delay(trimage); endif(vtrimage); /* Duty cycle *****************************************/ calc_grad_duty(tr); }
pulsesequence() { double freq,fstart,fend; double attn,attnd,attnd2,attnd3,attnd4,tattn;/* 5 channels supported */ double tunesw,tuneswd,tuneswd2,tuneswd3,tuneswd4,tsw; double gain,gaind,gaind2,gaind3,gaind4,tgain; int chan; double offset_sec; int np2; int nfv,index; nfv = (int) getval("nf"); np2 = np / 2; status(A); /* getRealSetDefault reduces logic - not in Inova */ getRealSetDefault(CURRENT,"tunesw",&tunesw,10000000.0); getRealSetDefault(CURRENT,"tuneswd",&tuneswd,tunesw); getRealSetDefault(CURRENT,"tuneswd2",&tuneswd2,tunesw); getRealSetDefault(CURRENT,"tuneswd3",&tuneswd3,tunesw); getRealSetDefault(CURRENT,"tuneswd4",&tuneswd4,tunesw); getRealSetDefault(CURRENT,"tupwr",&attn,10.0); getRealSetDefault(CURRENT,"tupwrd",&attnd,10.0); getRealSetDefault(CURRENT,"tupwrd2",&attnd2,10.0); getRealSetDefault(CURRENT,"tupwrd3",&attnd3,10.0); getRealSetDefault(CURRENT,"tupwrd4",&attnd4,10.0); getRealSetDefault(CURRENT,"gain",&gain,10.0); getRealSetDefault(CURRENT,"gaind",&gaind,gain); getRealSetDefault(CURRENT,"gaind2",&gaind2,gain); getRealSetDefault(CURRENT,"gaind3",&gaind3,gain); getRealSetDefault(CURRENT,"gaind4",&gaind4,gain); offset_sec = (0.5 / sw); setacqmode(WACQ|NZ); for (index = 0; index < nf; index++) { switch(index) { case 0: chan = OBSch; freq = sfrq; tattn = attn; tgain = gain; tsw = tunesw; break; case 1: chan = DECch; freq = dfrq; tattn = attnd; tgain = gaind; tsw = tuneswd; break; case 2: chan = DEC2ch; freq = dfrq2; tattn = attnd2; tgain = gaind2; tsw = tuneswd2; break; case 3: chan = DEC3ch; freq = dfrq3; tattn = attnd3; tgain = gaind3; tsw = tuneswd3; break; case 4: chan = DEC4ch; freq = dfrq4; tattn = attnd4; tgain = gaind4; tsw = tuneswd4; break; default: exit(-1); } fstart = freq - (tsw/2) * 1e-6; fend = freq + (tsw/2) * 1.0e-6; //printf("channel = %d frequency = %f\n",chan,freq); //printf("channel = %d frequency span = %f\n",chan, tsw); //printf("start=%f stop = %f\n",fstart,fend); //printf("gain = %f power = %f\n",tgain,tattn); hsdelay(d1); set4Tune(chan,tgain); assign(zero,oph); genPower(tattn,chan); delay(0.001); startacq(alfa); SweepNOffsetAcquire(fstart, fend, np2, chan, offset_sec); endacq(); delay(0.001); } }
void pulsesequence() { // // Set the Maximum Dynamic Table Number // settablenumber(10); setvvarnumber(30); //Define Variables and Objects and Get Parameter Values CP hx = getcp("HX",0.0,0.0,0,1); strncpy(hx.fr,"dec",3); strncpy(hx.to,"obs",3); putCmd("frHX='dec'\n"); putCmd("toHX='obs'\n"); WMPA cpmg = getcpmg("cpmgX"); strncpy(cpmg.ch,"obs",3); putCmd("chXcpmg='obs'\n"); double aXecho = getval("aXecho"); // define the echoX group in the sequence double t1Xechoinit = getval("t1Xecho"); double pwXecho = getval("pwXecho"); double t2Xechoinit = getval("t2Xecho"); double t1Xecho = t1Xechoinit - pwXecho/2.0 - getval("pwX90")/2.0; if (t1Xecho < 0.0) t1Xecho = 0.0; double t2Xecho = t2Xechoinit - pwXecho/2.0 - cpmg.r1 - cpmg.t2 - getval("ad"); if (t2Xecho < 0.0) t2Xecho = 0.0; DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Dutycycle Protection DUTY d = init_dutycycle(); d.dutyon = getval("pwH90") + getval("tHX") + pwXecho + (cpmg.cycles - 1)*cpmg.pw; d.dutyoff = d1 + 4.0e-6; d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = t1Xecho + t2Xecho + getval("rd") + getval("ad") + at - (cpmg.cycles - 1)*cpmg.pw; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = t1Xecho + t2Xecho + getval("rd") + getval("ad") + at - (cpmg.cycles - 1)*cpmg.pw; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(phH90,64,table1); settable(phXhx,64,table2); settable(phHhx,64,table3); settable(phXecho,64,table4); settable(phXcpmg,64,table5); settable(phRec,64,table6); setreceiver(phRec); // Begin Sequence txphase(phXhx); decphase(phH90); obspwrf(getval("aXhx")); decpwrf(getval("aH90")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // H to X Cross Polarization decrgpulse(getval("pwH90"),phH90,0.0,0.0); decphase(phHhx); _cp_(hx,phHhx,phXhx); // H Decoupling On decphase(zero); _dseqon(dec); // X Hahn Echo txphase(phXecho); obspwrf(aXecho); delay(t1Xecho); rgpulse(pwXecho,phXecho,0.0,0.0); delay(t2Xecho); // Apply CPMG Cycles obsblank(); _blank34(); delay(cpmg.r1); startacq(getval("ad")); _cpmg(cpmg,phXcpmg); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values CP hy = getcp("HY",0.0,0.0,0,1); strncpy(hy.fr,"dec",3); strncpy(hy.to,"dec2",4); putCmd("frHY='dec'\n"); putCmd("toHY='dec2'\n"); GP inept = getinept("ineptYX"); strncpy(inept.ch1,"dec2",4); strncpy(inept.ch2,"obs",3); putCmd("ch1YXinept='dec2'\n"); putCmd("ch2YXinept='obs'\n"); DSEQ dec = getdseq("H"); strncpy(dec.t.ch,"dec",3); putCmd("chHtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chHspinal='dec'\n"); DSEQ mix = getdseq("Hmix"); strncpy(mix.t.ch,"dec",3); putCmd("chHmixtppm='dec'\n"); strncpy(mix.s.ch,"dec",3); putCmd("chHmixspinal='dec'\n"); // Dutycycle Protection double simpw1 = inept.pw1; if (inept.pw2 > inept.pw1) simpw1 = inept.pw2; double simpw2 = inept.pw3; if (inept.pw4 > inept.pw3) simpw2 = inept.pw4; DUTY d = init_dutycycle(); d.dutyon = getval("pwH90") + getval("tHY") + 2.0*simpw1 + 2.0*simpw2; d.dutyoff = d1 + 4.0e-6; d.c1 = d.c1 + (!strcmp(dec.seq,"tppm")); d.c1 = d.c1 + ((!strcmp(dec.seq,"tppm")) && (dec.t.a > 0.0)); d.t1 = inept.t1 + inept.t2 + inept.t3 + inept.t4 + getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(dec.seq,"spinal")); d.c2 = d.c2 + ((!strcmp(dec.seq,"spinal")) && (dec.s.a > 0.0)); d.t2 = inept.t1 + inept.t2 + inept.t3 + inept.t4 + getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); // Set Phase Tables settable(phH90,16,table1); settable(phHhy,4,table2); settable(phYhy,4,table3); settable(ph1Yyxinept,4,table4); settable(ph1Xyxinept,4,table5); settable(ph2Yyxinept,4,table6); settable(ph2Xyxinept,16,table7); settable(ph3Yyxinept,8,table8); settable(ph3Xyxinept,4,table9); settable(phRec,8,table10); setreceiver(phRec); // Begin Sequence txphase(ph1Xyxinept); decphase(phH90); dec2phase(phYhy); obspwrf(getval("aXyxinept")); decpwrf(getval("aH90")); dec2pwrf(getval("aYhy")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // H to Y Cross Polarization decrgpulse(getval("pwH90"),phH90,0.0,0.0); decphase(phHhy); _cp_(hy,phHhy,phYhy); decphase(zero); // INEPT Transfer from Y to X _dseqon(mix); _ineptref(inept,ph1Yyxinept,ph1Xyxinept,ph2Yyxinept,ph2Xyxinept,ph3Yyxinept,ph3Xyxinept); _dseqoff(mix); // Begin Acquisition _dseqon(dec); obsblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
void pulsesequence() { //====================================================== // Define Variables and Objects and Get Parameter Values //====================================================== // -------------------------------- // Acquisition Decoupling // ------------------------------- char Xseq[MAXSTR]; getstr("Xseq",Xseq); DSEQ dec = getdseq("X"); strncpy(dec.t.ch,"dec",3); putCmd("chXtppm='dec'\n"); strncpy(dec.s.ch,"dec",3); putCmd("chXspinal='dec'\n"); //------------------------------------- // Homonuclear Decoupling During Echo //------------------------------------- MPDEC homo1 = getmpdec("hdec1H",0,0.0,0.0,0,1); strncpy(homo1.mps.ch,"obs",3); putCmd("chHhdec1='obs'\n"); // -------------------- // H echo calculation // -------------------- double t1Hecho = getval("t1Hecho") - getval("pwHecho")/2.0 - ((!strcmp(homo1.dm,"y"))?getval("pwHshort1")*2.:0.0); if (t1Hecho < 0.0) t1Hecho = 0.0; double t2Hecho = getval("t2Hecho") - getval("pwHecho")/2.0 - ((!strcmp(homo1.dm,"y"))?getval("pwHshort1")*2.:0.0) - getval("rd")- getval("ad"); if (t2Hecho < 0.0) t2Hecho = 0.0; double t1H_echo = 0.0; double t2H_echo = 0.0; double t1H_left = 0.0; double t2H_left = 0.0; if (!strcmp(homo1.dm,"y")) { t2H_echo = homo1.mps.t*((int)(t2Hecho/homo1.mps.t)); t2H_left = t2Hecho - t2H_echo; t1H_echo = t2H_echo; t1H_left = t1Hecho - t1H_echo; } //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); //---------------------- // Dutycycle Protection //---------------------- DUTY d = init_dutycycle(); d.dutyon = getval("pwH90"); d.dutyoff = d1 + 4.0e-6; if (!strcmp(homo1.dm,"y")) d.dutyon += t1H_echo + t2H_echo; else d.dutyoff += t1H_echo + t2H_echo; d.c1 = d.c1 + (!strcmp(Xseq,"tppm")); d.c1 = d.c1 + ((!strcmp(Xseq,"tppm")) && (dec.t.a > 0.0)); d.t1 = getval("rd") + getval("ad") + at; d.c2 = d.c2 + (!strcmp(Xseq,"spinal")); d.c2 = d.c2 + ((!strcmp(Xseq,"spinal")) && (dec.s.a > 0.0)); d.t2 = getval("rd") + getval("ad") + at; d = update_dutycycle(d); abort_dutycycle(d,10.0); //------------------------ // Set Phase Tables //----------------------- settable(phH90,4,table1); settable(phHecho,8,table2); settable(phRec,4,table3); setreceiver(phRec); //======================= // Begin Sequence //======================= txphase(phH90); decphase(zero); obspwrf(getval("aH90")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); //------------------------ // H Direct Polarization //------------------------ rgpulse(getval("pwH90"),phH90,0.0,0.0); obsunblank(); decunblank(); _unblank34(); // ----------------------------- // H Hahn Echo // ----------------------------- if (!strcmp(homo1.dm,"y")) { delay (t1H_left); if (getval("pwHshort1") > 0.0 ) { obspwrf(getval("aHhdec1")); rgpulse(getval("pwHshort1"),three,0.0,0.0); obsunblank(); } if (!strcmp(homo1.dm,"y")) _mpseqon(homo1.mps,zero); delay(t1H_echo); if (!strcmp(homo1.dm,"y")) _mpseqoff(homo1.mps); if (getval("pwHshort1") > 0.0 ) { obspwrf(getval("aHhdec1")); txphase(one); rgpulse(getval("pwHshort1"),one,0.0,0.0); obsunblank(); } } else delay(t1Hecho); txphase(phHecho); obspwrf(getval("aHecho")); rgpulse(getval("pwHecho"),phHecho,0.0,0.0); obsunblank(); if (!strcmp(homo1.dm,"y")) { if (getval("pwHshort1") > 0.0 ) { obspwrf(getval("aHhdec1")); rgpulse(getval("pwHshort1"),three,0.0,0.0); obsunblank(); } if (!strcmp(homo1.dm,"y")) _mpseqon(homo1.mps,zero); delay(t2H_echo); if (!strcmp(homo1.dm,"y")) _mpseqoff(homo1.mps); if(getval("pwHshort1")>0 ) { obspwrf(getval("aHhdec1")); rgpulse(getval("pwHshort1"),one,0.0,0.0); obsunblank(); } delay(t2H_left); } else delay(t2Hecho); //==================== // Begin Acquisition //==================== _dseqon(dec); obsblank(); decblank(); _blank34(); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }