brainstorm-tools / brainstorm3 Goto Github PK
View Code? Open in Web Editor NEWBrainstorm software: MEG, EEG, fNIRS, ECoG, sEEG and electrophysiology
Home Page: http://neuroimage.usc.edu/brainstorm
License: GNU General Public License v3.0
Brainstorm software: MEG, EEG, fNIRS, ECoG, sEEG and electrophysiology
Home Page: http://neuroimage.usc.edu/brainstorm
License: GNU General Public License v3.0
Linear probes are perfectly supported. Users select the tip of the probe and the skull entry and Brainstorm takes care of the position assignment.
However, when multi-electrode ARRAYS (let's say a 10x10 array) are used, a new option should be introduced. Manufacturers give a diagram for each array they sell, that contains the electrode positioning on the array (the electrodes' indexing doesn't follow the traditional numbering 1,2,3,4... but is messed up based on how the wiring is implemented in the array).
So for this to work in Brainstorm:
Users should be able to:
I already have code that does all these things, but it needs to be implemented in the main iEEG tab.
Check: https://github.com/mpompolas/e-Phys/blob/master/TUTORIAL_channel_manipulation_for_arrays.m
The idea behind this algorithm, is that it takes 3 points on the CORTICAL surface for each array and based on these 3 points it creates a plane. Then the algorithm takes the 2D array positioning and converts it to an orthonormal base that aligns it on the plane that was computed.
This should just be an issue of the 2D layout visualization.
In order to compute the STA, a time window needs to be selected around each spike e.g. [-150,150] ms.
After the computation, the STA signals are [-150,150].
However, when the STA is displayed on the 2D layout, the time window (bottom left values on the 2D-layout window) is shown as [-300, 300] ms.
it seems this line has a problem:
brainstorm3/toolbox/io/in_fopen.m
Line 86 in 8e2c950
It should be
case {'EEG-EDF', 'EEG-BDF'}
to load bdf properly.
The code posted here has some issues: #69
Select 2 files, and enter filter "dSPM: MEG(Constr) 2018", it crashes in tree_dependencies>CreateFilterTree (line 852).
Add a review of the literature on resting state MEG.
Download the data from the OMEGA repository.
https://neuroimage.usc.edu/brainstorm/Tutorials/RestingOmega
Proper import of BIDS-MEG datasets should use properly the field AssociatedEmptyRoom to match the MEG recordings with the corresponding empty-room measurements.
This can be tested using these two datasets:
https://openneuro.org/datasets/ds000247/versions/00002
https://openneuro.org/datasets/ds000117/versions/1.0.3
And possibly other datasets:
https://github.com/bids-standard/bids-examples
Guiomar complained that in the OMEGA tutorial (ds000247) the subject and noise recordings where not matched correctly.
The tutorial scripts should be modified accordingly:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/script/tutorial_omega.m
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/script/tutorial_frontiers2018_single.m#L38
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/script/tutorial_visual_single.m#L38
The documentation might need to be edited too:
https://neuroimage.usc.edu/brainstorm/Tutorials/RestingOmega#Source_estimation
April 2015: Scaling of dSPM values for averaged files (ERP/ERF) by the number of trials was added:
https://neuroimage.usc.edu/brainstorm/News#April_2015
July 2018: It was reverted it in this commit:
4b32f0f
It is now documented in this tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/SourceEstimation#Averaging_normalized_values
November 2018: Dimitrios suggests to reimplement it again, maybe under a different format. Some important decisions have to be made here, as it impacts dramatically the output results.
The tutorial "Source estimation" lacks some details and links.
Please review all the sections tagged as TODO.
https://neuroimage.usc.edu/brainstorm/Tutorials/SourceEstimation
Some additional things are listed in here:
https://neuroimage.usc.edu/brainstorm/Tutorials/Review
(when they are addressed, please remove them from this page - we'll delete it when it's empty)
Case 1: SEEG subject with 185 monopolar recordings. I used the panel_montage > SEEG (Bipolar 2) auto-created montage file which will have lead to 162 referenced dataset. Then Standardize > Apply Montage process. I ended up to a " Dimension mismatch Error " in process_montage_apply.m at 139.
isChanBad = (double(sMontage.Matrix(iMatrixDisp,iMatrixChan) ~= 0) * double(DataMat.ChannelFlag(iChannels)' == -1) > 0);
workaround is the transposition of ChannelFlag(iChannels) mat in order to have 162x185 * 185x1 matrix multiplication.
Hossein, Richard:
Francois:
Hi there,
could you help me out please. I'm getting an error when trying to import nicolet (.e) file to brainstorm.
Nicolet file for example:
Patient2_UKCMB_EEG_t1.zip
Some programs only support DICOM input, and it would therefore be useful to be able to save MRIs (and overlays, via right click ->Snapshot -> Save overlay as MRI) as DICOMs directly from Brainstorm.
There is a built in Matlab function for writing DICOMs (Introduced before R2006a, but requires Image Processing Toolbox): https://www.mathworks.com/help/images/ref/dicomwrite.html
https://www.mathworks.com/help/images/create-new-dicom-series.html
I also found this GPL licenced toolbox, but it was designed with radiotherapy in mind: https://github.com/mwgeurts/dicom_tools
I'm not sure what is the current stage of development for this.
Storing the anatomical landmarks should be implemented in all the OMEGA subjects at some point, and reading them in Brainstorm as well when importing a BIDS database.
Here is the last email I got from Guiomar on this topic:
Regarding the AnatomicalLandmarkCoordinates in the MEG json file, it refers to the actual anatomical landmarks (the coil positions should go at "HeadCoilCoordinates"). These coordinates will go in the MEG coordinate system used, in our case: CTF. This can be specified at the "AnatomicalLandmarkCoordinateSystem" field.
The equivalent coordinates of these points should also be in the t1w MRI json file, using the "AnatomicalLandmarkCoordinates" but this time in voxels, as you mention (using MRIcron for the moment, unless this has been updated in Bst).We had some discussions related to the real-world coordinates, but not any conclusive decision that I'm aware of. So for now, we can cntinue using the "AnatomicalLandmarkCoordinateSystem" field to specify the coordinate system.
You can check more details of the BIDS here: https://bids-specification.readthedocs.io/en/latest/03-modality-agnostic-files.html
I will add soon the "world coordinates" display in the MRI Viewer, to make this task easier.
Submitted by Elizabeth Bock. Issues when importing many BIDS subjects at once.
BstDownload.java throws the error "Error: File is empty." the first time you try to download a file with gui_brainstorm's DownloadFile(). It works on subsequent attempts. Sadly, this is hard to reproduce as after deleting everything and restarting brainstorm + Matlab it still works the second time. However, this was reported by multiple users using WaveClus or Plotly. Did this error ever occur for downloading OpenMEEG?
I'm not sure how to fix this... We could let DownloadFile() try to download twice in a row (ugly solution), we could add a sleep delay in BstDownload before measuring the contentLength... Any ideas?
Waiting for updates from Richard and Hossein.
This tutorial was started a few years ago and never actually written:
https://neuroimage.usc.edu/brainstorm/Tutorials/Connectivity
There is also this page where I was trying to centralize the summary of some of the discussions:
https://neuroimage.usc.edu/brainstorm/ConnectivityAdmin
All the information in there should be either deleted (if of no interest anymore), moved to this issue (for topics that still need to be discussed), or moved to the connectivity tutorial (for info relevant for users).
A section "Connectivity" is also available in the general todo-list:
https://neuroimage.usc.edu/brainstorm/Next#Connectivity
TODO:
Use library: https://github.com/arnodelorme/mffmatlabio
Upload big JAR file to NeuroImage server for autodownload.
Possible improvements to db_save():
Hi.
is there a simple way to perform a moving average on a signal in Brainstorm ?
Best.
Edouard
Now that the Matlab 2018b beta is out, we should test the SVD bug affecting bst_inverse_linear2016 and 2018.
Make sure to throw an error if not MEG. Do not export .BST files, try to find original raw file in History.
Add way for users to add their custom metadata in process options.
Not a particularly pressing issue, but the feature where the electrode contact is highlighted in red (in the 3D MRI view) when you select a channel only works in average reference. When using a bipolar montage I would expect both channels of the pair to be highlighted when selecting a given bipolar channel. Also, the highlighted contact is sometimes hard to spot because of the default blue-red colour scheme for amplitude. Maybe a different colour for selected contacts would be better (i.e. not red or blue).
The issue is that all the file searches rely on comparing the filename with all the filenames in the database at every call. Function bst_get/findFileInStudies is bottleneck for processes that do a lot of operations with small files.
Issue reported by Emily: http://neuroimage.usc.edu/forums/t/processes-slowing-way-down/5280/4
Possible solution: manage a large hash table with all the filenames of the database?
(maybe this could be manage internally in bst_get.m)
Steps to reproduce:
"Display on MRI (MRI Viewer)" works fine
Error using cellfun
Non-scalar in Uniform output, at index 1, output 1.
Set 'UniformOutput' to false.
Error in bst_figures>GetChannelsForFigure (line 252)
iChanZero = find(cellfun(@(c)(~isequal(size(c),[3,1]) | all(abs(c)<1e-5)), chanLoc));
Error in bst_figures>CreateFigure (line 217)
[selChan,errMsg] = GetChannelsForFigure(iDS, iFig);
Error in bst_figures (line 59)
eval(macro_method);
Error in view_surface_data (line 271)
[hFig, iFig, isNewFig] = bst_figures('CreateFigure', iDS, FigureId, 'AlwaysCreate');
Error in tree_callbacks>@(h,ev)view_surface_data(MriFile,filenameRelative) (line 1871)
gui_component('MenuItem', jPopup, [], 'Display on MRI (3D)',
IconLoader.ICON_ANATOMY, [], @(h,ev)view_surface_data(MriFile,
filenameRelative), []);
Creating new bipolar montages in Brainstorm is easy, but average montages are not so obvious. I would like an additional default (automatically generated regardless of number of EEG electrodes) montage with all the left channels on top, followed by midline channels, and right channels (e.g. Fp1, F7, ..., Fz, Cz, ..., Fp2, F8, ...). This has many use cases, but lateralisation of epileptiform activity is one. A spacer between the three groups (left, midline, right) would be nice also.
OpenMEEG was recently upgraded from version 2.2 to 2.4: c6a153b#diff-9e590703ce3a61a47c365d821b1164e6
The two versions handle differently the dipoles that are outside of the inner skull surface. In 2.2 it led to incorrect values in the gain matrix, in 2.4 these values are set to zero.
Until now, we were adjusting the BEM layers (inner skull, outer skull, scalp) so that they include all the vertices, but I disabled some of these constrains because it was altering too much the shape the skull. If we want to get rid of all these outliers, we need to adjust the position of the vertices and project them back inside the skull. This would change our workflow, as now the cortex surfaces are never modified after being imported from FreeSurfer/BrainVISA.
So we have two options:
John, Sylvain: Could you share your point view on this problem?
Thanks
Add warning to user when they do an SVD on Matlab 2018a.
Labels = {...
1000, 'lh-unknown'; ...
1001, 'lh-bankssts'; ...
1002, 'lh-caudalanteriorcingulate'; ...
1003, 'lh-caudalmiddlefrontal'; ...
1004, 'lh-corpuscallosum'; ...
1005, 'lh-cuneus'; ...
1006, 'lh-entorhinal'; ...
1007, 'lh-fusiform'; ...
1008, 'lh-inferiorparietal'; ...
1009, 'lh-inferiortemporal'; ...
1010, 'lh-isthmuscingulate'; ...
1011, 'lh-lateraloccipital'; ...
1012, 'lh-lateralorbitofrontal'; ...
1013, 'lh-lingual'; ...
1014, 'lh-medialorbitofrontal'; ...
1015, 'lh-middletemporal'; ...
1016, 'lh-parahippocampal'; ...
1017, 'lh-paracentral'; ...
1018, 'lh-parsopercularis'; ...
1019, 'lh-parsorbitalis'; ...
1020, 'lh-parstriangularis'; ...
1021, 'lh-pericalcarine'; ...
1022, 'lh-postcentral'; ...
1023, 'lh-posteriorcingulate'; ...
1024, 'lh-precentral'; ...
1025, 'lh-precuneus'; ...
1026, 'lh-rostralanteriorcingulate'; ...
1027, 'lh-rostralmiddlefrontal'; ...
1028, 'lh-superiorfrontal'; ...
1029, 'lh-superiorparietal'; ...
1030, 'lh-superiortemporal'; ...
1031, 'lh-supramarginal'; ...
1032, 'lh-frontalpole'; ...
1033, 'lh-temporalpole'; ...
1034, 'lh-transversetemporal'; ...
1035, 'lh-insula'; ...
2000, 'rh-unknown'; ...
2001, 'rh-bankssts'; ...
2002, 'rh-caudalanteriorcingulate'; ...
2003, 'rh-caudalmiddlefrontal'; ...
2004, 'rh-corpuscallosum'; ...
2005, 'rh-cuneus'; ...
2006, 'rh-entorhinal'; ...
2007, 'rh-fusiform'; ...
2008, 'rh-inferiorparietal'; ...
2009, 'rh-inferiortemporal'; ...
2010, 'rh-isthmuscingulate'; ...
2011, 'rh-lateraloccipital'; ...
2012, 'rh-lateralorbitofrontal'; ...
2013, 'rh-lingual'; ...
2014, 'rh-medialorbitofrontal'; ...
2015, 'rh-middletemporal'; ...
2016, 'rh-parahippocampal'; ...
2017, 'rh-paracentral'; ...
2018, 'rh-parsopercularis'; ...
2019, 'rh-parsorbitalis'; ...
2020, 'rh-parstriangularis'; ...
2021, 'rh-pericalcarine'; ...
2022, 'rh-postcentral'; ...
2023, 'rh-posteriorcingulate'; ...
2024, 'rh-precentral'; ...
2025, 'rh-precuneus'; ...
2026, 'rh-rostralanteriorcingulate'; ...
2027, 'rh-rostralmiddlefrontal'; ...
2028, 'rh-superiorfrontal'; ...
2029, 'rh-superiorparietal'; ...
2030, 'rh-superiortemporal'; ...
2031, 'rh-supramarginal'; ...
2032, 'rh-frontalpole'; ...
2033, 'rh-temporalpole'; ...
2034, 'rh-transversetemporal'; ...
2035, 'rh-insula'; ...
};
I am using Brainstorm 06-Dec-2017 on Ubuntu 16.04.3 with Matlab 2016b. My desktop environment is MATE 1.12.1 and I use the mutter 3.18.3 window manager. I have noticed an annoying bug where the red cursor is reset and stays stuck at the start of a page after opening a second window/figure and clicking anywhere one the first window. This does not affect only the latest version of Brainstorm (unfortunately, I do not know in which version this appeared), but seems to be platform dependent (I could not reproduce the problem on another workstation running an older version of Ubuntu MATE with a different window manager).
Steps to reproduce:
Follow the e-Phys tutorial to reproduce this issue. After loading the plexon file, import a set of trials (e.g. Stim On 1) and then compute the Spike field coherence on the folder.
The drop-down that selects the neuron after the spike-field-coherence is computed and visualized, should contain only labels that indicate neuronal activity (Spikes Channel AD01). However, other events appear as well (Event001, Event002 ...). This means the "process_spikesorting_supervised('GetChannelOfSpikeEvent', x)" function is producing indices that are not aligned with the events order on the link to raw file events.
In the PSD and time series figures, the Grid button still requires some work:
MINC reader:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/in_mri_mnc.m
Handle the vox2ras transformation in a similar way as the nifti reader:
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/in_mri_nii.m
Adding support for basic boolean operators in the filter search box would be a nice feature. I know more complex file selection operations can be achieved by stacking "Select Files" processes (and with scripting of course), but I think it would enhance usability to make the filter search box a bit more powerful. Specifically, I would propose adding support for PubMed-style syntax to the filter box, because I expect it would be familiar to most Brainstorm users.
Some examples:
Switching montages via keyboard shortcuts is currently possible via shift + A, B, C etc. There are a couple of issues with this setup, however:
It would be nice if it were possible to set the keyboard shortcut in the montage editor (even if they all still follow the "shift + letter" pattern).
The following functions now crash with some specific noise covariance matrices:
bst_inverse_linear_2016, line 915
bst_inverse_linear_2018, line 1093
Matlab 2017b:
K>> [Un,Sn2] = svd(Cov,'econ')
% Returns valid results
Matlab 2018a:
K>> [Un,Sn2] = svd(Cov,'econ')
Error using svd
SVD did not converge.
Example file:
Cov.zip
The only documentation I could find about changes in this functions is the following, but it is about input parameters, it doesn't say anything about the algorithms changing.
https://fr.mathworks.com/help/matlab/release-notes.html?rntext=svd&startrelease=R2017b&endrelease=R2018a&groupby=release&sortby=descending&searchHighlight=
Extension of the IC sorting, implemented in: #67
To facilitate the selection of bad IC, the % of correlation could be shown to the user.
For instance, it could be stored in the SingVal field (as a cell array: Nx2, {correlation, channel_name}).
Some functions should be updated to consider a cell array as an ICA result:
Once sources are computed, the size of protocol.mat essentially doubles because every data file has a link added as a child. These could be computed on the fly instead.
In the "Pre-processing" box of the "Import in database..." menu it would be nice if the "Resample recordings" value defaulted to the most recently set value instead of resetting to the sampling frequency (e.g. 2400 Hz) every time.
Link an EDF file to the database, import a block of 1s from it, export this block to an EDF file, import it again.
The amplitudes of the files in input and output are completely different...
p45_cw-export.zip
Right now, with SEEG montages that have very long channel names, the left panel of the Montage Editor is too small to properly read them and their keyboard shortcut. Consider enlarging its fixed width or even making it extendable.
I resample 1-70Hz bandpassed raw EEG/MEG recordings to 300Hz (acquired at 2400Hz) for visualisation and event marking to improve page flip speeds. However, I've noticed that the "Duration" value in the "Page settings" box of the "Record" tab seems to readjust the page duration based on the number of samples. For instance, if I have I have a run sampled at 2400Hz open with page duration set to 10s and open another run resampled at 300Hz, then the page duration switches to 80s. This seems like a bug; the page duration setting should stay constant no matter the sampling frequency (e.g. 10s at 2400Hz or 300Hz).
Dear all,
when trying to import Presentation log files, I noticed that event names are read improperly (at least for the file I have).
here can be my suggested changes. (This works for me)
I will post pull-request
% get correct col number
[~,typeColIdxinHeader] = ismember('Event Type',headerFields);
[~,codeColIdxinHeader] = ismember('Code',headerFields);
[~,timeColIdxinHeader] = ismember('Time',headerFields);
% Split line
cellLine = str_split(strLine, sprintf(' \t'));
% If the line contains enough entries: use it
if (length(cellLine) >= 4) && ~isempty(str2num(cellLine{timeColIdxinHeader}))
mrkType{end+1} = strjoin([cellLine(typeColIdxinHeader),cellLine(codeColIdxinHeader)],'_');
mrkTime(end+1) = str2double(cellLine{timeColIdxinHeader});
elseif any(~ismember(cellLine,'Trial'))
break
end
I'm running Brainstorm 24-Oct-2017 in Matlab 2016b on Ubuntu 16.04.3. After I reload a protocol moved to a different location, the file tree in the main Brainstorm window no longer refreshes when switching protocol (e.g. if I try switching from protocol A to protocol B in the dropdown menu, the files in protocol A remain displayed in the file tree below). There are no error messages displayed in the Matlab console.
Steps to reproduce:
In a brainstorm database with more than 2 protocols,
My current work-around is to close Brainstorm and open it again, after which switching protocols using the dropdown menu works again.
Fieldtrip already supports it. Sylvain will contact collaborators for example files.
I get the following error when I click on "Set surface color":
Error using matlab.ui.internal.dialog.WebColorChooser/show (line 72)
Java exception occurred:
com.mathworks.html.BrowserCreationException:
com.mathworks.html.BrowserCreationException:
com.teamdev.jxbrowser.chromium.internal.ipc.IPCException: IPC process exited. Exit
code: 127
at
com.mathworks.mlwidgets.html.LightweightBrowserBuilder.buildBrowser(LightweightBrowserBuilder.java:86)
at
com.mathworks.mlwidgets.html.LightweightBrowserBuilder.buildDefaultBrowser(LightweightBrowserBuilder.java:52)
at
com.mathworks.mlwidgets.html.LightweightBrowserFactory.createLightweightBrowser(LightweightBrowserFactory.java:36)
Caused by: com.mathworks.html.BrowserCreationException:
com.teamdev.jxbrowser.chromium.internal.ipc.IPCException: IPC process
exited. Exit code: 127
at
com.mathworks.html.jxbrowser.chromium.LightweightChromiumBrowser.(LightweightChromiumBrowser.java:32)
at
com.mathworks.mlwidgets.html.LightweightBrowserBuilder.buildBrowser(LightweightBrowserBuilder.java:78)
... 2 more
Caused by: com.teamdev.jxbrowser.chromium.internal.ipc.IPCException: IPC process
exited. Exit code: 127
at com.teamdev.jxbrowser.chromium.internal.ipc.d.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)Error in uisetcolor_helper>showDialog (line 67)
ccDialog.show;Error in uisetcolor_helper (line 12)
selectedColor = showDialog(ccDialog);Error in uisetcolor (line 33)
selectedColor = uisetcolor_helper(varargin{:});Error in panel_surface>ButtonSurfColorCallback (line 488)
colorCortex = uisetcolor(TessInfo(iSurface).AnatomyColor(2,:), 'Select surface
color');
Brainstorm version: Version: 3.4 (26-Apr-2018), from github
Matlab version: 9.2.0.556344 (R2017a)
OS: ubuntu 17.10
Seems like it's coming from jxbrowser so I tried to use another html engine in matlab:
webutils.htmlrenderer('basic')
But no success, still same error...
The pipeline currently described on the website is not giving acceptable results, and we could not publish any statistics at the group level in the recent Frontiers article. This needs to be addressed urgently.
Two online tutorials to fix:
https://neuroimage.usc.edu/brainstorm/Tutorials/Workflows#Constrained_cortical_sources
https://neuroimage.usc.edu/brainstorm/Tutorials/VisualGroup#Group_analysis:_Sources
Unconstrained sources must be addressed as well. We are now recommending most EEG users to use unconstrained dipole orientations, but we have no option at all to offer for group analysis.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.