Hello,
I have gathered some channel location data along with some head point locations using 3D SpaceDX (version 1.3, part of Neuroscan’s SCAN software) and I am trying to import the results into Brainstorm (3.1). I have encountered a couple of small bugs in this process, so I thought I’d report them and explain how I fixed them. I hope these minor fixes can be incorporated into future releases of brainstorm.
SpaceDX can save in a number of formats, but the bug I’ve encountered involves the text *.dat format.
When I try to import the file into Brainstorm, using the gui (rightclick common files… import channel file), I select the .dat and get the following error.
** Error: Line 81: Cell contents reference from a non-cell array object.
**
** Call stack:
** >in_channel_neuroscan_dat.m at 81
** >import_channel.m at 169
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_channel,iAllStudies) at 1749
**
This is because in my channel.dat file, there is no text label for headpoint entries. Line 75 of in_channel_neuroscan_dat.m is the cause of this bug:
read_val = cat(2, {’’}, read_val);
This is executed if a text label is missing. There is an easy fix:
read_val = cat(2, {{’’}}, read_val);
Double-curly braces create the cell that line 81 is looking for. Great!
So I made that fix to my version, and successfully imported my channel file. When I looked at the headpoints, though, they appeared rotated ~90 degrees.
I dove into the channel import code, and found that after the channel matrix structure is created, it is passed to channel_detect_type.m. Channel_detect_type calls cs_mri2scs.m to put mri-centered coordinates into scs coordinates. The bug is that cs_mri2scs is called for electrode locations, but not head point locations.
I’ve worked around this by exporting the channel file to matlab (as ChannelMat) and then calling:
ChannelMat.HeadPoints.Loc = cs_mri2scs(ChannelMat, ChannelMat.HeadPoints.Loc .* 1000) ./ 1000;
I then import back into Brainstorm, and things look good.