Sar Calculator

You are here


Mike Weisdorf, 7/99
This text accompanies the sarcalc.h header for VNMR psg files.

The SAR calculator (SARcalc) is designed to let you see how much power is actually produced by your sequence.  It can be useful for quick calculations before a study so you do not waste time resetting should the RF monitor trip. You can quickly see how much energy is present, and how long you should make the TR period to minimize heating. Configuring the calculator is not difficult, but requires adding a bit of code to your pulse sequence source as shown below.  The subroutines for the calculation are located in sarcalc.h.

Instructions for using SARcalc in your pulse sequence (e.g. ase.c):

1) Include the header file into your C program with the line:
   #include <sarcalc.h>
It should be at or near the top of your source, after the other #include directive(s).

2)You must include the energy of each pulse using sarcalc().
The syntax for sarcalc() is as follows:
 sarcalc(pulsepat, tpwr, pulsewidth, TT(or DD), ntimes);
TT specifies tn as the nucleus and using the Tx channel for normal pulses.  DD specifies EITHER using the decouple channel for a 2nd coil (e.g. if you have both a C13 and a proton coil) OR it may be used in conjunction with sardecouple().
The SARcalc calibrations are for the normal observe & decouple amplifiers.  If you change the amplifiers, the calibrations need to be adjusted, or you will not get good calculations.

Arrayed Powers
You may use SARcalc when you have arrayed variables for pulsewidth or power. However, it will only compute the deposited energy for the maximum values in your arrays, to avoid huge and unnecesary output. Arrays for pulse shape are not supported at this time.

ntimes means the number of times this exact pulse appears in the sequence.  See example below.

Another function, sargetpwr() is available. It's syntax is:
 sargetpwr(pulsepat, tpwr, pulsewidth, TT(or DD), return_variable)
and instead of adding this energy to the SARcalc total, it just returns the value into a variable of your choice (return_variable). This is not used as commonly as the normal, sarcalc() function, but may be useful for calculating power from a specific modual, like water suppression seperately.

To estimate the power required for decoupling use
 sardecouple(dm[n]);
where n is an integer such that dm[0] indicates status A, dm[1] status B, etc. Therefore, if your decoupling is indicated by status C, dm='nny' and you should use:
 sardecouple(dm[2]);
This call assumes that the decoupling pattern is square (or nearly square), and approximates it's power as dpwr * at.  Most types of decoupling are adequately approximated by a square pulse, even adiabatic decoupling sequences based off BIR-4 shapes are 90% of the power of a square pulse.  If you are not using dpwr or a longer period than at an alternative construct can be used:
    if((dm[2] = = 'y') || (dm[2] = = 'Y') || (dm[2] = = 'a') || (dm[2] = = 'A') || (dm[2] = = 's') || (dm[2] = = 'S'))
      { sarcalc("hard", dpwrc, at, DD, 1); }
Note that neither of these constructs can accomidate changing dm='nny' to dm='y'.  The first turns the decoupler channel on only during status C.  The second turns the decoupler on for the entire sequence, but the check for dm[2] will return '' and not calculate any decoupling power.  These programs are useful tools, but they can't catch all errors and the operator must still use common sense and reasonable SAR hardware trip levels in conjunction with these tools.

3) After any and all sarcalc() calls, you need to specify a time constant, for averaging the power over. Often, a variable such as tr is quite appropriate for this purpose, but you may use any variable/real number you desire. You specify this as follows
 saravgtime(variable);
This is important. It also displays the final results. You must include it. 



The variables normally used in SARcalc have already been declared.
The ideal location for this code is in the function pulsesequence(), between
any calculations/initializations and the sequence elements themselves. Below
is an example of the code used correctly:

/* HEADER: EXAMPLE.c  A sequence that demonstrates sar calculator */
/* This is a simple double spin-echo sequence with an optional inversion */
/* recovery pulse. Note conditional ir pulse, and multiplication  */
/* used to simplify calculation and save time.                    */
#include <standard.h>
#include <sarcalc.h>
...
pulsesequence() {
...
...
/* SAR Calcuations *************************************/
 getstr("sar", sar);
 if (is_y(sar[0])) {
  if (ix = = 1) {
   sarcalc(p1pat, tpwr1, p1, TT, 1);    /*pulse goes only once*/
 sarcalc(p2pat, tpwr2, p2, TT, (2*ne));  /*pulse twice per echo*/
   sardecouple(dm[1]);
   if (is_y(ir[0])) sarcalc(pipat, tpwri, pi, TT, 1);  /*optional IR*/
   saravgtime(tr);
   }
  }

/* PULSE SEQUENCE ELEMENTS********************************/
...
...
}

***Important:  This is ONLY an example.  You can paste this code into your PSG, but you may need to modify some of it.  You need to alter the variable-names to agree with those used in your sequence. When finished, this section of code should resemble a stripped down version of the sequence to follow.  It should contain similar conditions and/or loops, and each pulse() or shapedpulse() should be represented here.



4) You must seqgen again.  There will be warnings (sorry), but it should compile properly.  These warnings are generated from the dps extentions being added.

5) Create a string variable in VNMR called 'sar', by typing: create('sar','string')

6) Set sar='y' when the calculations must be performed, and sar='n' when they must be turned off.

7) Calculations should be done on execution of either "dps" or "go" commands in VNMR.

System Administration Notes:
Calibration tables for SAR calculator may be found in /vnmr/imaging/sartables.  These files are named like so:
  sarcalib.tn.H1 is the transmit channel, proton table.
  sarcalib.dn.P31 is the decouple channel, Phosphorous 31 table, etc.
Tables consist of exactly two columns of numeric values.  The first is tpwr values in ascending order, and the second is the corresponding power values in watts.  No comments or headings are allowed in these files.  Different tables are used on ely (4T) and superior (7T). When amplifiers are changed, tables must be changed to match, if SAR calculator is to be used.

The file sarcalc.h ought to be in /vnmr/psg, and seqgen will find it there.