Page overlap while reviewing raw file -- a way to set to 0%?

Hi All-

I have discovered Brainstorm relatively recently and I love it so much, I am considering switching over to this for some of our lab's main data processing tasks. However, I am encountering one seemingly small obstacle that I would be grateful if anyone can help with.

For our laboratory an important goal is to be able to quickly "score" sleep stages in long, continuous recordings of sleep EEG. This basically consists of labeling consecutive 30sec epochs with event markers representing sleep stage, based on visual inspection. Brainstorm's existing functions are already well-suited for this, except for one problem: When scrolling through a raw file, there is a small overlap of data from one screen to the next. For example, when paging forward using F3 with page duration set to 30sec, the next screen displayed overlaps with the prior screen by a small amount (10%). This creates a problem for the otherwise simple goal of quickly and efficiently scrolling through epochs on an exactly 30-sec basis, which is required for accurate sleep staging.

So my question is, is there a way to set the page overlap amount to 0% while reviewing raw files? I have not been able to find any such setting in the GUI. I had thought of first segmenting the continuous data into 30sec epochs and then scrolling through epochs, but it is then a problem that one cannot then efficiently export all markers from all epochs as a single file.

Thanks so much for your help!
Erin Wamsley
Furman University

Hi Erin,

Thank you for the kind words and the great feedback. You are right that right now the way that scrolling to the next page of a raw file works is that it moves forward to 90% of your page duration, leaving a 10% overlap. Sadly you cannot change this through the GUI as the 90% value is hardcoded right now:

@Francois I'm sure there was a good reason to add an overlap. Perhaps we could add this as a parameter that can be changed from the GUI?

Cheers,
Martin

Thank you so much for your reply and for directing me to the relevant bit of code -- Just changing those two lines seems to work perfectly without any adverse side-effects that I can tell.

Erin Wamsley
Furman University

Dear Erin,

I am at the moment rewriting the display of the event markers, adding the support for events defined only on specific channels and for additional text labels, and adding some more keyboard shortcuts.
The goal is to improve the file viewer for clinical use, to offer features that most commercial clinical EEG viewers include. It's a good time to submit requests on this topic.

The overlaps of 10% (with F3/Shift+F3) or 50% (with F4/Shift+F4) were added for people looking for very short events (eg. epileptic spikes, or MEG sensor jumps), that could be missed if between two pages. I understand why scrolling without overlap could also be useful.
What about adding a new keyboard shortcut (F6/Shift+F6 ?) for scrolling without overlap?

For creating your events, it could also save you some clicks if the we improved the user-defined keyboard shortcuts for marking events. For now you can associate each of the keys 1-9 to the creation of a simple event marker.
image

But we could also think of allowing these keyboard shortcuts to be associated to the creation of extended events, with maybe one extra option for each shortcut: 1) simple event, 2) extended event with a user-defined time window around the time cursor, 3) entire page.

With this third option, your reviewing task would become simply: press "F6" to scroll through the file, and press a key "1" to "9" to associate a score to the page, right? No mouse involved anymore.
I could implement this over the next few days (one or two weeks max).

@jeremym @mheers What do you think?

Thanks for your inquiry about requests re: review and events, because I have some! :grinning:

Yes, so far, we have been testing out the sleep scoring basically the way you describe:
Step 1: Starting at the beginning of a file, with the cursor at the beginning of a page, press a key to assign a sleep stage
Step 2: Page forward to the next page
Step 3: Repeat until the end of the recording

This works pretty well, but:

  1. Yes, a special keyboard shortcut to advance the page without any overlap would be certainly a useful addition.

  2. Yes, an option to create events that have a user-defined length or cover a full page would also be useful. Currently, it would be necessary to always ensure that one's cursor remains exactly at the first sample on a 30sec screen, so that the single-point event consistently marks the onset of a 30-sec epoch (this allows later segmentation into different stages in preparation for subsequent analysis, and also works well for custom analysis of time spent in each sleep-stage, etc.). But it is really easy to accidentally move one's cursor and throw everything off, so it would be more ideal to be able to have the event just automatically cover the entire current page, regardless of cursor position. This would also help with the problem that, if the event is marked only at the onset of the page, you can barely see the visual marker label that comes up on the screen (because it appears right on the leading edge of the window).

  3. But what would REALLY make this kind of visual scoring easier would be if there were an option such that, once an event is assigned to a page, the view AUTOMATICALLY flips to the next page. This is how sleep-scoring-specific applications work, allowing one to very quickly move through a record using only one keystroke per page. I think many users might also be interested in this workflow for visually marking artifact (yes artifact / no artifact) on a fast page-by-page basis in continuous data.

  4. Another change that would make this type of scoring easier would be if the small event-marker icons inside the scroll bar at the bottom of the reviewing screen were larger. These marks are essential for seeing what the scores of the prior and upcoming epochs are, and for visually checking that every epoch has correctly received a score, but they are currently so tiny the are hard to see. If these were larger, and if they filled the time of the whole epoch instead of just a single point, it would be more useful. The existing color-coding of these marks and different height that the marks appear at is excellent though.

