/* SAR Calculator ************************************************************ */ /* Mike Weisdorf, 7/99 */ /* Calculates deposited RF energy and average RF power in VNMR pulse sequences */ /* See also, sarcalc.txt or local CMRR web site for more information. */ /* Version 1.2 */ /* Version 1.3 Lance DelaBarre 9_30_99 Eliminated error warnings by casting */ /* readgate, readfile, calcint, calmaxpwr as int instead of void. */ /* Cast getenv as a char pointer to eliminate lint warning in getpwr */ /* Version 1.4 Lance DelaBarre 3_16_00 Had problems with repetative remote file system reads */ /* changed the order of readin to try 3 times, not just three reads in a row like before. */ #include #include #define sardecouple(target) \ if ( ((target == 's') || (target == 'S')) || ((target == 'a') || (target == 'A')) || ((target == 'y') || (target == 'Y')) ) { sarcalc("hard",dpwr,at,DD,1); } #define POUND_LTR ('#') #define saravgtime(tr) fprintf(stdout,"\nTotal energy in joules = %f\nAvg. power in Watts = %f\n",sarenergy,sarenergy/(tr)) #define sarcalc(shape,power,width,channel,ntimes) \ sprintf(parrname,#power); bpv=-17; ardx=0; \ if ((nar=getarray(parrname,parray))>1) { \ while (ardx<=nar) { cpv=parray[ardx]; \ if (bpv1) { \ while (ardx<=nar) { cwv=warray[ardx]; \ if (bwv1) { \ while (ardx<=nar) { cpv=parray[ardx]; \ if (bpv1) { \ while (ardx<=nar) { cwv=warray[ardx]; \ if (bwv