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() { // 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 g_setExpTime(double val) { if (ix == 1) { usertime = val; putCmd("displayscantime(%f)\n",usertime); } }
static void gltrace_putMark(JNIEnv *jni, jclass klass, jstring jstr) { uint64_t bgn = gethrtime(); const char *str = (*jni)->GetStringUTFChars(jni, jstr, 0); putCmd(OPC_MARK); putString(str); (*jni)->ReleaseStringUTFChars(jni, jstr, str); uint64_t end = gethrtime(); putTime(bgn, end); }
void pulsesequence(){ //Define Variables and Get Parameter Values double pwTune = getval("pwTune"); pwTune = pwTune*6.0; at = pwTune*2.0; char atval[MAXSTR]; sprintf(atval,"at = %f\n", at); putCmd(atval); int chTune = (int) getval("chTune"); if ((chTune < 1) || (chTune > 4)) { abort_message("chTune(%d) must be between 1 and 4\n", chTune); } //-------------------------------------- // Copy Current Parameters to Processed //------------------------------------- putCmd("groupcopy('current','processed','acquisition')"); // Set Phase Tables settable(phTune,4,table1); settable(phRec,4,table2); setreceiver(t2); //Begin Sequence obspwrf(getval("aTune")); obsunblank(); decunblank(); _unblank34(); delay(d1); sp1on(); delay(2e-6); sp1off(); delay(2.0e-6); //Begin Phase Detected Pulse set4Tune(chTune,getval("gain")); delay(1.0e-4); ShapedXmtNAcquire("phtran",pwTune,phTune,6.0e-6,chTune); obsunblank(); decunblank(); _unblank34(); }
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(); }
/*------------------------------------------------*/ void putparsRf(RF_PULSE_T *rf) { char str[MAX_STR]; /* Generate "*pars" name from the base name */ strcpy(str,rf->pulseBase); strcat(str,"pars"); /* Write the shape parameters back to "*pars" */ putCmd("%s[1] = %f\n",str,rf->res*1.0e6); putCmd("%s[2] = %f\n",str,rf->bandwidth); putCmd("%s[3] = %d\n",str,rf->lobes); putCmd("%s[4] = %f\n",str,rf->cutoff); putCmd("%s[5] = %f\n",str,rf->mu); putCmd("%s[6] = %f\n",str,rf->beta); }
void pulsesequence() { double gzlvl1 = getval("gzlvl1"), gt1 = getval("gt1"), gzlvlE = getval("gzlvlE"), gtE = getval("gtE"), EDratio = getval("EDratio"), gzlvl_max = getval("gzlvl_max"), del = getval("del"), dosyfrq=getval("sfrq"), gstab = getval("gstab"), gzlvlhs = getval("gzlvlhs"), hsgt = getval("hsgt"), gtau,tauc,gt4,gzlvl4,Ddelta,dosytimecubed; char convcomp[MAXSTR],sspul[MAXSTR],lkgate_flg[MAXSTR],satmode[MAXSTR], alt_grd[MAXSTR],arraystring[MAXSTR]; int iphase, icosel; //synchronize gradients to srate for probetype='nano' // Preserve gradient "area" gt1 = syncGradTime("gt1","gzlvl1",1.0); gzlvl1 = syncGradLvl("gt1","gzlvl1",1.0); gtE = syncGradTime("gtE","gzlvlE",1.0); gzlvlE = syncGradLvl("gtE","gzlvlE",1.0); getstr("sspul",sspul); getstr("convcomp",convcomp); getstr("satmode",satmode); getstr("lkgate_flg",lkgate_flg); getstr("alt_grd",alt_grd); getstr("array",arraystring); iphase = (int)(getval("phase")+0.5); icosel = 1; tau = 1/(2*(getval("jnxh"))); gtau = 2*gstab + GRADIENT_DELAY; tauc = gtau+gtE-gstab; if (strcmp(arraystring,"gzlvl1,phase")!=0) fprintf(stdout,"Warning: array should be 'gzlvl1,phase' for this experiment"); Ddelta=gt1; /* the diffusion-encoding pulse width is gt1 */ if (convcomp[0] == 'y') dosytimecubed=2.0*Ddelta*Ddelta*(del-2.0*(Ddelta/3.0)); else dosytimecubed=2.0*Ddelta*Ddelta*(del-(Ddelta/3.0)); putCmd("makedosyparams(%e,%e)\n",dosytimecubed,dosyfrq); if (ni>1) putCmd("dosy3Dproc=\'y\'\n"); else putCmd("dosy3Dproc=\'n\'"); if (tau < (gtE+gstab)) { abort_message("0.5/jnxh must be greater than gtE+gstab"); } if (tau < (1.0*(gt1+gstab)+del)) { abort_message("0.5/jnxh must be greater than del+gt1+gstab"); } settable(t1,2,ph1); settable(t2,4,ph2); settable(t3,4,ph3); assign(zero,v4); getelem(t1,ct,v1); getelem(t3,ct,oph); if (iphase == 2) icosel = -1; initval(2.0*(double)((int)(d2*getval("sw1")+0.5)%2),v11); add(v1,v11,v1); add(v4,v11,v4); add(oph,v11,oph); mod2(ct,v10); /* gradients change sign at odd transients */ status(A); decpower(pwxlvl); if (sspul[0] == 'y') { zgradpulse(gzlvlhs,hsgt); rgpulse(pw,zero,rof1,rof1); zgradpulse(gzlvlhs,hsgt); } if (lkgate_flg[0]=='y') lk_sample(); /* turn lock sampling on */ if (convcomp[0]=='y') gt4=gt1*2.0; else gt4=gt1; gzlvl4=sqrt(gzlvl_max*gzlvl_max-gzlvl1*gzlvl1); if (satmode[0] == 'y') { if (d1 - satdly > 0) delay(d1 - satdly); obspower(satpwr); rgpulse(satdly,zero,rof1,rof1); obspower(tpwr); } else { delay(d1); } if (getflag("wet")) wet4(zero,one); if (lkgate_flg[0]=='y') lk_hold(); /* turn lock sampling off */ status(B); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl4,gt4); elsenz(v10); zgradpulse(-1.0*gzlvl4,gt4); endif(v10); } else zgradpulse(gzlvl4,gt4); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl4,gt4); elsenz(v10); zgradpulse(gzlvl4,gt4); endif(v10); } else zgradpulse(-1.0*gzlvl4,gt4); delay(gstab); rgpulse(pw,zero,rof1,1.0e-6); if (convcomp[0]=='y') { delay((tau - 1.0e-6 - (2*pw/PI)-del-2.333*gt1-2.0*gstab)/2.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(del/2.0-5.0*gt1/6.0-2.0*rof1,zero,rof1,rof1); } else delay(del/2.0-5.0*gt1/6.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); if (satmode[1] == 'y') { rgpulse(del/2.0-5.0*gt1/6.0-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(del/2.0-5.0*gt1/6.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); delay((tau - 1.0e-6 - (2*pw/PI)-del-2.333*gt1)/2.0); } else { delay((tau - 1.0e-6 - (2*pw/PI)-del-gt1-gstab)/2.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(del-gt1-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(del-gt1); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); delay((tau - 1.0e-6 - (2*pw/PI)-del-gt1-gstab)/2.0); } decrgpulse(pwx,v1,1.0e-6,1.0e-6); delay(gtE+gtau); decrgpulse(2*pwx,v4,1.0e-6,1.0e-6); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvlE,gtE); elsenz(v10); zgradpulse(-1.0*gzlvlE,gtE); endif(v10); } else zgradpulse(gzlvlE,gtE); delay(gstab); if (d2/2 > pw) delay(d2/2 - pw); else delay(d2/2); rgpulse(2.0*pw,zero,1.0e-6,1.0e-6); if (d2/2 > pw) delay(d2/2 - pw); else delay(d2/2); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvlE,gtE); elsenz(v10); zgradpulse(-1.0*gzlvlE,gtE); endif(v10); } else zgradpulse(gzlvlE,gtE); delay(gstab); decrgpulse(2*pwx,zero,1.0e-6,1.0e-6); delay(gtE+gtau); decrgpulse(pwx,t2,1.0e-6,1.0e-6); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(icosel*2.0*gzlvlE/EDratio,gtE); elsenz(v10); zgradpulse(-1.0*icosel*2.0*gzlvlE/EDratio,gtE); endif(v10); } else zgradpulse(icosel*2.0*gzlvlE/EDratio,gtE); if (convcomp[0]=='y') { delay((tau-tauc - 1.0e-6 - (2*pw/PI)-del-2.333*gt1-2.0*gstab)/2.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(del/2.0-5.0*gt1/6.0-2.0*rof1,zero,rof1,rof1); } else delay(del/2.0-5.0*gt1/6.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); if (satmode[1] == 'y') { rgpulse(del/2.0-5.0*gt1/6.0-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(del/2.0-5.0*gt1/6.0); zgradpulse(-gzlvl1,gt1); delay((tau-tauc - 1.0e-6 - (2*pw/PI)-del-2.333*gt1)/2.0); if (lkgate_flg[0]=='y') lk_sample(); } else { delay((tau-tauc - 1.0e-6 - (2*pw/PI)-del-gt1-gstab)/2.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(del-gt1-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(del-gt1); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); delay((tau-tauc - 1.0e-6 - (2*pw/PI)-del-gt1-gstab)/2.0); if (lkgate_flg[0]=='y') lk_sample(); } decpower(dpwr); delay(rof2 - POWER_DELAY); status(C); }
int excute (int myargc, char* myargv[])//command will not b null when called { char answer[MAX]; struct stat fstat, *sp; char *cmd; char *op = 0; sp = &fstat; bzero(answer, MAX); cmd = myargv[0]; char pwd[MAX]; //printf("Hi\n"); if(myargc > 1) { op = myargv[1]; } if(strcmp(cmd, "pwd") == 0) { write(newsock, "1", MAX);//sending sucess message getcwd(cwd, MAX); write(newsock, cwd, MAX); printf("client request pwd: %s\n", cwd); return 1; } if(strcmp(cmd, "ls") == 0) { //printf("Hi\n") ; printf("myargc = %d\n",myargc ); printf("myargv[0] = %s\n", myargv[0]); printf("myargv[1] = %s\n", myargv[1]); write(newsock, "1", MAX); if((myargc > 1) && lstat(myargv[1], &fstat) < 0) { write(newsock, "0", 2); printf("lstat %s failed\n", myargv[1]); return 0; } else if(myargc > 1) { if(S_ISDIR(sp->st_mode)) { //ls_dir(myargv[1]); strcat(answer, "dir"); write(newsock, answer, MAX); ls_dir(myargv[1]); return 0; }else{ strcat(answer, "file"); write(newsock, answer, MAX); ls_file(myargv[1]); //write(newsock,"done",MAX); return 0; } } if(myargc == 1) { strcat(answer, "dir"); write(newsock, answer, MAX); ls_dir("./"); printf("ls current directory OK"); return 0; } return 1; } if(strcmp(cmd, "cd") == 0) { printf("myargc =%d\n",myargc ); printf("op = %s\n",op ); write(newsock, "1", MAX);//start message if(myargc>1){ getcwd(pwd, MAX); strcat(pwd, "/"); strcat(pwd,op); printf("myargv[1] = %s\n",myargv[1] ); printf("pwd = %s\n", pwd); if(!(chdir(pwd) < 0)){ printf("client request: cd OK\n"); strcat(answer, "cd OK"); write(newsock, answer, MAX); printf("cd OK\n"); } } // printf("myargc =%d\n",myargc ); // printf("op = %s\n",op ); // write(newsock, "1", MAX);//start message // if(!(chdir(pwd) < 0))//cd sucessed // { // printf("client request: cd OK\n"); // strcat(answer, "cd OK"); // write(newsock, answer, MAX); // printf("cd OK\n"); // } if(myargc == 1) { printf("cd to HOME dir\n"); chdir("/home/haoran"); strcat(answer, "cd to HOME dir"); write(newsock, answer, MAX); printf("cd to HOME dir\n"); return 0; } else { printf("client request: cd FAILED\n"); strcat(answer, "cd FAILED"); write(newsock, answer, MAX); printf("cd FAILED\n"); } return 1; } if(strcmp(cmd, "mkdir") == 0) { printf("op = %s\n",op ); write(newsock, "1", MAX); if(mkdir(op, 0777) < 0) { printf("mkdir FAIL \n"); strcat(answer, "mkdir FAIL"); write(newsock, answer, MAX); }else { printf("mkdir %s OK\n", op); strcat(answer, "mkdir OK"); write(newsock, answer, MAX); printf("mkdir OK\n"); } return 1; } if(strcmp(cmd, "rmdir") == 0) { write(newsock, "1", MAX); if(rmdir(op) < 0) { printf("rmdir FAIL \n"); strcat(answer, "rmdir FAIL "); write(newsock, answer, MAX); }else { printf("rmdir %s OK\n", op); strcat(answer, "rmdir OK"); write(newsock, answer, MAX); printf("rmdir OK\n"); // } return 1; } if(strcmp(cmd, "rm") == 0) { write(newsock, "1", MAX); if(unlink(op) < 0) { printf("rm FAIL"); strcat(answer, "rm FAIL"); write(newsock, answer, MAX); } else { printf("rm %s OK\n", op); strcat(answer, "rm OK"); write(newsock, answer, MAX); printf("rm OK\n"); } return 1; } if(strcmp(cmd, "get") == 0) { getCmd(myargc, myargv); return 2;//need to work with server } if(strcmp(cmd, "put") == 0) { putCmd(myargc, myargv); return 2; } if(strcmp(cmd, "cat") == 0) { write(newsock, "1", MAX); strcat(answer, "Only cat local file"); write(newsock, answer, MAX); } if(strcmp(cmd, "quit") == 0)//should never get this { exit(1); } return 0; }
pulsesequence() { int selectCTP = getval("selectCTP"); double kappa = getval("kappa"), gzlvl1 = getval("gzlvl1"), gzlvl3 = getval("gzlvl3"), gzlvl_max = getval("gzlvl_max"), gt1 = getval("gt1"), gt3 = getval("gt3"), del = getval("del"), gstab = getval("gstab"), gss = getval("gss"), tweak = getval("tweak"), gzlvl_read=getval("gzlvl_read"), num=getval("num"), hsgt = getval("hsgt"), gzlvlhs = getval("gzlvlhs"), avm,gzlvl4,gt4,Dtau,Ddelta,dosytimecubed,dosyfrq; char alt_grd[MAXSTR],avflag[MAXSTR],delflag[MAXSTR],STEflag[MAXSTR],sspul[MAXSTR]; gt4 = 2.0*gt1; getstr("alt_grd",alt_grd); getstr("delflag",delflag); getstr("avflag",avflag); getstr("STEflag",STEflag); getstr("sspul",sspul); avm=0.0; if(avflag[0]=='y') { avm=1.0; } /* Decrement gzlvl4 as gzlvl1 is incremented, to ensure constant energy dissipation in the gradient coil Current through the gradient coil is proportional to gzlvl */ gzlvl4=sqrt(2.0*gt1*(1+3.0*kappa*kappa)/gt4)*sqrt(gzlvl_max*gzlvl_max/((1+kappa)*(1+kappa))-gzlvl1*gzlvl1); /* In pulse sequence, del>4.0*pw+3*rof1+2.0*gt1+5.0*gstab+gt3 */ if ((del-(4*pw+3.0*rof1+2.0*gt1+5.0*gstab+gt3)) < 0.0) { del=(4*pw+3.0*rof1+2.0*gt1+5.0*gstab+gt3); printf("Warning: del too short; reset to minimum value\n");} if ((d1 - (gt3+gstab) -2.0*(gt4/2.0+gstab)) < 0.0) { d1 = (gt3+gstab) -2.0*(gt4/2.0+gstab); printf("Warning: d1 too short; reset to minimum value\n");} if ((abs(gzlvl1)*(1+kappa)) > gzlvl_max) { abort_message("Max. grad. amplitude exceeded: reduce either gzlvl1 or kappa\n"); } if (ni > 1.0) { abort_message("This is a 2D, not a 3D dosy sequence: please set ni to 0 or 1\n"); } Ddelta=gt1; Dtau=2.0*pw+gstab+gt1/2.0+rof1; dosyfrq = getval("sfrq"); dosytimecubed=del+(gt1*((kappa*kappa-2)/6.0))+Dtau*((kappa*kappa-1.0)/2.0); dosytimecubed=(gt1*gt1)*dosytimecubed; putCmd("makedosyparams(%e,%e)\n",dosytimecubed,dosyfrq); /* This section determines the phase calculation for any number of transients */ initval(num,v14); add(v14,ct,v13); /* phase cycling calculation */ if(delflag[0]=='y') { mod4(v13,v3); /* 1st 180, 0 1 2 3 */ hlv(v13,v9); hlv(v9,v9); mod4(v9,v4); /* 2nd 90, (0)4 (1)4 (2)4 (3)4 */ hlv(v9,v9); hlv(v9,v9); mod4(v9,v1); /* 2nd 180, (0)16 (1)16 (2)16 (3)16 */ hlv(v9,v9); hlv(v9,v9); mod4(v9,v2); /* 1st 90, (0)64 (1)64 (2)64 (3)64 */ hlv(v9,v9); hlv(v9,v9); mod4(v9,v5); /* 3rd 90, (0)256 (1)256 (2)256 (3)256 */ if(STEflag[0]=='y') { dbl(v2,v6); assign(v6,oph); sub(oph,v1,oph); sub(oph,v3,oph); sub(oph,v4,oph); dbl(v5,v6); add(v6,oph,oph); mod4(oph,oph); /* receiver phase for STE */ } else { assign(v1,oph); dbl(v2,v6); sub(oph,v6,oph); add(v3,oph,oph); sub(oph,v4,oph); dbl(v5,v6); add(v6,oph,oph); mod4(oph,oph); /* receiver phase for STAE */ } } mod2(ct,v7); /* change sign of gradients on alternate transients */ status(A); if(delflag[0]=='y') { if (sspul[0]=='y') { zgradpulse(gzlvlhs,hsgt); rgpulse(pw,zero,rof1,rof1); zgradpulse(gzlvlhs,hsgt); } delay(d1 - (gt3+gstab) -2.0*(gt4/2.0+gstab)-gss); /* Move d1 to here */ zgradpulse(-1.0*gzlvl4,gt4/2.0); /* 1st dummy heating pulse */ delay(gstab); zgradpulse(gzlvl4,gt4/2.0); /* 2nd dummy heating pulse */ delay(gstab); delay(gss); /* Short delay to acheive steady state */ if (alt_grd[0] == 'y') { ifzero(v7); zgradpulse(-1.0*gzlvl3,gt3); elsenz(v7); zgradpulse(gzlvl3,gt3); endif(v7); } else zgradpulse(-1.0*gzlvl3,gt3); /* Spoiler gradient balancing pulse */ delay(gstab); } else delay(d1); status(B); /* first part of sequence */ if(delflag[0]=='y') { if(gt1>0 && abs(gzlvl1)>0) { if(selectCTP==2) { rgpulse(0.0, v1, rof1, rof2); /* first 90, v1 */ } else rgpulse(pw, v1, rof1, rof2); /* first 90, v1 */ zgradpulse(gzlvl1*(1.0+kappa),gt1/2.0); /*1st main gradient pulse*/ delay(gstab); if(selectCTP==2) { rgpulse(0.0, v2, rof1, rof2); /* first 180, v2 */ } else rgpulse(pw*2.0, v2, rof1, rof2); /* first 180, v2 */ zgradpulse(-1.0*gzlvl1*(1.0-kappa),gt1/2.0); /*2nd main grad. pulse*/ delay(gstab); if((selectCTP==1)||(selectCTP==2)) { rgpulse(0.0, v3, rof1, rof2); /* second 90, v3 */ } else rgpulse(pw, v3, rof1, rof2); /* second 90, v3 */ zgradpulse(-gzlvl1*2.0*kappa,gt1/2.0); /*Lock refocussing pulse*/ delay(gstab); if (alt_grd[0] == 'y') { ifzero(v7); zgradpulse(gzlvl3,gt3); /* Spoiler gradient */ elsenz(v7); zgradpulse(-1.0*gzlvl3,gt3); endif(v7); } else zgradpulse(gzlvl3,gt3); /* Spoiler gradient */ delay(gstab); delay(del-4.0*pw-3.0*rof1-2.0*gt1-5.0*gstab-gt3); /* diffusion delay */ if(STEflag[0]=='y') { zgradpulse(2.0*kappa*gzlvl1,gt1/2.0); /*Lock refocussing pulse*/ delay(gstab); } else { zgradpulse(-2.0*kappa*gzlvl1,gt1/2.0); /*Lock refocussing pulse*/ delay(gstab); } if(selectCTP==1) { rgpulse(0.0, v4, rof1, rof2); /* third 90, v4 */ } else rgpulse(pw, v4, rof1, rof2); /* third 90, v4 */ if(STEflag[0]=='y') { zgradpulse(-gzlvl1*(1.0+kappa),gt1/2.0); /*3rd main gradient pulse*/ delay(gstab); } else { zgradpulse(gzlvl1*(1.0+kappa),gt1/2.0); /*3rd main gradient pulse*/ delay(gstab); } rgpulse(pw*2.0, v5, rof1, rof2); /* second 180, v5 */ rcvron(); if(STEflag[0]=='y') { zgradpulse(1.0*(1.0-kappa)*gzlvl1+tweak-avm*at*gzlvl_read/gt1,gt1/2.0); /*4th main grad. pulse*/ delay(gstab); } else { zgradpulse(-1.0*(1.0-kappa)*gzlvl1-tweak-avm*at*gzlvl_read/gt1,gt1/2.0); /*4th main grad. pulse*/ delay(gstab); } rgradient('z',gzlvl_read); } } else rgpulse(pw,oph,rof1,rof2); status(C); }
void CoreBasicHandler::putCmd(const QString &cmd, const QByteArray ¶m, const QByteArray &prefix, const bool prepend) { QList<QByteArray> list; list << param; emit putCmd(cmd, list, prefix, prepend); }
void CtcpHandler::reply(const QString &bufname, const QString &ctcpTag, const QString &message) { QList<QByteArray> params; params << serverEncode(bufname) << lowLevelQuote(pack(serverEncode(ctcpTag), userEncode(bufname, message))); emit putCmd("NOTICE", params); }
void calc_epi(EPI_GRADIENT_T *epi_grad, READOUT_GRADIENT_T *ro_grad, PHASE_ENCODE_GRADIENT_T *pe_grad, REFOCUS_GRADIENT_T *ror_grad, PHASE_ENCODE_GRADIENT_T *per_grad, READOUT_GRADIENT_T *nav_grad, int write_flag) { /* Variables for generating gradient shapes */ double dwint,blipint,skip,dw; int np_ramp, np_flat, npro; double *dwell, *dac; double pos, neg; int pt, pts, inx=0, lobe, lobes, blippts, zeropts; /* Variables for generating tables */ int n, seg, steps; char order_str[MAXSTR],gpe_tab[MAXSTR],tab_file[MAXSTR]; FILE *fp; /********************************************************************************/ /* Error Checks */ /********************************************************************************/ /* make sure that the combination of nseg, ky_order and fract_ky make sense */ if (ky_order[0] == 'c') { /* Can't do just one segment with centric */ if (nseg == 1) { if (ix == 1) { warn_message("WARNING %s: ky_order set to 'l'\n",seqfil); warn_message(" Only linear ordering allowed with single-shot acquisition\n"); } ky_order[0] = 'l'; } /* Must have even number of shots with centric ordering */ if (((int) nseg % 2) == 1) abort_message("ERROR %s: Must do even number of shots with centric ordering\n",seqfil); /* Can't do fractional ky with centric acquisition */ if (fract_ky != pe_grad->steps/2) abort_message("ERROR %s: fract_ky must be = nv/2 (%d) for centric acquisition\n",seqfil,(int) (pe_grad->steps/2)); } if (fract_ky > pe_grad->steps/2) abort_message("ERROR %s: fract_ky must be <= nv/2 (%d)\n",seqfil,(int) (pe_grad->steps/2)); /* calculate etl */ switch(ky_order[0]) { case 'l': epi_grad->etl = (pe_grad->steps/2 + fract_ky)/nseg; epi_grad->center_echo = fract_ky/nseg - 1; if (epi_grad->etl - ((int) epi_grad->etl) > 0.005) abort_message("%s: Echo train length ((%d/2+%d)/%d = %.2f) not an integer\n", seqfil,(int)pe_grad->steps,(int) fract_ky, (int) nseg,epi_grad->etl); break; case 'c': epi_grad->etl = pe_grad->steps/nseg; epi_grad->center_echo = 0; if (epi_grad->etl - ((int) epi_grad->etl) > 0.005) abort_message("%s: Echo train length (%d/%d) not an integer\n", seqfil,(int)pe_grad->steps,(int) nseg); break; default: abort_message("%s: ky_order %s not recognized, use 'l' (linear) or 'c' (centric)\n", seqfil, ky_order); break; } epi_grad->center_echo += ssepi*2; /********************************************************************************/ /* Generate a single phase encoding blip and the dephaser */ /********************************************************************************/ blipint = 1/(pe_grad->fov/10*nuc_gamma()); /* base step in PE dimension */ switch(ky_order[0]) { case 'l': /* each blip will jump nseg lines in ky: */ pe_grad->m0 = blipint*nseg; per_grad->steps = pe_grad->steps; /* each increment is = one blip unit */ per_grad->m0 = blipint*per_grad->steps/2; /* start at nv/2, step 1 */ break; case 'c': /* each blip will jump nseg/2 lines in ky: */ pe_grad->m0 = blipint*nseg/2; per_grad->steps = nseg; per_grad->m0 = blipint*per_grad->steps/2; /* start at nseg/2, step 1 */ break; default: abort_message("ky_order %s not recognized, use 'l' (linear) or 'c' (centric)\n",ky_order); break; } /* Phase encoding blip */ pe_grad->calcFlag = SHORTEST_DURATION_FROM_MOMENT; pe_grad->writeToDisk = FALSE; calcPhase(pe_grad); if ((pe_grad->duration < epi_grad->tblip) || (pe_grad->amp/pe_grad->tramp > pe_grad->slewRate)) { pe_grad->tramp = granularity(MAX(epi_grad->tblip/2,pe_grad->amp/pe_grad->slewRate),pe_grad->resolution); pe_grad->duration = 2*pe_grad->tramp; pe_grad->calcFlag = AMPLITUDE_FROM_MOMENT_DURATION_RAMP; calcPhase(pe_grad); } /* Phase encoding dephaser */ per_grad->calcFlag = SHORTEST_DURATION_FROM_MOMENT; per_grad->maxGrad *= glim; per_grad->writeToDisk = write_flag; calcPhase(per_grad); /* Now adjust the initial dephaser for fractional k-space */ per_grad->amp *= (fract_ky/(pe_grad->steps/2)); /* Create an array for dwell times */ npro = ro_grad->numPointsFreq; if ((dwell = (double *)malloc(sizeof(double)*npro)) == NULL) { abort_message("Can't allocate memory for dwell"); } /********************************************************************************/ /* Generate a single readout lobe */ /********************************************************************************/ ro_grad->writeToDisk = nav_grad->writeToDisk = FALSE; calcReadout(ro_grad); dw = granularity(1/sw,1/epi_grad->ddrsr); dwint = dw*ro_grad->amp; skip = getval("skip"); /* User specified min delay between acquisitions */ skip = MAX(skip,pe_grad->duration); /* Is PE blip longer? Then use that */ skip /= 2; /* in further calculations, skip is the skipped part on either ramp */ /* If RO ramp - skip isn't at least one dwell, then we can't do ramp sampling */ if (ro_grad->tramp - (skip + dw + getval("aqtm") - at) < dw) { if (rampsamp[0] == 'y') { printf("Blip duration or Min echo spacing is long (%.2fus), ramp sampling turned off",2*skip*1e6); rampsamp[0] = 'n'; } /* set ramp time and recalculate */ ro_grad->tramp = skip + (dw + getval("aqtm") - at); calcReadout(ro_grad); } /********************************************************************************/ if (rampsamp[0] == 'n') { /* No rampsampling, just use simple RO shape */ /********************************************************************************/ np_ramp = 0; np_flat = npro; skip = (ro_grad->atDelayFront + ro_grad->atDelayBack)/2; /* Set dwell array */ for (pt = 0; pt < npro; pt++) dwell[pt] = dw; dwell[npro-1] = 2*dw; /* gradient duration is actually dw too long */ } /********************************************************************************/ else { /* rampsampling */ /********************************************************************************/ calc_readout_rampsamp(ro_grad,dwell,&skip,&np_ramp); np_flat = npro - 2*np_ramp; } /* end if rampsampling = 'y' */ switch (ro_grad->error) { case ERR_NO_ERROR: break; case ERR_AMPLITUDE: abort_message("Readout gradient too large, increase FOV to %.2fmm", ro_grad->bandwidth/(ro_grad->gamma * ro_grad->maxGrad * MM_TO_CM)); break; default: abort_message("Error in calculation of readout gradient (error %d)", (int)ro_grad->error); break; } /* We now have a single lobe, keep that for the navigator echo */ nav_grad->amp = ro_grad->amp; nav_grad->duration = ro_grad->duration; nav_grad->tramp = ro_grad->tramp; nav_grad->m0 = ro_grad->m0; nav_grad->m0ref = ro_grad->m0ref; nav_grad->dataPoints = ro_grad->dataPoints; nav_grad->numPoints = ro_grad->numPoints; nav_grad->slewRate = ro_grad->slewRate; /********************************************************************************/ /* Readout dephaser */ /********************************************************************************/ ror_grad->balancingMoment0 = nav_grad->m0ref; /* ideal moment */ /* adjust with grora tweaker */ if (grora == 0) { warn_message("grora tweaker is 0, probably using old protocol - changed to 1.0"); grora = 1.0; } ror_grad->balancingMoment0 *= grora; ror_grad->writeToDisk = write_flag; calcRefocus(ror_grad); /********************************************************************************/ /* Expand gradient shapes to full echo train */ /********************************************************************************/ /* Readout - The navigator shape holds a single lobe */ /********************************************************************************/ /* Does positive or negative lobe need to be adjusted for tweaker? */ pos = neg = 1; if (groa >= 0) /* Adjust negative downwards, since positive is already at max */ neg = (1 - groa/nav_grad->amp); else /* groa < 0, Adjust positive downwards */ pos = (1 + groa/nav_grad->amp); /* Increase the size of ro shape to hold full shape */ /* free(ro_grad->dataPoints); Don't free this, it's now assigned to the navigator echo */ lobes = (epi_grad->etl + ssepi*2); ro_grad->numPoints *= lobes; if ((ro_grad->dataPoints = (double *)malloc(ro_grad->numPoints*sizeof(double))) == NULL) abort_message("%s: Problem allocating memory for EPI readout gradient",seqfil); ro_grad->duration *= lobes; /* Concatenate positive and negative lobes */ /* until we have a full echo train (plus ssepi) */ pts = nav_grad->numPoints; inx = 0; for (lobe = 0; lobe < lobes/2; lobe++) { for (pt = 0; pt < pts; pt++) ro_grad->dataPoints[inx++] = nav_grad->dataPoints[pt] * pos; for (pt = 0; pt < pts; pt++) ro_grad->dataPoints[inx++] = -nav_grad->dataPoints[pt] * neg; } /********************************************************************************/ /* Phase encoding */ /********************************************************************************/ /* Keep blip */ blippts = pe_grad->numPoints; if ((dac = (double *)malloc(blippts*sizeof(double))) == NULL) abort_message("%s: Problem allocating memory for EPI blip",seqfil); for (pt = 0; pt < blippts; pt++) dac[pt] = pe_grad->dataPoints[pt]; /* Increase the size of pe shape to hold full shape */ free(pe_grad->dataPoints); if ((pe_grad->dataPoints = (double *)malloc(ro_grad->numPoints*sizeof(double))) == NULL) abort_message("%s: Problem allocating memory for EPI phase encoding gradient",seqfil); /* Pad front of shape - including ssepi time - with zeros */ inx = 0; lobes = ssepi*2; zeropts = nav_grad->numPoints; for (lobe = 0; lobe < lobes; lobe++) { for (pt = 0; pt < zeropts; pt++) { pe_grad->dataPoints[inx++] = 0; } } zeropts = nav_grad->numPoints - blippts/2; for (pt = 0; pt < zeropts; pt++) pe_grad->dataPoints[inx++] = 0; lobes = epi_grad->etl-1; zeropts = nav_grad->numPoints - blippts; for (lobe=0; lobe < lobes; lobe++) { for (pt = 0; pt < blippts; pt++) pe_grad->dataPoints[inx++] = dac[pt]; for (pt = 0; pt < zeropts; pt++) pe_grad->dataPoints[inx++] = 0; } /* Add a few zeros, half the duration of the blip + one lobe, at the very end */ zeropts = blippts/2 + nav_grad->numPoints; zeropts = blippts/2; for (pt = 0; pt < zeropts; pt++) pe_grad->dataPoints[inx++] = 0; pe_grad->numPoints = ro_grad->numPoints; pe_grad->duration = ro_grad->duration; /********************************************************************************/ /* Keep some parameters in EPI struct */ /********************************************************************************/ epi_grad->skip = skip; epi_grad->np_flat = np_flat; epi_grad->np_ramp = np_ramp; epi_grad->dwell = dwell; epi_grad->duration = ro_grad->duration; epi_grad->numPoints = ro_grad->numPoints; epi_grad->amppos = nav_grad->amp*pos; epi_grad->ampneg = -nav_grad->amp*neg; epi_grad->amppe = pe_grad->amp; /********************************************************************************/ /* Write shapes to disk */ /********************************************************************************/ if (writeToDisk(ro_grad->dataPoints, ro_grad->numPoints, 0, ro_grad->resolution, TRUE /* rollout */, ro_grad->name) != ERR_NO_ERROR) abort_message("Problem writing shape %s (%d points) to disk", ro_grad->name,(int) ro_grad->numPoints); if (writeToDisk(nav_grad->dataPoints, nav_grad->numPoints, 0, nav_grad->resolution, TRUE /* rollout */, nav_grad->name) != ERR_NO_ERROR) abort_message("Problem writing shape %s (%d points) to disk", nav_grad->name,(int) nav_grad->numPoints); if (writeToDisk(pe_grad->dataPoints, pe_grad->numPoints, 0, pe_grad->resolution, TRUE /* rollout */, pe_grad->name) != ERR_NO_ERROR) abort_message("Problem writing shape %s (%d points) to disk", pe_grad->name,(int) pe_grad->numPoints); /********************************************************************************/ /* Create EPI tables */ /********************************************************************************/ /* Generates two tables: */ /* t1 that specifies the k-space ordering, used by recon_all */ /* t2 that specifies which direction in k-space to go in a given shot */ /* 1 = positive blips, and -1 = negative blips */ if ((epi_grad->table1 = (int *)malloc(pe_grad->steps*sizeof(int))) == NULL) abort_message("%s: Problem allocating memory for EPI table1",seqfil); if ((epi_grad->table2 = (int *)malloc(nseg*sizeof(int))) == NULL) abort_message("%s: Problem allocating memory for EPI table2",seqfil); switch(ky_order[0]) { case 'l': inx = 0; for (seg = 0; seg < nseg; seg++) { epi_grad->table1[inx++] = -fract_ky + seg; for (n = 0; n < epi_grad->etl-1; n++) { epi_grad->table1[inx] = (int) (epi_grad->table1[inx-1]+nseg); inx++; } } for (seg = 0; seg < nseg; seg++) epi_grad->table2[seg] = 1; break; case 'c': inx = 0; for (seg = 0; seg < nseg; seg++) { epi_grad->table1[inx++] = -(nseg/2 - seg); for (n = 0; n < epi_grad->etl-1; n++) { if (epi_grad->table1[inx-1] >= 0) epi_grad->table1[inx] = (int) (epi_grad->table1[inx-1] + nseg/2); else epi_grad->table1[inx] = (int) (epi_grad->table1[inx-1] - nseg/2); inx++; } } for (seg = 0; seg < nseg; seg++) epi_grad->table2[seg] = ((nseg/2 - 1 - seg >= 0) ? -1 : 1); break; default: /* This should have been caught earlier */ break; } steps = inx; /* Print table t1 to file in tablib */ switch(ky_order[0]) { case 'l': sprintf(order_str,"lin"); break; case 'c': sprintf(order_str,"cen"); break; default: abort_message("%s: ky_order %s not recognized, use 'l' (linear) or 'c' (centric)\n", seqfil,ky_order); } if (ky_order[1] == 'r') /* not reversed */ sprintf(gpe_tab,"%s_nv%d_f%d_%s%d_rev",seqfil, (int)pe_grad->steps,(int)fract_ky,order_str,(int)nseg); else sprintf(gpe_tab,"%s_nv%d_f%d_%s%d",seqfil, (int)pe_grad->steps,(int)fract_ky,order_str,(int)nseg); sprintf(tab_file,"%s/tablib/%s",userdir,gpe_tab); if ((fp = fopen(tab_file,"w")) == NULL) { abort_message("Error opening file %s\n",gpe_tab); } fprintf(fp,"t1 = "); for (inx = 0; inx < steps; inx++) { if (ky_order[1] == 'r') fprintf(fp,"%d ", epi_grad->table1[inx]); else fprintf(fp,"%d ", -epi_grad->table1[inx]); } fprintf(fp,"\n"); fclose(fp); strcpy(petable,gpe_tab); putstring("petable",gpe_tab); /* Return values in VnmrJ parameter pe_table */ putCmd("exists('pe_table','parameter'):$ex\n"); putCmd("if ($ex > 0) then\n"); putCmd(" pe_table = 0\n"); //reset pe_table array for (inx = 0; inx < steps; inx++) { putCmd(" pe_table[%d] = %d\n",inx+1, ((ky_order[1] == 'r') ? 1 : -1)*epi_grad->table1[inx]); } putCmd("endif\n"); }
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(); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values SHAPE p1 = getpulse("90H",0.0,0.0,1,0); strncpy(p1.pars.ch,"dec",3); putCmd("chH90='dec'\n"); p1.pars.array = disarry("xx", p1.pars.array); p1 = update_shape(p1,0.0,0.0,1); MPSEQ ph = getpmlgxmx("pmlgH",0,0.0,0.0,1,0); strncpy(ph.ch,"dec",3); putCmd("chHpmlg='dec'\n"); double pwHpmlg = getval("pwHpmlg"); ph.nelem = (int) (d2/(2.0*pwHpmlg) + 0.1); ph.array = disarry("xx", ph.array); ph = update_mpseq(ph,0,p1.pars.phAccum,p1.pars.phInt,1); SHAPE p2 = getpulse("90H",0.0,0.0,2,0); strncpy(p2.pars.ch,"dec",3); putCmd("chH90='dec'\n"); p2.pars.array = disarry("xx", p2.pars.array); p2 = update_shape(p2,ph.phAccum,ph.phInt,2); double pwX180 = getval("pwX180"); double d22 = ph.t/2.0 - pwX180/2.0; if (d22 < 0.0) d22 = 0.0; // CP hx and DSEQ dec Return to the Reference Phase 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"); // 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 = p1.pars.t + d2_ + p2.pars.t + getval("pwH90") + getval("pwHtilt") + getval("tHX"); d.dutyoff = d1 + 4.0e-6 + getval("tHmix"); 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(ph1H90,4,table1); settable(phHpmlg,4,table2); settable(ph2H90,4,table3); settable(ph3H90,4,table4); settable(phHtilt,4,table5); settable(phXhx,4,table6); settable(phHhx,4,table7); settable(phRec,4,table8); //Add STATES TPPI ("States with "FAD") tsadd(phRec,2*d2_index,4); if (phase1 == 2) { tsadd(ph2H90,2*d2_index+3,4); } else { tsadd(ph2H90,2*d2_index,4); } setreceiver(phRec); // Begin Sequence txphase(phXhx); decphase(ph1H90); obspwrf(getval("aX180")); decpwrf(getval("aH90")); obsunblank();decunblank(); _unblank34(); delay(d1); sp1on(); delay(2.0e-6); sp1off(); delay(2.0e-6); // Offset H Preparation with a Tilt Pulse _shape(p1,ph1H90); // Offset SAMn Spinlock on H During F1 with Optional pwX180 _mpseqon(ph,phHpmlg); delay(d22); rgpulse(pwX180,zero,0.0,0.0); obspwrf(getval("aX90")); txphase(phXhx); delay(d22); _mpseqoff(ph); // Offset 90-degree Pulse to Zed and Spin-Diffusion Mix _shape(p2,ph2H90); decpwrf(getval("aH90")); delay(getval("tHmix")); // H90, 35-degree Tilt and H-to-X Cross Polarization with LG Offset decrgpulse(getval("pwH90"),ph3H90,0.0,0.0); decunblank(); decrgpulse(getval("pwHtilt"),phHtilt,0.0,0.0); decphase(phHhx); _cp_(hx,phHhx,phXhx); // Begin Acquisition obsblank(); _blank34(); _dseqon(dec); delay(getval("rd")); startacq(getval("ad")); acquire(np, 1/sw); endacq(); _dseqoff(dec); obsunblank(); decunblank(); _unblank34(); }
pulsesequence() { double del = getval("del"), gstab = getval("gstab"), gt1 = getval("gt1"), gzlvl1 = getval("gzlvl1"), gt2 = getval("gt2"), gzlvl2 = getval("gzlvl2"), satpwr = getval("satpwr"), satdly = getval("satdly"), prgtime = getval("prgtime"), prgpwr = getval("prgpwr"), gzlvlhs = getval("gzlvlhs"), hsgt = getval("hsgt"), d3 = getval("d3"), Dtau,Ddelta,dosytimecubed, dosyfrq; char delflag[MAXSTR],satmode[MAXSTR],prg_flg[MAXSTR],alt_grd[MAXSTR], sspul[MAXSTR],lkgate_flg[MAXSTR]; getstr("delflag",delflag); getstr("satmode",satmode); getstr("prg_flg",prg_flg); getstr("alt_grd",alt_grd); getstr("lkgate_flg",lkgate_flg); getstr("sspul",sspul); //synchronize gradients to srate for probetype='nano' // Preserve gradient "area" gt1 = syncGradTime("gt1","gzlvl1",0.5); gzlvl1 = syncGradLvl("gt1","gzlvl1",0.5); gt2 = syncGradTime("gt2","gzlvl2",1.0); gzlvl2 = syncGradLvl("gt2","gzlvl2",1.0); /* In pulse sequence, minimum del=4.0*pw+3*rof1+gt1+2.0*gstab */ if (del < (4*pw+3.0*rof1+gt1+2.0*gstab)) { abort_message("Dbppste error: 'del' is less than %g, too short!", (4.0*pw+3*rof1+gt1+2.0*gstab)); } Ddelta=gt1; Dtau=2.0*pw+rof1+gstab+gt1/2.0; dosyfrq = sfrq; dosytimecubed=Ddelta*Ddelta*(del-(Ddelta/3.0)-(Dtau/2.0)); putCmd("makedosyparams(%e,%e)\n",dosytimecubed,dosyfrq); /* phase cycling calculation */ mod2(ct,v1); dbl(v1,v1); hlv(ct,v2); mod2(v2,v3); dbl(v3,v3); hlv(v2,v2); mod2(v2,v4); add(v1,v4,v1); /* v1 */ hlv(v2,v2); add(v2,v3,v4); /* v4 */ hlv(v2,v2); mod2(v2,v3); dbl(v3,v5); hlv(v2,v2); mod2(v2,v3); dbl(v3,v3); /* v3 */ hlv(v2,v2); mod2(v2,v6); add(v5,v6,v5); /* v5 */ hlv(v2,v2); mod2(v2,v2); dbl(v2,v2); /* v2 */ assign(v1,oph); dbl(v2,v6); sub(oph,v6,oph); add(v3,oph,oph); sub(oph,v4,oph); dbl(v5,v6); add(v6,oph,oph); mod4(oph,oph); /*receiver phase*/ add(v1,v3,v7); add(v4,v7,v7); add(two,v7,v8); mod2(ct,v10); /* gradients change sign at odd transients */ if (ni > 1.0) { abort_message("Dbppste is a 2D, not a 3D dosy sequence: please set ni to 0 or 1"); } /* equilibrium period */ status(A); if (sspul[0]=='y') { zgradpulse(gzlvlhs,hsgt); rgpulse(pw,zero,rof1,rof1); zgradpulse(gzlvlhs,hsgt); } if (satmode[0] == 'y') { if (d1 - satdly > 0) delay(d1 - satdly); obspower(satpwr); txphase(zero); rgpulse(satdly,zero,rof1,rof1); obspower(tpwr); } else delay(d1); status(B); /* first part of bppdel sequence */ if (delflag[0]=='y') { if (gt1>0 && gzlvl1>0) { rgpulse(pw, v1, rof1, 0.0); /* first 90, v1 */ if (lkgate_flg[0] == 'y') lk_hold(); /* turn lock sampling off */ if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1/2.0); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1/2.0); endif(v10); } else zgradpulse(gzlvl1,gt1/2.0); delay(gstab); rgpulse(pw*2.0, v2, rof1, 0.0); /* first 180, v2 */ if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1/2.0); elsenz(v10); zgradpulse(gzlvl1,gt1/2.0); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1/2.0); delay(gstab); rgpulse(pw, v3, rof1, 0.0); /* second 90, v3 */ if (satmode[1] == 'y') { obspower(satpwr); rgpulse(del-4.0*pw-3.0*rof1-gt1-2.0*gstab,zero,rof1,rof1); obspower(tpwr); } else { delay(del-4.0*pw-3.0*rof1-gt1-2.0*gstab);/*diffusion delay */ } rgpulse(pw, v4, rof1, 0.0); /* third 90, v4 */ if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1/2.0); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1/2.0); endif(v10); } else zgradpulse(gzlvl1,gt1/2.0); delay(gstab); rgpulse(pw*2.0, v5, rof1, rof1); /* second 180, v5 */ if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1/2.0); elsenz(v10); zgradpulse(gzlvl1,gt1/2.0); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1/2.0); delay(gstab); if (prg_flg[0] == 'y') { add(one,v7,v9); obspower(prgpwr); rgpulse(prgtime, v9, rof1, rof1); obspower(tpwr); } } zgradpulse(gzlvl2,gt2); delay(gstab); rgpulse(pw*0.231,v7,rof1,rof1); delay(d3); rgpulse(pw*0.692,v7,rof1,rof1); delay(d3); rgpulse(pw*1.462,v7,rof1,rof1); delay(d3); rgpulse(pw*1.462,v8,rof1,rof1); delay(d3); rgpulse(pw*0.692,v8,rof1,rof1); delay(d3); rgpulse(pw*0.231,v8,rof1,rof1); zgradpulse(gzlvl2,gt2); delay(gstab); if (lkgate_flg[0] == 'y') lk_sample(); /* turn lock on */ } else rgpulse(pw,oph,rof1,rof2); /* --- observe period --- */ status(C); }
pulsesequence() { // Define Variables and Objects and Get Parameter Values double aXecho = getval("aXecho"); double t1Xechoinit = getval("t1Xecho"); double pwXecho = getval("pwXecho"); double t2Xechoinit = getval("t2Xecho"); double t1Xecho = t1Xechoinit - pwXecho/2.0; if (t1Xecho < 0.0) t1Xecho = 0.0; double t2Xecho = t2Xechoinit - pwXecho/2.0 - getval("rd"); if (t2Xecho < 0.0) t2Xecho = 0.0; 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("pwH90") + getval("tHX") + pwXecho; 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(phH90,4,table1); settable(phXhx,4,table2); settable(phHhx,4,table3); settable(phXecho,16,table4); settable(phRec,8,table5); 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); sp1on(); _cp_(hx,phHhx,phXhx); sp1off(); // Begin Decoupling _dseqon(dec); // X Hahn Echo txphase(phXecho); obspwrf(aXecho); delay(t1Xecho); rgpulse(pwXecho,phXecho,0.0,0.0); delay(t2Xecho); // Begin Acquisition 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(); }
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() { double d3 = getval("d3"), vtcomplvl = getval("vtcomplvl"), gzlvl = getval("gzlvl"), shapedpw90 = getvalnwarn("shapedpw90"), shapedpw180 = getvalnwarn("shapedpw180"), shapedpwr90 = getvalnwarn("shapedpwr90"), shapedpwr180 = getvalnwarn("shapedpwr180"), gt,gts,lvlf; int hs_gradtype; char shaped[MAXSTR], shapename90[MAXSTR], shapename180[MAXSTR]; getstrnwarn("shaped", shaped); getstrnwarn("shapename90", shapename90); getstrnwarn("shapename180", shapename180); settmpgradtype("tmpgradtype"); hs_gradtype = ((specialGradtype == 'h') || (specialGradtype == 'a')); if ((p1==0.0) && ((vtcomplvl>0.5) || (hs_gradtype))) { p1 = 2.0*pw; } if ((vtcomplvl==2) && ((hs_gradtype) || (spin>0))) { vtcomplvl = 1; if (ix==1) { text_message("gmapz: vtcomplvl set to 1\n"); putCmd("setvalue('vtcomplvl',%.0f)\n",vtcomplvl); putCmd("setvalue('vtcomplvl',%.0f,'processed')\n",vtcomplvl); } } /* lvlf, gt, gts only used for convection compensation */ if (gradtype[2]=='l') lvlf=2.5; else lvlf=3.0; if ((hs_gradtype) || (spin>0)) lvlf=1.0; gt = (0.5*at + d2)/lvlf; gts=0.18*at/lvlf; gts = 0.2*at/lvlf; if (vtcomplvl==2) gt += gts; gt *= 2.0; settable(t1,16,ph1); settable(t2,2,ph2); settable(t3,8,ph3); settable(t4,16,ph4); sub(ct,ssctr,v12); getelem(t1,v12,v1); getelem(t2,v12,v2); getelem(t3,v12,v3); getelem(t4,v12,oph); if (vtcomplvl < 0.5) { getelem(t4,v12,v1); getelem(t1,v12,v2); } /* --- equilibration period --- */ status(A); delay(d1); /* --- initial pulse --- */ status(B); if (shaped[A] == 'y') { obspower(shapedpwr90); shaped_pulse(shapename90,shapedpw90,v1,rof1,rof2); obspower(tpwr); } else pulse(pw,v1); /* instead of hard pulse, could use shapedpulse("gauss",pw,oph,rof1,rof2); or "bir4_90_512" or other shape for selective excitation. selective inversion pulses may or may not work as well. */ /* --- shim phase encode, not during PFG recovery --- */ delay(2e-5+d3); /* First case: No convection compensation, traditional sequence */ if (vtcomplvl < 0.5) { if (p1 > 0) { zgradpulse(gzlvl,at/2+d2); delay(d2); if (shaped[A] == 'y') { obspower(shapedpwr180); shaped_pulse(shapename180,shapedpw180,v2,rof1,rof2); obspower(tpwr); } else pulse(p1,v2); delay(d2); } else { zgradpulse(-gzlvl,at/2+d2); delay(d2*2); } } else /* (vtcomplvl > 0.5) */ { /* Second case: convection compensation */ zgradpulse(gzlvl,at/2+d2); delay(d2); if (vtcomplvl==2) { zgradpulse(lvlf*gzlvl,gts); delay(d2); } if (shaped[A] == 'y') { obspower(shapedpwr180); shaped_pulse(shapename180,shapedpw180,v2,rof1,rof2); } else pulse(p1,v2); delay(d2); zgradpulse(lvlf*gzlvl,gt); delay(d2); if (shaped[A] == 'y') { shaped_pulse(shapename180,shapedpw180,v3,rof1,rof2); obspower(tpwr); } else pulse(p1,v3); delay(d2); if (vtcomplvl==2) { zgradpulse(lvlf*gzlvl,gts); delay(d2); } } /* --- acq. of echo during gradient --- */ rgradient('z',gzlvl); delay(d2); /* gradient switches off at end of acq. */ }
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() { /* 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() { // 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() { // 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() { // 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() { // 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 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() { // // 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(); }
pulsesequence() { double gstab = getval("gstab"), gt1 = getval("gt1"), gzlvl1 = getval("gzlvl1"), gt2 = getval("gt2"), gzlvl2 = getval("gzlvl2"), satpwr = getval("satpwr"), satdly = getval("satdly"), del = getval("del"), del2 = getval("del2"), dosyfrq = getval("sfrq"), gzlvlhs = getval("gzlvlhs"), hsgt = getval("hsgt"), Ddelta,dosytimecubed; char convcomp[MAXSTR],satmode[MAXSTR],alt_grd[MAXSTR],lkgate_flg[MAXSTR], sspul[MAXSTR]; getstr("convcomp",convcomp); getstr("satmode",satmode); getstr("alt_grd",alt_grd); getstr("lkgate_flg",lkgate_flg); getstr("sspul",sspul); //synchronize gradients to srate for probetype='nano' // Preserve gradient "area" gt1 = syncGradTime("gt1","gzlvl1",1.0); gzlvl1 = syncGradLvl("gt1","gzlvl1",1.0); gt2 = syncGradTime("gt2","gzlvl2",1.0); gzlvl2 = syncGradLvl("gt2","gzlvl2",1.0); /* CHECK CONDITIONS */ if (p1 == 0.0) p1 = 2*pw; /* STEADY-STATE PHASECYCLING This section determines if the phase calculations trigger off of (SS - SSCTR) or off of CT */ ifzero(ssctr); dbl(ct, v1); hlv(ct, v3); elsenz(ssctr); sub(ssval, ssctr, v7); /* v7 = 0,...,ss-1 */ dbl(v7, v1); hlv(v7, v3); endif(ssctr); /* PHASECYCLE CALCULATION */ hlv(v3, v2); mod2(v3, v3); add(v3, v1, v1); assign(v1, oph); dbl(v2, v4); add(v4, oph, oph); add(v2, v3, v2); Ddelta=gt1; /*the diffusion-encoding pulse width is gt1*/ if (convcomp[A]=='y') dosytimecubed=Ddelta*Ddelta*(del - (4.0*Ddelta/3.0)); else dosytimecubed=Ddelta*Ddelta*(del - (Ddelta/3.0)); putCmd("makedosyparams(%e,%e)\n",dosytimecubed,dosyfrq); mod2(ct,v10); /* gradients change sign at odd transients */ /* BEGIN ACTUAL SEQUENCE */ status(A); if (sspul[0]=='y') { zgradpulse(gzlvlhs,hsgt); rgpulse(pw,zero,rof1,rof1); zgradpulse(gzlvlhs,hsgt); } if (satmode[0] == 'y') { if (d1 - satdly > 0) delay(d1 - satdly); obspower(satpwr); rgpulse(satdly,zero,rof1,rof1); obspower(tpwr); } else delay(d1); if (getflag("wet")) wet4(zero,one); status(B); if (del>0.0) { if (convcomp[A]=='y') { if (lkgate_flg[0] == 'y') lk_hold(); /* turn lock sampling off */ if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-gzlvl2,2.0*gt2); elsenz(v10); zgradpulse(gzlvl2,2.0*gt2); endif(v10); } else zgradpulse(-gzlvl2,2.0*gt2); delay(gstab); rgpulse(pw, v1, rof1, rof1); delay(d2/2.0); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(((del+del2)/4)-gt1-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(((del+del2)/4)-gt1); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(((del-del2)/4)-gt1-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(((del-del2)/4)-gt1); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl2,gt2); elsenz(v10); zgradpulse(-1.0*gzlvl2,gt2); endif(v10); } else zgradpulse(gzlvl2,gt2); delay(gstab); rgpulse(p1, v2, rof1, rof1); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl2,gt2); elsenz(v10); zgradpulse(-1.0*gzlvl2,gt2); endif(v10); } else zgradpulse(gzlvl2,gt2); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(((del-del2)/4)-gt1-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(((del-del2)/4)-gt1); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(-1.0*gzlvl1,gt1); elsenz(v10); zgradpulse(gzlvl1,gt1); endif(v10); } else zgradpulse(-1.0*gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse(((del+del2)/4)-gt1-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay(((del+del2)/4)-gt1); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); delay(d2/2.0); if (lkgate_flg[0] == 'y') lk_sample(); /* turn lock sampling on */ } else { rgpulse(pw, v1, rof1, rof1); if (lkgate_flg[0] == 'y') lk_hold(); /* turn lock sampling off */ delay(d2/2.0); delay(gstab); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse((del-p1-2.0*rof1-gt1)/2.0-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay((del-p1-2.0*rof1-gt1)/2.0); rgpulse(p1, v2, rof1, rof1); if (satmode[1] == 'y') { obspower(satpwr); rgpulse((del-p1-2.0*rof1-gt1)/2.0-2.0*rof1,zero,rof1,rof1); obspower(tpwr); } else delay((del-p1-2.0*rof1-gt1)/2.0); if (alt_grd[0] == 'y') { ifzero(v10); zgradpulse(gzlvl1,gt1); elsenz(v10); zgradpulse(-1.0*gzlvl1,gt1); endif(v10); } else zgradpulse(gzlvl1,gt1); delay(gstab); delay(d2/2.0); if (lkgate_flg[0] == 'y') lk_sample(); /* turn lock sampling on */ } } else rgpulse(pw,oph,rof1,rof2); status(C); }