Back to the main page.

Bug 2570 - improve the unit handling in ft_apply_montage

Status NEW
Reported 2014-05-11 10:32:00 +0200
Modified 2014-05-29 13:35:32 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P5 normal
Assigned to:
Depends on:
Blocks: 2571
See also:

Robert Oostenveld - 2014-05-11 10:32:47 +0200

as discussed in bug 2532, it is desireable to use ft_apply_montage more consistently with channel types and units. E.g. following megplanar, the type and units should be updated. Also conceivable is the following montage = []; montage.tra = 1e6; montage.labelold = {'Cz'}; montage.labelnew = {'Cz'}; montage.chanunitold = {'V'}; montage.chanunitnew = {'uV'}; Imagine applying this to data. Or imagine applying this to itself. If the input data has different but convertable units, the conversion could be done in ft_apply_montage.

Robert Oostenveld - 2014-05-11 13:17:20 +0200

I have added the scaling according to the units to ft_apply_montage If you want to know how it works, please check test_bug2570.m for some examples. mac011> svn commit Sending forward/ft_apply_montage.m Adding test/test_bug2570.m Transmitting file data .. Committed revision 9486.

Robert Oostenveld - 2014-05-11 14:14:34 +0200

The following high-leve functions seem apply a montage to the data: mac011> grep -l ft_apply_montage *.m ft_preprocessing.m ft_prepare_layout.m ft_componentanalysis.m ft_rejectcomponent.m ft_denoise_pca.m ft_denoise_synthetic.m ft_megplanar.m ft_scalpcurrentdensity.m ft_preprocessing and ft_prepare_layout just use the montage from the cfg and do not make their own. Nothing needs to be done here. ft_componentanalysis and ft_rejectcomponent are specifically interesting, since they redistribute units between the time series and topographies. Hmm, this requires careful thought. I would expect ft_denoise_pca and ft_denoise_synthetic to keep the units the same. This should be easy to update. ft_scalpcurrentdensity and ft_megplanar really do something meaningful with the units in the time series. This requires a little bit more attention.

Robert Oostenveld - 2014-05-12 12:22:15 +0200

*** Bug 2572 has been marked as a duplicate of this bug. ***

Robert Oostenveld - 2014-05-12 12:29:31 +0200

(In reply to Robert Oostenveld from comment #3) Tom reported problems in bug 2571 and bug 2572. I made the change so that ft_apply_montage copies the input chantype and chanunits over to the montage. This should avoid errors due to converting something to unknown. mac011> svn commit forward/ft_apply_montage.m Sending forward/ft_apply_montage.m Transmitting file data . Committed revision 9498.

Robert Oostenveld - 2014-05-12 12:31:52 +0200

(In reply to Robert Oostenveld from comment #4) there was a typo in the code that only became visible on another test script. mac011> svn commit forward/ Sending forward/ft_apply_montage.m Transmitting file data . Committed revision 9500.

Robert Oostenveld - 2014-05-13 11:44:53 +0200

enhancement - copy chantype from input data over to either montage.chantypeorg in case inverse=false, or montage.chantypenew in case inverse=yes mac011> svn commit fileio/private/ft_apply_montage.m Sending fileio/private/ft_apply_montage.m Transmitting file data . Committed revision 9512. This solves a regression error I detected with test_bug1306

Vladimir Litvak - 2014-05-29 13:35:32 +0200

(In reply to Robert Oostenveld from comment #6) Could you perhaps change the warnings in ft_apply_montage to disp? I don't think it's justified in these case to print our many scary red lines in the command window. Vladimir