Back to the main page.

Bug 1910 - Problem with converting old style CTF grad

Status CLOSED FIXED
Reported 2012-12-21 11:56:00 +0100
Modified 2012-12-31 11:46:21 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Vladimir Litvak - 2012-12-21 11:56:40 +0100

When doing grad = ft_datatype_sens(grad) with the CTF grad in the attached mat file I get: >> ft_datatype_sens(grad) undoing the custom balancing Warning: the linear projection for the montage is not full-rank, the resulting data will have reduced dimensionality > In ft_apply_montage at 91 In utilities\private\undobalancing at 37 In utilities\private\channelposition at 39 In ft_datatype_sens at 126 Warning: cannot determine channel positions and orientations > In ft_datatype_sens at 131 The second warning results in grad.chanpos and grad.chanori being all NaNs. This comes down to the fact that line 125 in ft_datatype_sens says if isequal(sens.label(:), lab(:)) whereas the order of labels in the two lists is not the same (the reference sensors come first in one and last in the other). Should be easy to fix.


Vladimir Litvak - 2012-12-21 11:57:43 +0100

Created attachment 397 Problematic struct


Robert Oostenveld - 2012-12-21 12:22:15 +0100

made test script mac001> svn commit test/test_bug1910.m Adding test/test_bug1910.m Transmitting file data . Committed revision 7246.


Robert Oostenveld - 2012-12-21 12:35:05 +0100

(In reply to comment #2) I changed it into % sensor description is a MEG sensor-array, containing oriented coils [chanpos, chanori, lab] = channelposition(sens, 'channel', 'all'); and then % the channel order can be different [selsens, selpos] = match_str(sens.label, lab); sens.chanpos = nan(length(sens.label), 3); sens.chanori = nan(length(sens.label), 3); % insert the determined position/orientation on the appropriate rows sens.chanpos(selsens,:) = chanpos(selpos,:); sens.chanori(selsens,:) = chanori(selpos,:); if length(selsens)~=length(sens.label) warning('cannot determine the position and orientation for all channels'); end it is an interesting test case, because the custom montage removes a channel. K>> setdiff(lab, lab(selpos)) ans = 'MRO31' For that channel the position is determined, but subsequently not used any more.


Vladimir Litvak - 2012-12-21 12:36:50 +0100

(In reply to comment #3) Many users might have systems with missing sensors so this should definitely be handled well.


Robert Oostenveld - 2012-12-21 12:39:22 +0100

fixed it: mac001> svn commit utilities/ft_datatype_sens.m Sending utilities/ft_datatype_sens.m Transmitting file data . Committed revision 7247. updated the test script with an assert(isnan(...)): mac001> svn commit test/test_bug1910.m Sending test/test_bug1910.m Transmitting file data . Committed revision 7249


Robert Oostenveld - 2012-12-21 12:49:22 +0100

(In reply to comment #4) I think it is handled properly. The surprise was that the channel is first missing and then reappears in determining the positions. So I expected the position for 287 channels but then got 288 positions, i.e. it was not just a reordering of the channels.


Robert Oostenveld - 2012-12-31 11:46:21 +0100

closed several bugs that have been resolved for some time. Feel free to reopen the bug if you disagree.