Back to the main page.

Bug 686 - the input and output units of ft_compute_leadfield should be determined

Status CLOSED FIXED
Reported 2011-05-25 12:40:00 +0200
Modified 2017-01-17 11:29:48 +0100
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Robert Oostenveld
URL: http://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=SPM;d3858c53.1105
Tags:
Depends on:
Blocks: 2377963
See also: http://bugzilla.fcdonders.nl/show_bug.cgi?id=1794

Robert Oostenveld - 2011-05-25 12:40:58 +0200

----- "Vladimir Litvak" <litvak.vladimir@gmail.com> schreef: Van: "Vladimir Litvak" <litvak.vladimir@gmail.com> Aan: "C. Micheli" <c.micheli@fcdonders.ru.nl> Verzonden: Dinsdag 17 mei 2011 23:59:40 Onderwerp: Re: electrodes referencing in the lead fields Hi Christiano, Thanks for the info. We'll probably only start using that for SPM12, and then I'll let you and Robert know how it works. There was a question on the SPM list about units of dipole waveforms. See http://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=SPM;d3858c53.1105 The function in question just multiplies the data by pseudo-inverse of the lead field. So if MEG data is in T and EEG data in uV and SPM head model in mm, what would be the resulting units, and are the units actually correct for BEMCP and for MEG models? Thanks, Vladimir


Robert Oostenveld - 2011-05-25 12:41:34 +0200

note that this should only have consequences for the documentation and that you should not change the code (yet). Changing the code would break existing/ongoing analyses.


Cristiano Micheli - 2011-06-15 11:17:02 +0200

(In reply to comment #1) > note that this should only have consequences for the documentation and that you > should not change the code (yet). Changing the code would break > existing/ongoing analyses. Now a list of the functions that require and not require dealing with units (or a comment on how to deal with them in their help) are available for the module FORWARD, see: http://fieldtrip.fcdonders.nl/development/fwdunits


Cristiano Micheli - 2011-10-13 12:02:02 +0200

(In reply to comment #2) > (In reply to comment #1) > > note that this should only have consequences for the documentation and that you > > should not change the code (yet). Changing the code would break > > existing/ongoing analyses. > > Now a list of the functions that require and not require dealing with units (or > a comment on how to deal with them in their help) are available for the module > FORWARD, see: > http://fieldtrip.fcdonders.nl/development/fwdunits Please see the test file test/test_bug686 Cheers C


Robert Oostenveld - 2011-10-18 09:26:36 +0200

can you please provide the table for EEG and for MEG here in bugzilla?


Cristiano Micheli - 2011-10-18 10:30:27 +0200

(In reply to comment #4) > can you please provide the table for EEG and for MEG here in bugzilla? EEG methods along rows, units (m, cm ,mm) along columns: singlesphere concentricspheres bem_cp bem_dipoli bem_openmeeg 0 -4.0000 -6.0000 -0.0000 -4.0000 -6.0000 0.0087 -3.9913 -5.9913 0.0044 -3.9956 -5.9956 -2.1881 -3.9622 -4.2903 MEG methods along rows, units (m, cm ,mm) along columns: singlesphere localspheres singleshell 0 -4.0000 -6.0000 0.0000 -4.0000 -6.0000 -0.0027 -4.0027 -6.0027


Robert Oostenveld - 2011-11-11 11:19:46 +0100

I closed all bugs that were recently resolved.


Robert Oostenveld - 2012-10-29 22:30:37 +0100

Looking at the table, the magnitude of the leadfields do not seem to scale correctly with the geometrical units of the electrodes and volume conductor.


Robert Oostenveld - 2013-07-01 16:17:59 +0200

Let me post the list of affected "data" representations as discussed in May with Vladimir on skype: 1) channel level data 2) grad and elec 3) anatomical volume data 4) anatomical mesh, e.g. triangulation 5) headmodel, i.e. volume conduction model 6) ft_prepare_vol_sens 7) ft_compute_leadfield 8) inverse method


