SEEG display on cortex problem

Hello,

Brainstorm 22-Mar-2019, MATLAB Version: 9.4.0.813654 (R2018a).

I'm having some troubles with the graphical interface of displaying SEEG contacts on the cortex. Not sure if this is a bug or something I did wrong but this is what is currently happening. When I right-click on the channel file and display the SEEG sensors on the cortex it seems to display correctly. However if I click on one of the contacts in the display I am getting 2 error messages:

The first is :


** Error: Line 226: bst_colormaps>GetColormap (line 226)
** Colormap type does not exist.
**
** Call stack:
** >bst_colormaps.m>GetColormap at 226
** >bst_colormaps.m at 74
** >figure_3d.m>UpdateFigSelectedRows at 2133
** >figure_3d.m at 40
** >bst_figures.m>FireSelectedRowChanged at 1970
** >bst_figures.m>SetSelectedRows at 1925
** >bst_figures.m>ToggleSelectedRow at 1903
** >bst_figures.m at 59
** >figure_3d.m>FigureMouseUpCallback at 770
** >bst_call.m at 28
** >figure_3d.m>@(h,ev)bst_call(@FigureMouseUpCallback,h,ev) at 71
**


I paused in bst_colormaps which has the following beginning at line 212:

function sCMap = GetColormap(ColormapType)
global GlobalData;
if isempty(ColormapType) || isempty(GlobalData) || isempty(GlobalData.Colormaps)
sCMap = db_template('Colormap');
return
end
% If argument is a figure handle
if ~ischar(ColormapType)
ColormapInfo = getappdata(ColormapType, 'Colormap');
ColormapType = ColormapInfo.Type;
end
% Get colormaps for a given modality
ColormapType = lower(ColormapType);
if ~isfield(GlobalData.Colormaps, ColormapType)
error('Colormap type does not exist.');
end
sCMap = GlobalData.Colormaps.(ColormapType);
end

The error is being flagged because ColormapType is an empty 0x0 char.

The second is:


** Error: Line 79: select3d (line 79)
** Input argument must be a valid graphics handle
**
** Call stack:
** >select3d.m at 79
** >figure_3d.m>FigureMouseUpCallback at 664
** >bst_call.m at 28
** >figure_3d.m>@(h,ev)bst_call(@FigureMouseUpCallback,h,ev) at 71
**


This seems to be caused by "obj" being a 2x1 Patch array, both called Patch (ElectrodeGrod), which seem to be identical. Perhaps this should be a 1x1 patch and the duplication is causing the issue?

If I click on a contact in the channel file with the same display open, I get the following error:

Error using cell/unique (line 85)
Cell array input must be a cell array of character vectors.

Error in figure_3d>UpdateFigSelectedRows (line 2120)
iAllChan = unique(sphUserData);

Error in figure_3d (line 40)
eval(macro_method);

Error in bst_figures>FireSelectedRowChanged (line 1970)
figure_3d('UpdateFigSelectedRows', iDS, iFig);

Error in bst_figures>SetSelectedRows (line 1925)
FireSelectedRowChanged();

Error in bst_figures (line 59)
eval(macro_method);

Error in panel_channel_editor>TableSelectionChanged_Callback (line 323)
bst_figures('SetSelectedRows', SelChan);

Error in panel_channel_editor>@(h,ev)TableSelectionChanged_Callback(ev.getValueIsAdjusting())
(line 165)
java_setcb(jTableChannel.getSelectionModel(), 'ValueChangedCallback',
@(h,ev)TableSelectionChanged_Callback(ev.getValueIsAdjusting()));

Error using cell/unique (line 85)
Cell array input must be a cell array of character vectors.

Error in figure_3d>UpdateFigSelectedRows (line 2120)
iAllChan = unique(sphUserData);

Error in figure_3d (line 40)
eval(macro_method);

Error in bst_figures>FireSelectedRowChanged (line 1970)
figure_3d('UpdateFigSelectedRows', iDS, iFig);

Error in bst_figures>SetSelectedRows (line 1925)
FireSelectedRowChanged();

Error in bst_figures (line 59)
eval(macro_method);

Error in panel_channel_editor>TableSelectionChanged_Callback (line 323)
bst_figures('SetSelectedRows', SelChan);

Error in panel_channel_editor>@(h,ev)TableSelectionChanged_Callback(ev.getValueIsAdjusting())
(line 165)
java_setcb(jTableChannel.getSelectionModel(), 'ValueChangedCallback',
@(h,ev)TableSelectionChanged_Callback(ev.getValueIsAdjusting()));

85 error(message('MATLAB:UNIQUE:InputClass'));