I realize that the last two ideas are very ultra-specific to the type of visual classification that we do in sleep research, and so might not be practicable to implement. But on the other hand, I think there are quite a few sleep researchers out there who do quantitative EEG analyses of various kinds and would be more attracted to Brainstorm if it had these features.

Thanks for your work on Brainstorm!

Erin Wamsley
Furman University

@Francois
Yes, I agree this sounds like a good idea. I personally find the 10% overlap helpful (for epilepsy), but I can see how no overlap would be useful for sleep staging. I think the additional F6 shortcut is a good solution (is F5 used for something? If so could it be switched? Would make more sense for F3, F4, F5 to be for page flipping). In regards to the event keyboard shortcuts menu, yes I think a radio button for each shortcut to select between simple (default)/extended (with an input field for x ms)/full page events could be useful. Maybe an additional checkbox (also for each shortcut) to "auto flip to next page after marking event" would be a way to implement what @ewamsley is suggesting. I'd make the checkbox shortcut specific because you'd probably want to have some events flip the page automatically (e.g. N1, N2, N3) and others not (e.g. spindle, K-complex).

Not sure if this is easy to implement, but a related feature request would be for a way to have subject-specific shortcuts. This would mean having the ability to set global ("default") keyboard shortcuts, which get copied by default for each new subject, but if overwritten, then the subject-specific shortcuts are saved between sessions. The use case in epilepsy is that spikes occur in different channels for every patient (e.g. I could have 1-> F4, 2->Fp2, 3 -> megspike_RF, 4-> PFA_F4, etc. for one patient) and there aren't enough keyboard shortcuts to assign one for each channel (which wouldn't make much sense either, since it'd be hard to remember them all). This means that every time I switch between patients, I need to redefine my keyboard shortcuts, which is inconvenient. If this is hard to implement, then maybe an alternative would be the ability to save/load (or switch between, like switching between montages or loading saved pipelines) sets of keyboard shortcuts, so that at least there wouldn't be the need to retype each one manually.

Looking forward to seeing all these updates ^ _ ^
Thanks!

Dear Francois and Martin,
I am actually very happy with the 10% and 50% overlap when reviewing raw data. @ewamsley: Another way of reviewing data in non-overlapping time-frames could be to cut them into epoches and asign different values to each epochs (jumping from one epoch to the next should be possible using 'F3' and 'shift + F3' to jump backwards).

What would have been very helpful during my last projects was marking events having a certain duration in a specific channel. The most effective way doing this is probably using the mouse. I would love to use such a function.

Best regards
Marcel

Thank you all for you very useful suggestions.

I implemented everything you suggested, except for the subject-based shortcuts (for later maybe):

  • Shortcuts F6 and Shift+F6: Switch to the next/previous page without overlap
  • Custom shortcuts now include three options Simple/Full page/Extended. Full page automatically switches to the next page
  • Events can be attributed to a specific channel
  • Events can be represent as lines instead of dots
  • Additional comments can be attached to each event
  • Specific event categories can be hidden

This is all described in this tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers#Hide_event_groups

Let me know if there are things that could be improved or that do not work as advertised.

2 Likes

These changes are awesome!

I don't know how much you want to pursue event features that are pretty specific to sleep scoring, but other features that would be helpful in that regard:

  1. Ability to optionally set it so that two events of the same type cannot be simultaneously assigned to the same page -- for example if you add an event "Stage 2" to a page that is already marked as "Stage 1", the 2nd event would overwrite the first, instead of both being present. But obviously, for many other applications you do need to have overlapping events, so this would have to be optional.
  2. Ability to skip directly to the next page that does not already have an event assigned -- for this type of scoring you have to go back and forth a lot, and it takes time to scroll back to exactly where you left off.

Done!
https://github.com/brainstorm-tools/brainstorm3/commit/f4241531d4965a74646f82fe0688ef61293c0832