Robert Oostenveld - 2013-07-01 16:19:41 +0200

(In reply to comment #8) regarding 1) ft_read_header and ft_chantype should share code for hdr.orig. hdr.orig is always available in ft_read_header, but might not always be available in ft_chantype. Hence ft_chantype needs other heuristics as well (e.g. based on channel name).


Robert Oostenveld - 2013-07-01 16:47:38 +0200

(In reply to comment #8) regarding 2) ft_convert_grad should be merged with ft_datatype_sens and represented as v2013. The v2013 format would have SI units (T/m) as default. Subsequently to be implemented in ft_read_header, ft_read_sens.


Robert Oostenveld - 2013-07-01 16:49:09 +0200

(In reply to comment #8) Regarding 3) this is ok, except for the occasional cfg.sourceunits and cfg.mriunits.


Robert Oostenveld - 2013-07-01 16:50:05 +0200

(In reply to comment #8) regarding 4) the implementation for anatomical meshes is ok


Robert Oostenveld - 2013-07-01 16:54:49 +0200

(In reply to comment #8) regarding 5) the ft_headmodel_xxx functions should get consistent geometrical inputs. These functions form the layer that know about the low-level code requirements. Suggested is that the functions require SI units for the anatomical mesh (or convert the mesh units to m if needed).


Robert Oostenveld - 2013-07-01 16:55:39 +0200

(In reply to comment #8) regarding 6) this function gets the head model and the sensors and consequently should ensure that the sensor description is expressed in SI units.


Robert Oostenveld - 2013-07-01 16:59:36 +0200

(In reply to comment #8) regarding 7) the input of ft_compute_leadfield (vol and sens) are due to the previous steps guaranteed to be in SI units. It can do the computation and after the computation scale the leadfield to the desired output units (per channel).


Robert Oostenveld - 2013-07-01 23:05:25 +0200

(In reply to comment #9) I checked the code, I think there is not much that can be shared which is not shared now. The interesting stuff should be further down in the code (e.g. in xxx2grad) and not in ft_chantype and ft_chanunit.


Robert Oostenveld - 2013-07-01 23:05:33 +0200

(In reply to comment #10) roboos@mentat001> svn commit Sending forward/ft_compute_leadfield.m Sending test/test_neuromag_units.m Sending utilities/ft_convert_grad.m Sending utilities/ft_datatype_sens.m Transmitting file data .... Committed revision 8301. restructuring - merged the code from ft_convert_grad into ft_datatype_sens, updated the test script for neuromag (it still runs fine), changed the handling of unit-conversion in ft_compute_leadfield in accordance with http://bugzilla.fcdonders.nl/show_bug.cgi?id=686


Vladimir Litvak - 2013-07-30 13:45:47 +0200

(In reply to comment #17) Hi Robert, Are you back from holiday? I'd like to move the scaling issue forward. I now have some data examples I can test on. Mark Woolrich has a way to rescale the channel data to make mags and grads equivalent for Neuromag but the lead-field scaling also needs to be right. Vladimir


Robert Oostenveld - 2013-07-30 16:09:54 +0200

(In reply to comment #18) yup, I am back. It is indeed good to try and finish this. I still have some emails to dig through, but given the quiet donders atmosphere at the moment (most people are still on holiday), expect that I can work on it. How about your availability?


Vladimir Litvak - 2013-07-30 16:16:01 +0200

(In reply to comment #19) I'm here till Friday and then I'll be in Berlin working with Till.


Robert Oostenveld - 2017-01-10 15:13:11 +0100

this is an old issue and can be closed. If the input is according to SI, the output is also according to SI. This is being tested with - test_meg_leadfield_units.m - test_eeg_leadfield_units.m - test_neuromag_units.m See also http://www.fieldtriptoolbox.org/faq/units


Robert Oostenveld - 2017-01-17 11:29:48 +0100

closed multiple bugs that were resolved some time ago