I assume the problems are related?

Any suggestions on debugging this?
Ken

Hi Ken,

These bugs have already been fixed in this commit: https://github.com/brainstorm-tools/brainstorm3/commit/5759cc6530ff9354e32fb30dfb7064fbc55fa2b7

Update Brainstorm and try again.

François

Hi François,

Thanks for that, I am no longer seeing those bugs following the update.

I am having one other issue, though this may be related to something I did when creating the channel file rather than a Brainstorm issue.

The context is that I have created a channel file in which I combined multiple SEEG implantations in order to show them together on an atlas brain. Next, I wish to display the SEEG contacts as spheres, and make them all the same color. I open the display, select a contact then hit Ctrl + a, then choose a color, say blue. I then get what is shown above.

There were several contacts which did not change color. If you look at the u_Q contact in the channel file, the 5 contacts on this electrode of type SEEG (I have changed the type of the others in order to hide them from the display), they appear in the display, but the u_Q contact is absent from the Electrodes management window on the right, which explains why the contact colors were unchanged. The channel file and display seem consistent, but the iEEG management panel seems to dropped some electrodes?

Note that I tried a couple of times to change the colors of all spheres in the same way as above on a normal channel file for a single implantation and it seemed to work fine in each case, which suggests I have done something to cause the problem in creating my combined channel file. Perhaps it is something to do with the naming that is causing the issue?

Perhaps related, perhaps not:

I believe John submitted a bug report on the error I found where hitting Ctrl + a on the electrodes gave an error. I get no error when I do this now, however if I try to delete all the electrodes at once after selecting them all, either using the delete key or via the " - " button, I get the following error:


** Error: Line 1103: Matrix index is out of range for deletion.
**
** Call stack:
** >panel_ieeg.m>RemoveElectrode at 1103
** >bst_call.m at 28
** >panel_ieeg.m>@(h,ev)bst_call(@RemoveElectrode) at 54
**


        % Delete electrode
        GlobalData.DataSet(iDS).IntraElectrodes(iSelElec) = [];

Is the line giving the error, where in my case iSelElec is a 1x15 uint16 = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15.
If I run GlobalData.DataSet(iDS).IntraElectrodes(1:15) = [], it seems to work fine.

The electrodes all still appear visible in the display, and I am able to Ctrl + a to select them all again, but if I try to delete them again, I get a "No electrode selected." error pop up. If I then close the display, I don't get a pop up asking me if I want to save changes, so nothing is altered.

Regards
Ken

Regarding the bug when deleting multiple SEEG electrodes from the iEEG panel: there was a bug in the way the delete loop was written. I fixed it here: https://github.com/brainstorm-tools/brainstorm3/commit/16b6bf98b3a4c8b3de1a8eea074fbbc0f238a038#diff-5d03d3ef5441acf005318a4a8bd366b4
Update Brainstorm and let me know if it solves the problem.

Regarding the missing electrode u_Q electrode in the iEEG panel: this depends on how the file was created. The list of electrodes displayed in the iEEG panel doesn't depend directly of the list of data channels you see when you right-click on the channel file > Edit channel file. This information is stored in the field IntraElectrodes of the channel file, that can't be seen or edited from the the channel editor.
https://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#On_the_hard_drive

The data channel #i is linked to the SEEG electrodes defined in IntraElectrodes through the field .Channel(i).Group. If the channel group is "u_Q" and there is an electrode named "u_Q" in IntraElectrodes, then the two are paired. But otherwise, it is possible to have SEEG electrodes (from IntraElectrodes) without data channels or SEEG data channels not attached to any existing SEEG electrode.

When you open a channel file with SEEG channels for the first time:

  • it tries to guess what it SEEG and what is not
  • it tries to group contacts (= data channels) by name, and if the configuration looks like it's an SEEG electrode, it creates automatically an SEEG electrode for these channels in IntraElectrodes
  • only the channels that have the Type field set to "SEEG" are included in this detection, so if most of your contacts are not set as SEEG, they might not be detected as belonging to an SEEG electrode properly
  • once this detection has been performed once, or after the channel file has been edited (ie. when there is at lease one element in IntraElectrode or one Channel.Group field set), this automatic detection is not performed again

So I can't tell you why your u_Q electrode was not created automatically. But you can probably add it now manually.
When you create this channel file, you could also create directly this IntraElectrode field instead of using the GUI after for that.

Cheers
François

The update solved the problem, and I was able to resolve my display issues by making corrections prior to the initial detection and then letting Brainstorm do its thing, which turned out to be simpler than updating all the fields after the fact.

Many thanks,
Ken