I made three modifications:

  • when jumping to a "full page" event, it loads the window starting from the beginning of the event (insted of of the default logic, which is to position the center of the event at 30% of the X axis)
  • A new "full page" event now replaces all the existing ones (your first request), and giving the same score does not erase the existing event
  • After marking a "full page" event, the viewer jumps to the end of the sequence of marked pages

When navigating in the parts of the file that are already scored, click on the horizontal bars representing the events at the bottom of the figure, this way it would always jump to full scored pages.
If you navigate in the file in any other way, the time window would probably not be aligned with the existing scoring divisions, these features would not work correctly.

Please keep on posting your suggestions.
And advertise Brainstorm everywhere as the best tool for sleep scoring :slight_smile:

2 Likes

Little request for sleep scoring - option to add extra horizontal lines, for example +/- 35uV ? These are useful for checking that the amplitude of waves/deflections reach various criteria. Or is this already possible somehow?

Emily

Hi Emily,

Could you post an example of what you would like to get (screen capture or image a manual of from another program for instance)?

Otherwise you could run a threshold detection first (process Events > Detect events above threshold), you would get markers wherever the signals passes a certain level on a given electrode.

Francois

Hi Francois!

I drew you a picture (top). Just a couple of guide lines (parallel to the y-axis 0 line at a user-defined uV) would go along way, as we tend to eyeball it rapidly and make a judgement about how much of a screen has above-threshold waves. I will play with the thresholding thing to see if that's a useful indication as well.

That was so much fun I thought of some other sleep scoring features to illustrate on my sleep scoring wish list. In retrospect, #3 with multiple filters would be my top choice.

https://photos.app.goo.gl/UCaMz1xC5y7yFagA6

Regarding the F6 to jump 30s forward, can there be a jump back version too? We often have to hop about and I keep falling off the 30s jumps and making my stage markers overlap instead of replace each other.

Best regards,

Emily

1 Like

This is the cutest wish list I've ever received :slight_smile:

I added your requests to our infinite to-do list (https://neuroimage.usc.edu/brainstorm/Next#Recordings) and will keep your drawings on the side.

  1. For your initial request: I will not work on this in the immediate future. Hopefully the threshold detection will work for you. You can also add horizontal lines to the figure (in the new display options menu at the bottom-right of the figure).
  2. Ruler: This should not be too complicated to code. In the meantime, have to noticed that if you select a time window, it shows at the bottom the duration and min/max values? If one or several channels are selected, it gets the min/max only from the selected electrodes.
  3. Counting: this is probably easier to compute from a script, as it will probably be difficult to generalize. Or maybe there is something that can be done with the processes that combine events: Combine stim/response, Remove simultaneous, Group by time. Maybe they don't work with extended events, but I could fix that. The idea would be create new categories of events with the list of 20 or 30s pages that contain your marker of interest. Does it make sense? Let me know if I should do any adaptation to these processes for this purpose.
  4. Splitting a signal in multiple frequency bands: this is something that has been requested a few times before. One solution would be to add an extra option for filtering each signal in the montage editor (similarly to the color: https://neuroimage.usc.edu/brainstorm/Tutorials/MontageEditor#Custom_montage), this would allow to display as many frequency bands as you want from one of several sensors. Will work on it at some point, but don't know when...
  5. Could you send me pointers or code for one (or more) detectors you'd like to see in Brainstorm?

Thank you for all these nice suggestions!
Francois

1 Like

Hi Emily,

Item #3 of your wish list is finally coded:
https://neuroimage.usc.edu/brainstorm/Tutorials/MontageEditor#Custom_montage
https://github.com/brainstorm-tools/brainstorm3/commit/d0b5a90a52db31f6ac8ef90d521eca1d206ac4c6

We can keep on working on the other points.
Please keep us posted with all your great ideas!

Cheers
Francois

Oooo I somehow missed the notification for this! It looks amazing - can't wait to try it. Especially as I just spent 4 days filtering data multiple ways :slight_smile:

Thanks, Francois!

Emily

The new ability to filter different channels at different frequencies through the montage is awesome. I had been doing this by running multiple iterations of filtering through the process menu, which was very slow.

Erin

2 Likes

I confirm #3 solution is really great. Thanks, Francois! Is there an easy way to re-lable the lines using the montage editor?

Emily

What do you mean by re-label?
With these "custom" montages, you can already set the name of each line to whatever you want.

Oh :blush: