void ovsbands2() { int amp[6][3],s,d, shape; double freqlist[MAXNSAT]; double satamp[6]; /* amp[satband][direction] is scaling on sat band slice gradient */ /* For directions, 0 = Readout, 1 = Phase, 2 = Slice */ /* Initialize all to zeros */ for (s = 0; s < nsat; s++) /* 6 sat bands */ for (d = 0; d < 3; d++) /* 3 directions: RO, PE, SS */ amp[s][d] = 0; amp[0][0] = amp[1][0] = 1; /* First two bands along readout */ amp[2][1] = amp[3][1] = 1; /* Next two bands along phase */ amp[4][2] = amp[5][2] = 1; /* Last two bands along slice */ /* satamp is temporary array of satband gradients, necessary for offsetglist to work */ for (s = 0; s < nsat; s++) satamp[s] = sat_grad.amp; if (ovs[0] == 'y') { offsetglist(satpos,satamp,0,freqlist,nsat,'i'); shape = shapelist(satpat,sat_grad.duration,freqlist,nsat,sat_grad.rfFraction,'i'); set_rotation_matrix(vpsi,vphi,vtheta); obspower(sat_rf.powerCoarse); // obspwrf(sat_rf.powerFine); delay(4e-6); /* Apply six sat bands, surrounding the voxel */ /* The only thing changing is the orientation of the sat band gradient */ for (s = 0; s < nsat; s++ ) { obspwrf(satfpwr[s]); obl_shapedgradient(sat_grad.name,sat_grad.duration, sat_grad.amp*amp[s][0], sat_grad.amp*amp[s][1], sat_grad.amp*amp[s][2],NOWAIT); delay(sat_grad.rfDelayFront); shapedpulselist(shape,sat_grad.rfDuration,oph,rof1,rof2,'i',s); delay(sat_grad.rfDelayBack); obl_shapedgradient(satcrush_grad.name,satcrush_grad.duration, satcrush_grad.amp*amp[s][0], satcrush_grad.amp*amp[s][1], satcrush_grad.amp*amp[s][2],WAIT); } } /* end if ovs */ }
// Process a production string and generate form void L_draw(const context& Context, const k3d::signed_axis Orientation) { // Save values k3d::double_t thick_l = 0; k3d::double_t ang_l = 0; k3d::double_t dis_l = 0; k3d::double_t dis2_l = 0; k3d::double_t trope_l = 0; bool poly_on = false; // Setup vectors k3d::point3 pos(0.0, 0.0, 0.0); k3d::vector3 fow(0.0, 0.0, 1.0); k3d::vector3 lef(0.0, 1.0, 0.0); k3d::vector3 upp(1.0, 0.0, 0.0); trope = k3d::normalize(trope); for(unsigned long i = 0; i < object_string.size(); i++) { // Overflow if(polcount > poly_limit) break; // The next char in the string char next = object_string[i + 1]; // The current char in the string switch(object_string[i]) { default: break; // Marks last recursion level during growing phase case '@': last_recur = !last_recur; if(last_recur) { // Store all variables and do fraction thick_l = thick; ang_l = ang; dis_l = dis; dis2_l = dis2; trope_l = trope_amount; dis *= fraction; dis2 *= fraction; thick *= fraction; ang *= fraction; trope_amount *= fraction; } else { // Restore thick = thick_l; ang = ang_l; dis = dis_l; dis2 = dis2_l; trope_amount = trope_l; } break; case '+': save.ang = ang; if(next == '(') { ang = 0.017453 * parse_value(i); if(last_recur) ang *= fraction; } set_rotation_matrix(-ang, upp); fow = rotate(fow); lef = rotate(lef); ang = save.ang; break; case '-': save.ang = ang; if(next == '(') { ang = 0.017453 * parse_value(i); if(last_recur) ang *= fraction; } set_rotation_matrix(ang, upp); fow = rotate(fow); lef = rotate(lef); ang = save.ang; break; case '~': { k3d::double_t r = 6.0; if(next == '(') r = 0.017453 * parse_value(i); else if(rand_set) r = 0.017453 * rand_amount; k3d::double_t a = Rnd() * r * 2.0 - r; set_rotation_matrix(a, upp); fow = rotate(fow); lef = rotate(lef); a = (Rnd() * r * 2.0) - r; set_rotation_matrix(a, lef); fow = rotate(fow); upp = rotate(upp); a = (Rnd() * r * 2.0) - r; set_rotation_matrix(a, fow); lef = rotate(lef); upp = rotate(upp); } break; case 't': { if((fow[0] == 0.0) && (fow[1] == 0.0)) break; save.tr = tr; if(trope_set) tr = trope_amount; if(next == '(') { tr = parse_value(i); if(last_recur) tr *= fraction; } trope = fow; trope[0] = -trope[0]; trope[1] = -trope[1]; trope[2] = 0.0; trope = k3d::normalize(trope); k3d::double_t r = tr * (fow * trope); set_rotation_matrix(-r, lef); fow = rotate(fow); upp = rotate(upp); tr = save.tr; } break; case '$': { k3d::vector3 v = fow - sky; if(v.length() == 0.0) break; lef = fow ^ sky; upp = fow ^ lef; if(upp[2] < 0.0) { upp = -upp; lef = -lef; } } break; case '&': save.ang = ang; if(next == '(') { ang = 0.017453 * parse_value(i); if(last_recur) ang *= fraction; } set_rotation_matrix(ang, lef); fow = rotate(fow); upp = rotate(upp); ang = save.ang; break; case '^': save.ang = ang; if(next == '(') { ang = 0.017453 * parse_value(i); if(last_recur) ang *= fraction; } set_rotation_matrix(-ang, lef); fow = rotate(fow); upp = rotate(upp); ang = save.ang; break; case '<': save.ang = ang; if(next == '(') { ang = 0.017453 * parse_value(i); if(last_recur) ang *= fraction; } set_rotation_matrix(-ang, fow); lef = rotate(lef); upp = rotate(upp); ang = save.ang; break; case '>': save.ang = ang; if(next == '(') { ang = 0.017453 * parse_value(i); if(last_recur) ang *= fraction; } set_rotation_matrix(ang, fow); lef = rotate(lef); upp = rotate(upp); ang = save.ang; break; case '%': set_rotation_matrix(3.141592654, fow); lef = rotate(lef); upp = rotate(upp); break; case '|': set_rotation_matrix(3.141592654, upp); fow = rotate(fow); lef = rotate(lef); break; case '!': if(next == '(') { if(last_recur) thick *= 1.0 + fraction * (parse_value(i) - 1.0); else thick *= parse_value(i); } else { if(last_recur) thick *= 1.0 + fraction * (0.7 - 1.0); else thick *= 0.7; } break; case '?': if(next == '(') { if(last_recur) thick *= 1.0 + fraction * (parse_value(i) - 1.0); else thick *= parse_value(i); } else { if(last_recur) thick /= 1.0 + fraction * (0.7 - 1.0); else thick /= 0.7; } break; case ':': if(next == '(') { if(last_recur) ang *= 1.0 + fraction * (parse_value(i) - 1.0); else ang *= parse_value(i); } else { if(last_recur) ang *= 1.0 + fraction * (0.9 - 1.0); else ang *= 0.9; } break; case ';': if(next == '(') { if(last_recur) ang *= 1.0 + fraction * (parse_value(i) - 1.0); else ang *= parse_value(i); } else { if(last_recur) ang /= 1.0 + fraction * (0.9 - 1.0); else ang /= 0.9; } break; case '\'': if(next == '(') { k3d::double_t r = parse_value(i); if(last_recur) { dis *= 1.0 + fraction * (r - 1.0); dis2 *= 1.0 + fraction * (r - 1.0); } else { dis *= r; dis2 *= r; } } else { if(last_recur) { dis *= 1.0 + fraction * (0.9 - 1.0); dis2 *= 1.0 + fraction * (0.9 - 1.0); } else { dis *= 0.9; dis2 *= 0.9; } } break; case '"': if(next == '(') { k3d::double_t r = parse_value(i); if(last_recur) { dis *= 1.0 + fraction * (r - 1.0); dis2 *= 1.0 + fraction * (r - 1.0); } else { dis *= r; dis2 *= r; } } else { if(last_recur) { dis /= 1.0 + fraction * (0.9 - 1.0); dis2 /= 1.0 + fraction * (0.9 - 1.0); } else { dis /= 0.9; dis2 /= 0.9; } } break; case 'Z': { save.dis2 = dis2; if(next == '(') { dis2 = parse_value(i); if(last_recur) dis2 *= fraction; } k3d::point3 end = pos + dis2 * fow; if(closed_form) add_cylinder(pos, end, upp, col, Context, Orientation); else add_cube(pos, end, upp, col, Context, Orientation); pos = end; dis2 = save.dis2; } break; case 'F': { save.dis = dis; if(next == '(') { dis = parse_value(i); if(last_recur) dis *= fraction; } k3d::point3 end = pos + dis * fow; if(closed_form) add_cylinder(pos, end, upp, col, Context, Orientation); else add_cube(pos, end, upp, col, Context, Orientation); pos = end; dis = save.dis; } break; case '[': { s_rec new_rec; new_rec.pos = pos; new_rec.fow = fow; new_rec.lef = lef; new_rec.upp = upp; new_rec.col = col; new_rec.dis = dis; new_rec.dis2 = dis2; new_rec.ang = ang; new_rec.thick = thick; new_rec.tr = tr; if(closed_form) { new_rec.last = last; new_rec.last_col = last_col; for(unsigned long j = 0; j < 8; j++) new_rec.last_v[j] = last_v[j]; } if(stack.size() < max_stack_size) stack.push(new_rec); } break; case ']': { if(!stack.size()) break; s_rec old_rec = stack.top(); pos = old_rec.pos; fow = old_rec.fow; lef = old_rec.lef; upp = old_rec.upp; col = old_rec.col; dis = old_rec.dis; dis2 = old_rec.dis2; ang = old_rec.ang; thick = old_rec.thick; tr = old_rec.tr; if(closed_form) { last = old_rec.last; last_col = old_rec.last_col; for(unsigned long j = 0; j < 8; j++) last_v[j] = old_rec.last_v[j]; } stack.pop(); } break; case '{': if(poly_on) { vectors_t new_rec = vertices; if(pstack.size() < max_stack_size) pstack.push(new_rec); } poly_on = true; vertices.clear(); vertices.push_back(pos); break; case 'f': save.dis = dis; if(next == '(') { dis = parse_value(i); if(last_recur) dis *= fraction; } pos = pos + dis * fow; if(poly_on) vertices.push_back(pos); dis = save.dis; break; case '.': if(poly_on) vertices.push_back(pos); break; case 'g': save.dis = dis; if(next == '(') { dis = parse_value(i); if(last_recur) dis *= fraction; } pos = pos + dis * fow; dis = save.dis; break; case 'z': save.dis2 = dis2; if(next == '(') { dis2 = parse_value(i); if(last_recur) dis2 *= fraction; } pos = pos + dis2 * fow; if(poly_on) vertices.push_back(pos); dis2 = save.dis2; break; case '}': polygons.clear(); if(vertices.size() > 3) { for(unsigned long j = 1; j < vertices.size() - 1; j++) polygons.push_back(polygon(0, j, j + 1, j + 1)); add_geometry(col, Context); } poly_on = false; if(pstack.size() > 0) { vertices.clear(); if(!pstack.size()) break; vertices = pstack.top(); pstack.pop(); poly_on = true; } break; case 'c': if(next == '(') col = (unsigned long)parse_value(i); else col++; break; } } }
pulsesequence() { /***** Internal variable declarations *****/ int shapelist1,shapelist2,shapelist3; /* pulse shapes (lists) */ double freq1,freq2,freq3,ws_delta; double rprof,pprof,sprof; double restol, resto_local,csd_ppm; char profile_ovs[MAXSTR]; char profile_vox[MAXSTR]; int wsfirst; //wsfirst makes ws unit to be exececuted first int isis; int counter,noph; char autoph[MAXSTR],pcflag[MAXSTR]; /* sequence timing variables */ double te_delay1, te_delay2, newdelay,tr_delay, tm_delay; double tau1=0, tau2=0; /* Extra crushers */ double gcrushtm,tcrushtm; double ky; double vox3_cr, vox3r_cr; double gcrush_end, tcrush_end; /*extra ws pulse flag*/ char ws_tm[MAXSTR]; double wsflipftm; double tmwstpwr,tmwstpwrf; init_mri(); noph=(int)getval("noph"); isis=(int)getval("isis"); int inv1[32]= {0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3};//excitation pulse int inv2[32]= {0, 0, 1, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 0, 0, 1, 1, 2, 2, 3, 3, 0, 0}; //refocusing pulse int inv3[32]= {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3};//inversion pulse int phrec[32]= {0, 2, 2, 0, 2, 0, 0, 2, 0, 2, 2, 0, 2, 0, 0, 2, 1, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3};// rec phase int phrec0[32]= {0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1};// rec phase for non-isis /***** Real-time variables used in this sequence *****/ int vinv1 = v1; // on/off flag first inversion pulse int vms = v5; // dummy shapedpulselist slice counter (= one) get_ovsparameters(); get_wsparameters(); rprof = getval("rprof"); pprof = getval("pprof"); sprof = getval("sprof"); ky=getval("ky"); getstr("autoph",autoph); getstr("pcflag",pcflag); getstr("profile_ovs",profile_ovs); getstr("profile_vox",profile_vox); wsfirst=(int)getval("wsfirst"); restol=getval("restol"); //local frequency offset roff=getval("roff"); //receiver offset csd_ppm=getval("csd_ppm"); //chemical shift displacement factor gcrushtm = getval("gcrushtm"); tcrushtm = getval("tcrushtm"); wsflipftm = getval("wsflipftm"); getstr("ws_tm",ws_tm); ws_delta=getval("ws_delta"); vox3_cr=1000000; /***** RF power calculations *****/ shape_rf(&p1_rf,"p1",p1pat,p1,flip1,rof1,rof2); shape_rf(&p2_rf,"p2",p2pat,p2,flip2,rof1,rof2); shape_rf(&p3_rf,"p3",p3pat,p3,flip3,rof1,rof2); shape_rf(&p4_rf,"p4",p4pat,p4,flip4,rof1,rof2); p4_rf.flipmult=wsflipftm; calc_rf(&p1_rf,"tpwr1","tpwr1f"); calc_rf(&p2_rf,"tpwr2","tpwr2f"); calc_rf(&p3_rf,"tpwr3","tpwr3f"); calc_rf(&p4_rf,"tpwr4","tpwr4f"); // wsfpwrtm=p4_rf.powerFine*wsflipftm; /* ws fine RF power */ trampfixed=trise; //rise time =trise tcrush=granularity(tcrush,GRADIENT_RES); //this is to avoid the granularity errors //if trampfixed is used, rise time needs to be checked if (trise*2>tcrush){ abort_message("tcrush too short. Minimum tcrush = %fms \n",1000*trise*2); } if (gcrush>gmax){ abort_message("gcrush too large. Max gcrush = %f \n",gmax*0.95); } init_slice(&vox1_grad,"vox1",vox1); init_slice(&vox2_grad,"vox2",vox2); init_slice_butterfly(&vox3_crush,"vox3_crush",vox3_cr,gcrush,tcrush); init_slice_butterfly(&vox3r_crush,"vox3r_crush",vox3_cr,gcrush,tcrush); init_slice_butterfly(&vox3_grad,"vox3",vox3,gcrush,tcrush); init_generic(&tmcrush_grad,"tmcrush",gcrushtm,tcrushtm); //crusher grad during tm if (profile_vox[0] == 'y') { init_readout_butterfly(&ro_grad,"ro",lro,np,sw,gcrushro,tcrushro); init_readout_refocus(&ror_grad,"ror"); } /***** Gradient calculations *****/ calc_slice(&vox1_grad,&p1_rf,WRITE,"vox1_grad"); calc_slice(&vox2_grad,&p2_rf,WRITE,"vox2_grad"); calc_slice(&vox3_grad,&p3_rf,NOWRITE,""); calc_slice(&vox3_crush,&p3_rf,WRITE,"vox3_crush"); calc_slice(&vox3r_crush,&p3_rf,NOWRITE,""); vox3r_crush.crusher1Moment0 -= vox2_grad.m0ref; //only now can re-calculate the moment vox3r_crush.crusher1CalcFlag=AMPLITUDE_FROM_MOMENT_DURATION_RAMP; calc_slice(&vox3r_crush,&p3_rf,WRITE,"vox3r_crush"); vox3_grad.crusher2Moment0 *= vox3_grad.m0def/vox3_grad.m0ref*ky; //only now can re-calculate the moment vox3_grad.crusher2CalcFlag=AMPLITUDE_FROM_MOMENT_DURATION_RAMP; calc_slice(&vox3_grad,&p3_rf,WRITE,"vox3_grad"); calc_generic(&tmcrush_grad,WRITE,"",""); if (profile_vox[0] == 'y') { calc_readout(&ro_grad,WRITE,"gro","sw","at"); putvalue("gro",ro_grad.roamp); // RO grad calc_readout_refocus(&ror_grad,&ro_grad,WRITE,"gror"); putvalue("tror",ror_grad.duration); // ROR duration } if (profile_ovs[0]=='y'){ if (rprof==1) { vox1_grad.amp=0; } else if(pprof==1) { vox2_grad.amp=0; } else if(sprof==1) { vox3_grad.amp=0; } } /***** Check nt is a multiple of 2 *****/ if (ix == 1) { if ((int)nt%2 != 0) text_message("WARNING: SPECIAL requires 2 steps. Set nt as a multiple of 2\n"); } /* Optional Outer Volume Suppression */ if (ovs[0] == 'y') create_ovsbands(); if (sat[0] == 'y') create_satbands(); /* Optional Water Suppression */ if (ws[0] == 'y') create_watersuppress(); /***** Set up frequency offset pulse shape list *****/ offsetlist(&pos1,vox1_grad.ssamp,0,&freq1,1,'s'); offsetlist(&pos2,vox2_grad.ssamp,0,&freq2,1,'s'); offsetlist(&pos3,vox3_grad.ssamp,0,&freq3,1,'s'); if (profile_ovs[0]=='y'&& sprof==1) freq3=0.0; if (profile_ovs[0]=='y'&& pprof==1) freq2=0.0; if (profile_ovs[0]=='y'&& rprof==1) freq1=0.0; freq1=freq1-csd_ppm*sfrq; freq2=freq2-csd_ppm*sfrq; freq3=freq3-csd_ppm*sfrq; shapelist1 = shapelist(p1_rf.pulseName,vox1_grad.rfDuration,&freq1,1,vox1_grad.rfFraction,'s'); shapelist2 = shapelist(p2_rf.pulseName,vox2_grad.rfDuration,&freq2,1,vox2_grad.rfFraction,'s'); shapelist3 = shapelist(p3_rf.pulseName,vox3_grad.rfDuration,&freq3,1,vox3_grad.rfFraction,'s'); /* Calculate delta from resto to include local frequency line + chemical shift offset */ resto_local=resto-restol; /* Frequency offsets */ if (profile_vox[0] == 'y') { /* Shift DDR for pro ************************************/ roff = -poffset(pro,ro_grad.roamp); } /* Set tables */ /* Real time variables for inversion pulses */ settable(t1,noph,inv1); settable(t2,noph,inv2); settable(t3,noph,inv3); /* Phase cycle for excitation pulse and receiver */ if (isis!=1) settable(t4,noph,phrec0); else settable(t4,noph,phrec); /* shapedpulselist variable */ assign(one,vms); /* Put gradient information back into VnmrJ parameters */ putvalue("gvox1",vox1_grad.ssamp); putvalue("gvox2",vox2_grad.ssamp); putvalue("gvox3",vox3_grad.ssamp); putvalue("rgvox1",vox1_grad.tramp); putvalue("rgvox2",vox2_grad.tramp); putvalue("rgvox3",vox3_grad.tramp); sgl_error_check(sglerror); if (ss<0) g_setExpTime(trmean*(nt-ss)*arraydim); else g_setExpTime(tr*(ntmean*arraydim+ss)); /* PULSE SEQUENCE *************************************/ /* Real time variables for inversion pulses */ counter=(double)nt*(ix-1); if (autoph[0] == 'n') counter=0.0; initval(counter,v11); initval(noph,v13); //v13=number of phase cycling steps add(v11,ctss,v12); //v12=counter modn(v12,v13,v12); //v12 runs from 1:v13 getelem(t1,v12,v8); /* 90 DEG. SPIN ECHO PULSE */ getelem(t2,v12,v9); /* 180 DEG. SPIN ECHO P. */ getelem(t3,v12,v10); /* ISIS 180 DEG. ADIAB. PULSE */ getelem(t4,v12,oph); /*RCVR PHASE*/ mod2(v12,vinv1); // this controls 1D isis on, off, on, of... up to noph(=32) /****************************************************/ /* Sequence Timing **********************************/ /****************************************************/ /* Min TE ******************************************/ tau1 = vox2_grad.rfCenterBack + vox3_grad.rfCenterFront; tau2 = vox3_grad.rfCenterBack+alfa; temin = 2*(MAX(tau1,tau2) + 4e-6); /* have at least 4us between gradient events */ if (minte[0] == 'y') { te = temin; putvalue("te",te); } else if (te < temin) { abort_message("TE too short. Minimum TE = %.2fms\n",temin*1000); } te_delay1 = te/2 - tau1; te_delay2 = te/2 - tau2; printf("te delay1 is %f", te_delay1); printf("te delay2 is %f", te_delay2); /***************************************************/ /* Min TM ******************************************/ if (ws_tm[0] == 'y') { tau1 = vox1_grad.rfCenterBack + rof1+rof2+p4_rf.rfDuration+tmcrush_grad.duration + 4e-6 + vox2_grad.rfCenterFront; } else tau1 = vox1_grad.rfCenterBack + rof2+tmcrush_grad.duration + 4e-6 + vox2_grad.rfCenterFront; tmmin = tau1 + 4e-6; /* have at least 4us between gradient events */ if (mintm[0] == 'y') { tm = tmmin; putvalue("tm",tm); } else if (tm < tmmin) { abort_message("TM too short. Minimum TM = %.2fms\n",tmmin*1000); } tm_delay = (tm - tau1); /* Relaxation delay ***********************************/ /***** Min TR *****/ trmin = vox1_grad.rfCenterFront + tm + te+alfa + at + 20e-6; if (profile_vox[0] == 'y') trmin += ror_grad.duration + ro_grad.duration - at; if (ws[0] == 'y') trmin += wsTime; if (ovs[0] == 'y') trmin += ovsTime; if (sat[0] == 'y') trmin += satTime; if (mintr[0] == 'y') { tr = trmin; putCmd("setvalue('tr',%f,'current')\n",tr); } if ((trmin-tr) > 12.5e-9) { abort_message("tr too short. Minimum tr = %.2f ms\n",(trmin)*1000); } /***** Calculate TR delay *****/ tr_delay = tr - trmin; /**Sequence Begin**/ status(A); obsoffset(resto_local); delay(4e-6); set_rotation_matrix(vpsi,vphi,vtheta); if (ticks > 0) { xgate(ticks); grad_advance(gpropdelay); delay(4e-6); } /* TTL scope trigger **********************************/ sp1on(); delay(4e-6); sp1off(); /* Saturation bands ***********************************/ if (ovs[0] == 'y') ovsbands(); if (sat[0] == 'y') satbands(); /* Post OVS water suppression *************************/ if (ws[0] == 'y') watersuppress(); /* First inversion pulse *****/ if (isis >= 1){ /*for the ISIS pulse on,off,on,off... or on,on,on,on... */ obspower(p1_rf.powerCoarse); obspwrf(p1_rf.powerFine); delay(4e-6); if (isis == 1) /* for ISIS on,off,on,off,... */{ ifzero(vinv1); obl_shapedgradient(vox1_grad.name,vox1_grad.duration,vox1_grad.amp,0,0,NOWAIT); delay(vox1_grad.rfDelayFront); shapedpulselist(shapelist1,vox1_grad.rfDuration,v10,rof1,rof2,'s',vms); delay(vox1_grad.rfDelayBack); elsenz(vinv1); obl_shapedgradient(vox1_grad.name,vox1_grad.duration,vox1_grad.amp,0,0,WAIT); endif(vinv1); } else { /* for ISIS on,on,on,on...*/ obl_shapedgradient(vox1_grad.name,vox1_grad.duration,vox1_grad.amp,0,0,NOWAIT); delay(vox1_grad.rfDelayFront); shapedpulselist(shapelist1,vox1_grad.rfDuration,v10,rof1,rof2,'s',vms); delay(vox1_grad.rfDelayBack); } } else delay(vox1_grad.duration); //this is for isis off,off,off,off /* tm delay before excitation pulse *****/ /* Optional TM water suppression ***********************/ if (ws_tm[0] == 'y') { if (wsrf[0]=='y') { obspower(p4_rf.powerCoarse); obspwrf(p4_rf.powerFine); delay(4e-6); shapedpulseoffset(p4_rf.pulseName,p4_rf.rfDuration,zero,rof1,rof2,ws_delta); } else delay(p4_rf.rfDuration+rof1+rof2); } //end of ws_tm='y' condition delay(tm_delay); /* TM Gradient crusher ********************************/ obl_shapedgradient(tmcrush_grad.name,tmcrush_grad.duration,0,0,tmcrush_grad.amp,WAIT); /* 90 degree excitation pulse *****/ obspower(p2_rf.powerCoarse); obspwrf(p2_rf.powerFine); delay(4e-6); obl_shapedgradient(vox2_grad.name,vox2_grad.duration,0,vox2_grad.amp,0,NOWAIT); delay(vox2_grad.rfDelayFront); shapedpulselist(shapelist2,vox2_grad.rfDuration,v8,rof1,rof2,'s',vms); delay(vox2_grad.rfDelayBack); delay(te_delay1); /* 180 degree pulse ********************************/ obspower(p3_rf.powerCoarse); obspwrf(p3_rf.powerFine); delay(4e-6); obl_shaped3gradient (vox3_crush.name,vox3r_crush.name,vox3_grad.name,vox3_grad.duration,vox3_crush.amp,vox3r_crush.amp,vox3_grad.amp,NOWAIT); delay(vox3_grad.rfDelayFront); shapedpulselist(shapelist3,vox3_grad.rfDuration,v9,rof1,rof2,'s',vms); delay(vox3_grad.rfDelayBack); delay(te_delay2); //acquisition starts if (profile_vox[0] == 'y') { obl_shapedgradient(ror_grad.name,ror_grad.duration, -rprof*ror_grad.amp,-pprof*ror_grad.amp,-sprof*ror_grad.amp,WAIT); delay(4e-6); obl_shapedgradient(ro_grad.name,ro_grad.duration, rprof*ro_grad.amp,pprof*ro_grad.amp,sprof*ro_grad.amp,NOWAIT); delay(ro_grad.atDelayFront); startacq(alfa); acquire(np,1.0/sw); delay(ro_grad.atDelayBack); endacq(); } else { startacq(alfa); acquire(np,1.0/sw); endacq(); } delay(tr_delay); }