Realtime head tracking and align issue

I started testing the latest Brainstorm and Matlab R2018a on our realtime head tracking setup. Beth and I managed to track down a new bug to view_channels.m line 116:
if isempty(GlobalData.DataSet(iDS).ChannelFile) || isempty(GlobalData.DataSet(iDS).Channel)
% Load channel file
That “if” was not there before, and now when doing realtime alignment, it causes the same helmet to be reused instead of loading the second “live” helmet. I suspect this is the only case where we display 2 helmets on the same figure so it might have been overlooked when adding this condition. As a workaround, we cleared the global before calling view_helmet the second time, but there now seems to be another problem (not sure if it is related): the helmet triangulation is a little off, with some triangles missing at the top and some extra triangles joining the front of the helmet, making the rim triangular instead of round. (I’ll take a screenshot when I get a chance.) I’ll continue to investigate, but any suggestions or ideas on what could be the problem would be welcome.

I’m sorry, I can’t help you much, I’ve never been using this realtime code.
Maybe @MartinC can help you debug this.

Francois

I’ve isolated the second bug to bst_project_2d.m with the new ‘2dcap’ method, which should require the sensor vertices to be in a somewhat “centered” coordinate system. During real-time alignment the second helmet is first drawn in dewar coordinates and its 2dcap projection was “bad”. Thus the code failed to properly find the helmet edges, leading to the strange helmet patch. This one is an easy fix, but I’m going to meet with Martin regarding how to fix the GlobalData bug, since I’m not familiar with the logic behind this global variable.

1 Like

Hi Marc,

For following up on ongoing developments and bug fixing, I suggest you post the topic as the github issue, it makes it much easier for us to see which problems are still pending.
https://github.com/brainstorm-tools/brainstorm3/issues

Using github will also allow you to submit your code modifications easily for review. If you’re not familiar with github, I’m sure @MartinC will be happy to teach you : )

Cheers
Francois