Scaling your pre-grad coil replacement images

Images taken since the gradient coil replacement, November 2009 are slightly larger than images taken before the gradient coil replacement. Based on measurements taken on a phantom, post-grad coil replacement images were determined to be closer to actual scale - so we recommend you scale our pre-grad coil replacement images to fit the new calibration.

The scaling factor found for each axis [x,y,z] is:

sFacs = [1.08468528829887 1.0531954310169 1.05883615483564];

These numbers are based on some 3d anatomicals taken after the replacement. To simply apply this scaling factor to your old_anatomy.hdr/img, use the function applyScalingFactor in matlab.

applyScalingFactor(baseImg,sFacs)

where baseImg is the name of your unscaled image, baseImg = 'unscaledimage.hdr' and sFacs is your scaling factor in the form sFacs = [x y z]. Output will be a new header file with its sform44 and qform44 fields scaled by sFacs.

Note that the original header file is not lost - it will be saved with an extension “_pregradcoil”. The function applyScalingFactor will check for this “unscaledimage_pregradcoil.hdr” in your directory to help you avoid double scaling your images.

If you have a bunch of headers that need to be fixed, use the function

applyScalingFactorToEveryHdr(baseImg,sFacs)

that will search through whatever directory you are in for all of your headers scale them so long as _pregradcoil.hdr isn't already there.

If you would like to find your own scaling factors, read on…

Find Scaling Factors

Step one First, we affine align (distortion alignment) your post-grad coil images (source) to the pre-grad coil image (destination) in mrAlign. Then you save alignment, which will modify the sform44 in your post-grad coil header file. The new sform attempts to take your post-grad coil image into pre-grad coil replacement magnet space.

Step two: Now, we want to find out what a shift of “one” inside the pre-grad coil magnet means for the post-grad coil image. Use the function findScalingFactor on your affine aligned, sform44 modified image that you created in Step one…

sFacs = findScalingFactor.m

for image called sample_anat.img, sample_anat.hdr, we would type findScalingFactor('sample_anat') or ('sample_anat.hdr').

This function will find what a shift of “one” inside the magnet means for the input image. This input image should have a modified sform output from Step one. The output sFacs will be a 1×3 matrix of scaling factors.

Step three These scaling factors should be applied to your pre-grad coil images using the function applyScalingFactor or applyScalingFactorToEveryHdr, described earlier.

Note that results from affine transforms vary quite a bit each time - you are strongly advised to run through step one and two multiple times and get an average sFacs matrix before applying them to your old images in step three.

Sidenote on how we got sFacs

The sFacs suggested earlier is an average of scaling factor (in mms) for post-grad coil 3d anatomies taken on s00120100112, s00120100118(57 slices), and s00120100106 that were affine transformed to the pre-grad coil canonical t1 divided by t2 image called s001.

run a

0112a           1.0843416131288          1.05400148986555          1.05348929567612
0106a          1.08583544999658          1.06000712329475          1.06158107683954
0118a          1.08148336275729          1.05977419500758          1.06973751609701

run b

0112b          1.09055226342981          1.05376066069522          1.06402624627833
0106b           1.0881756557942           1.0473346127198          1.05478838195718
0118b          1.07772338468655          1.04429450451848          1.04939441216564

run c

0112c          1.09055226342981          1.05376066069522          1.06402624627833
0106c          1.08826321939717          1.05247230143074          1.04707389254274
0118c          1.07280170964161          1.04221835091397          1.04806351449988

The average is: sFacs = [1.08468528829887 1.0531954310169 1.05883615483564]

These numbers were finalized on 18jan2010.

Sidenote on sFacs as of 15Sep2011

After console upgrade and RF amplifier change in early 2011, we calculated it again.

>> [d h] = mlrImageLoad('mprage03.hdr');
>> [d2 h2] = mlrImageLoad('sg_t1.hdr'); 
>> SF=h.sform*inv(h2.sform)             
SF =
 -0.99314622503763        -0.00234644860405977     0.0307349291493732         9.89237468953286
 -0.00961093576312234     -1.00061360764469        0.0161844739832118         0.662788115250109
 -0.0349919032017878      -0.0159449698496554      -0.937535124942333         -41.4785479248679
0                         0                         0                         1
>> svd(SF(1:3,1:3))
ans =
        1.00442112083899
        0.99012334623948
       0.938145096551358

sFacs = [1.00442112083899 0.99012334623948 0.938145096551358]