Recent Changes - Search:

Home

RunningExperiments

AnalysingData

MEG Group

Administrative info

Computers and network

Meetings

How to improve this site

HeadPositioningProblems

back to MEG main page

When you are running a subject in the NeuroMag machine, typically you perform a head-position measurement at the beginning of each run. At the bottom of the output screen it usually says "Recommended action: ACCEPT", which means that the system is pretty certain of its estimate of the head position, based on finding the position of the coils in the helmet, and fitting these positions to the Isotrak points that you measure with the stylus before the subject goes in the MEG.

Sometimes, however, the output screen says "Recommended action: RE-DO". It is worth pressing the "RE-DO" button once or twice just in case - on a second or third try it might work. You might also ask the subject to adjust his/her head position a tiny bit and then re-try. You can also enter the shielded room and try lifting the seat up a tiny bit, as the subject tends to move downward a bit over time due to compression of the foam on the chair. However, if all of these things fail, then most likely you will not be able to fix the problem, and the head positioning will not give you the cherished "ACCEPT" sign for the remainder of your experiment. THE GOOD NEWS is that very often you can press "ACCEPT" anyway, and be able to correct the head-positioning problem later on, as long as the coils were well localized within the helmet. This is explained below, along with a recipe (thanks to Lauri Parkkonen) for re-doing the HPI fitting off line after your experiment is finished and your subject has gone home!

There are two main reasons why the head positioning might fail: (1) the system is unable to accurately localize at least three of the four coils in the helmet, or (2) the coils are accurately localized within the helmet, BUT the fit between these locations and the Isotrak points is not good (> 5mm difference). The first four lines on the output screen tell you how accurately the coils were located within the helmet. This output looks something like this...

1 : -76.3 -22.4 32.4 (mag = 2.395e-06) g = 99.31% rg = 99.30%
2 : -47.7 76.9 31.8 (mag = 4.488e-08) g = 99.51% rg = 99.50%
3 : 50.6 73.7 33.9 (mag = 2.016e-06) g = 99.55% rg = 99.56%
4 : 63.8 -25.8 50.2 (mag = 1.973e-06) g = 99.93% rg = 99.96%

THE GOOD NEWS: As long as the numbers at the end of these lines are > 98.00% (i.e. the coils have been accurately localized within the helmet), then you can almost always press "ACCEPT" and go on with your measurement, and rest assured that you can correct the head-positioning problem later on when you sit down to analyze your data.

How to re-do the HPI fitting after the fact by swapping the coil order
(For a summary of the recipe, click here)

  1. Open a terminal window and log on to the acquisition workstation
    ssh meg@is143627
  2. cd to the directory where your data is, e.g.
    cd /neurospin/acquisition/neuromag/data/<your_study>/<your_subject>/<date_of_experiment>/
  3. Use the NeuroMag utility "hpifit" to check the quality of the head positioning
    /neuro/dacq/bin/hpifit -file subject101_run01.fif <press enter>
  4. Have a look at the output, in particular the last few lines. You might see something like this...

    Using quartenion alignment (4 points).
    PNT 1 diff = 12.449626 mm
    PNT 2 diff = 104.498101 mm
    PNT 3 diff = 105.141366 mm
    PNT 4 diff = 13.204071 mm

    If a couple of these numbers are much larger than 5 mm (as is the case in the example above), then the fit was not good. Very often this was simply because the algorithm incorrectly "guessed" the ordering of the four coils. You can correct this by forcing the algorithm to use a specific ordering. Try a couple of different orderings until you find the one that makes these four numbers really small (< 5 or 6 mm). The next step tells you how to do this...
  5. Use the same command again, but add the "-swap" command line option in order to impose a different ordering of the four coils.
    /neuro/dacq/bin/hpifit -file subj101_run01.fif -swap 1324 <press enter>

    The numbers "1324" tell the program which ordering to try. You can try any ordering you want (I just chose this one at random). Have a look again at the output...

    Using quartenion alignment (3 points).
    PNT 1 diff = 41.647691 mm
    PNT 2 diff = 30.535484 mm
    PNT 3 diff = 33.789683 mm

    ... It still does not look good. Note also that you will not always get four measurements - sometimes the program discards one coil if it can get a better fit with just three of the four.

    So we try again with a different ordering...

    /neuro/dacq/bin/hpifit -file subj101_run01.fif -swap 1234

    ...and look at the output

    Using quartenion alignment (3 points).
    PNT 1 diff = 1.646601 mm
    PNT 2 diff = 2.329218 mm
    PNT 3 diff = 0.846501 mm

    BINGO! This is the right ordering. So now you want to transfer these parameters to your .fif files before you start your data analysis. You do this by saving the parameters to a file and then using another NeuroMag utility to replace the parameters in your data (.fif) file with the good parameters. This is explained in the next steps...

  6. Repeat the last command with the addition of the "-output" command line option. This copies the parameters (using the right ordering of the coils) to a file with a name that you specify...
    /neuro/dacq/bin/hpifit -file subj101_run01.fif -swap 1234 -output subj101_run01_swap.fif

  7. Now you want to take the parameters in this newly-created file (subj101_run01_swap.fif) and apply them to your data. HOWEVER, you should not change your original raw data (you will not be able to anyway, since the files have read-only permissions). So first you make a copy of your data file...

    cp subj101_run01.fif subj101_run01_fixed.fif

    (It is not fixed yet, but it will be in a minute).

  8. Now you use the "copy_trans_fif" utility to replace the parameters in the copy of your data file, with the "good" parameters output by the hpifit program...

    /neuro/bin/util/copy_trans_fif -f subj101_run01_swap.fif subj101_run01_fixed.fif

  9. When you do your data analysis, use the "_fixed.fif" version of your data file. THAT'S IT!

    (Note that if you run the hpifit program on your fixed file, it will look like it has not been fixed, but this is because hpifit will completely re-do the fitting from scratch, using the same bad guess that it used in the first place. But the transform matrix for the head position will be the one computed based on the ordering of the coils that you chose.)

  10. Repeat steps 3 through 8 for each of your data files (i.e. for each run).

  11. One last thing (sanity check): you should run show_fiff on your newly-created data file and check that the head-position transform matrix is sensible.
    show_fiff -vt222 subj101_run01_fixed.fif

    The output might look like this (without the nice table formatting)...

222 = transform . . . device -> head
0.998765-0.049553-0.003465
0.0496730.9957720.077266
-0.000379-0.0773430.997004
-0.383026-3.28151869.650635


You can ignore the top and bottom lines. The middle three lines are the matrix. It should be close to the identity matrix (i.e. ~1.0 on the diagonal and << 1.0 elsewhere). If this is not the case, and especially if you have a negative number anywhere on the diagonal, then something is wrong - go back and try some other orderings. It is possible that you may follow this procedure and NOT be able to fix the problem. In that case you can take comfort in the fact that you tried your very best!

Edit - History - Print - Recent Changes - Search
Page last modified on April 19, 2010, at 05:52 PM