Example c81: MRI Head Model - Inverse Signal Fitting and Displaying






The signal data recordered on the scalp can be inverted to determine the underlying signals on the brain surface. The generalised Laplace equation describes the electrical activity within the human head and thus can be used in the inverse calculation to determine the underlying brain signals. This is known as the Inverse Problem.

Shown below is the head model consisting of the brain, skull and skin surfaces developed from a Magnetic Resonance Imaging (MRI) scan. The potential field on the surface of the scalp is also shown as well as the potential field on the brain surface obtained from the Inverse Procedure. The solution of the Inverse Problem can be evaluated by comparing the rerefered scalp signals (fitted_reref.signal) with the signals obtained from the Forward Problem (trans_head_data.signal) using UNEMAP.

MRI Head Model Front View with Field Back View with Field Brain Front View with Field Brain Back View with Field Comparison of the Forward and Referenced UNEMAP Scalp Signals

A movie sequence of the Inverse Problem can been seen in CMGUI by running the comfile view_inverse.com. This also calls the comfile animate_inverse.com as a looping comfile to generate a sequence of frames for a movie. The Forward Problem can been seen in CMGUI by running the comfile view_forward.com. This also calls the comfile animate_forward.com as a looping comfile to generate a sequence of frames for a movie.


The comfile run by this example is as follows:

fem def para;r;inv;example                    #define parameters
FEM def coor;r;head;example                   #define coordinates 
FEM def regi;r;head;example                   #two regions
FEM def base;r;head;example  
FEM def node;r;head;example   region all
FEM def elem;r;head;example   region all


#
# Define the Inverse Problem
#
fem def equa;r;head;example      region all
fem def mate;r;head;example      region all 
fem def init;r;head;example      region all
fem def coup;r;head;example
fem def solve;r;head;example     coupled region all
fem def reference;r;head;example

# Command updated by fixcom.sh on Wed Aug 23 17:50:22 NZT 2000
# Old command: fem apply reference history infile $example//fitted outfile fitted_reref binary
fem apply reference history infile "${example}fitted" outfile fitted_reref binary

Additional testing commands:

#
# start of testing
#


#
# Evaluate the rereferenced
#  signals at each node
#
fem eval elect;fitted_node_reref hist fitted_reref from node bin reg 1
fem li sign bin sign fitted_node_reref
fem def export;r;nodes;example
fem export sig;fitted_node_reref elec signal fitted_node_reref
fem export node;reref hist fitted_reref bin node 335..501 as skin reg 1
fem export elem;reref field elements 721..900 region 1 as skin


#
# Evaluate the rereferenced
#  signals at each electrode
#
fem def data;r;projected_positions;example region 1
fem def xi;r;projections;example region 1
fem eval elect;fitted_reref hist fitted_reref from data bin reg 1
fem li sign bin sign fitted_reref
fem define export;r;electrodes;example
fem export signal;fitted_reref electrodes signal fitted_reref


#
# Define and read the transfer
#  matrix to transfer signals
#  from the brain to the skin
#  surface
#
fem def transfer;r;head;example
fem evaluate transfer;head SVD
fem write matrix;head matr T_BH
fem write matrix;head matr T_BH binary
fem read matrix;head T_BH binary


#
# Define and apply the
#  procedure to invert the 
#  transfer matrix
#
fem def inverse;r;head;example
fem evaluate inverse;head SVD
fem apply inverse history infile fitted_reref outfile inverse_fitted bin


#
# Export signals to CMGUI
#
fem export node;inv_pot hist inverse_fitted bin node 1..167 as brain reg 2
fem export elem;inv_pot field elements 181..360 region 2 as brain


#
# Evaluate and export signals
#  to UNEMAP
#
fem eval elect;brain history inverse_fitted from nodes bin coupled reg 2
fem def export;r;brain;example
fem export signal;brain electrodes signal brain


#
# Apply the Forward
#  Procedure to obtain signals
#  on the skin
#
fem apply transfer history infile inverse_fitted outfile trans_fitted binary


#
# Export surfaces to CMGUI
#
fem export node;trans_pot hist trans_fitted bin node 335..501 as skin reg 1
fem export elem;trans_pot field elements 721..900 region 1 as skin


#
# Evaluate and export signals
#  to UNEMAP
#
fem eval elect;trans_head hist trans_fitted from nodes binary coupled reg 1
fem def export;r;nodes;example 
fem export signal;trans_head electrodes signal trans_head


#
# Evaluate the new transformed
#  fitted signals at each
#  electrode on the scalp
#
fem def data;r;projected_positions;example region 1
fem def xi;r;projections;example region 1
fem eval elect;trans_head_data hist trans_fitted from data binary reg 1
fem li sign bin sign trans_head_data


#
# Export signals to UNEMAP
#
fem def export;r;electrodes;example
fem export signal;trans_head_data electrodes signal trans_head_data



Files used by this example are:

Name                        Modified     Size

example_c81.com 20-Nov-2001 826 brain.ipexpo 10-Apr-2000 711 electrodes.ipexpo 10-Apr-2000 779 fitted.binhis 10-Apr-2000 808k head.ipbase 10-Apr-2000 7.8k head.ipcoor 10-Apr-2000 571 head.ipcoup 21-Aug-2002 437 head.ipcoup.old 10-Apr-2000 411 head.ipinve 06-Dec-2001 596 head.iprefe 10-Apr-2000 164 head.ipregi 10-Apr-2000 93 head.iptrsf 01-Nov-2001 777 head.irelem 10-Apr-2000 288k head.irequa 26-May-2003 2.8k head.irinit 10-Apr-2000 1.7k head.irmate 10-Apr-2000 1.7k head.irnode 10-Apr-2000 593k head.irsolv 13-Apr-2007 1.5k inv.ippara 12-Nov-2002 5.9k nodes.ipexpo 10-Apr-2000 779 projected_positions.ipdata 10-Apr-2000 13k projections.ipxi 10-Apr-2000 7.7k test_output.com 10-Apr-2000 2.5k

Download the entire example:

Name                      Modified     Size

examples_c_c8_c81.tar.gz 14-Apr-2007 1.2M

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:09:08 201614
cm-debugSuccessSat Mar 5 00:55:30 201641
mips-irix
cmSuccessSun Aug 19 03:47:18 2007243
cm-debugSuccessWed Aug 8 03:57:34 2007591
cm-debug-clear-mallocSuccessSat Aug 11 04:56:55 2007622
cm-debug-clear-malloc7SuccessMon Aug 20 03:55:50 2007602
cm64SuccessSun Aug 19 03:56:58 2007177
cm64-debugSuccessFri Aug 17 05:43:25 2007642
cm64-debug-clear-mallocSuccessThu Apr 1 11:36:27 2004269
rs6000-aix
cmSuccessWed Mar 4 01:20:30 200939
cm-debugSuccessMon Mar 2 01:42:35 2009149
cm64SuccessWed Mar 4 01:20:31 200940
cm64-debugSuccessTue Mar 3 01:44:22 2009171
x86_64-linux
cmSuccessSun Mar 6 00:01:25 20166
cm-debugSuccessSat Mar 5 00:04:22 201621

Testing status by file:


Graphical output from this problem is given here.


Html last generated: Sun Mar 6 05:51:18 2016

Input last modified: Fri Apr 13 10:40:46 2007


CMISS Help / Examples / c / c8 / c81