Event duration AnyWave

Dear Francois,

brainstorm already reads in AnyWave markerfiles. Can you enable that it also reads AnyWave events with duration!

Thanks in advance!
Marcel

Please share an example file.

Like this?
https://github.com/brainstorm-tools/brainstorm3/commit/6edf84336478770a2c801914e2cef6856c8dbe82

Dear Francois,

some time ago you implemented the use of channel specific markers with duration.
Now I can mark events with duration in brainstorm, but it looks like they are not channel specific. Is this observation correct? Is there a way to export channel specific markers with duration outside brainstorm?

Best regards,
Marcel

I learned again from the markers tutorial how to create channel specific markers with duration. For those who have the same questions. You can find the answer in the paragraph 'display modes'.

https://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers

Yes, you can create channel-specific events.
But there is no easy way to "export" them outside of Brainstorm. The easiest solution is maybe to access them directly from the data...mat file in which they are stored:
https://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers#On_the_hard_drive

Dear Francois,

I would like to import channel specific markers from AnyWave into brainstorm. However, they are not recognized as channel specific markers with duration. Is it possible that you help me to import them into brainstorm correctly and optimally also make it possible to export them as AnyWave files again?

Thanks in advance!
Marcel

grafik
grafik

Hi Marcel,

I updated the AnyWave marker file reader: IO: Updated AnyWave marker file reader · brainstorm-tools/brainstorm3@5c14f54 · GitHub

The changes includes correct interpretation of:

Please update Brainstorm, test it and let me know if it addresses the issue correctly.

Hi Francois,
the way those events are read it changed. However, the channel names for the markers disappeared completely now. There are also no lines which illustrate the event duration over the EEG traces. Can you keep it possible to toggle markers On and Off based on the channel in which they are marked? This was previously possible when there were different event type for each marker channel.

Thanks in advance!
Marcel

image

I guess I didn't understand clearly what you expected, plus it looks like what you have in your file doesn't match exactly the file format specification (why is there a comma between the channel name and the color?)
https://meg.univ-amu.fr/wiki/AnyWave:ADES#The_marker_file_.28.mrk.29

I am away for the next 2-3 weeks and can't handle any further modification now, so I reverted to the original function. I will fix this properly when I get back.
Update Brainstorm again to get back to the previous version.

In the meantime, please:

  • share an example file
  • describe exactly each of the changes you'd like to be implemented in the reader

Thanks

Reporting messages from @mheers sent by email:

One of the first issues that I see is, that markers with duration don’t show up in brainstorm as they should as soon as a window subselected channels is open. In the figure below I marked the ‘gamma_vis_duration’ in the marked read channel, but I do neither see duration bar, nor a channel specific marker next to the MEG traces. This works well, if just a single window is open (see below).

I was not aware that the additional comma causes problems. I received an example file including this comma, so we created our files the same way. But you are right, according to the file description there should be no comma. For the imported events it will be important that also the name for the maker-channel is visible and it will be extremely valuable, if I can sort the events not only by event name, but also by marker-channel. If that is not possible combing the event names with the marker-channel name could be an option.
Please find an example marker-file attached. If the comma causes problems, we can remove it.
MEG-LCMV-TC-PCA-FCD-PA01-sleep-Tr1.zip (45.5 KB)

The markers are visible only in the first figure, indeed.
In the first screen capture you posted, we can see the event represented on the top figure as an orange line overlapping with the signal. Because the signal is almost flat here, this is represented as a single line, very difficult to see.

There is no unexpected behavior here. I think you could improve the display by adjusting a bit the way you are reviewing these signals. The alternatives I could suggest:

If the comma causes problems, we can remove it.

I adjusted the code so that it does not cause any problem.
But yes, you should remove these unwanted commas, for staying as close as possible to the specification.

If you are not sure what is a space and what is a tab, there are text editors like Notepad++ that can show the non-printable characters:

There is another thing that looks weird in your file: the number of overlapping events. In this screen capture above, the first 4 events are almost completely overlapping. And there are 13 more below...
I guess you could not see that before in the Brainstorm window, because the duration value was improperly used, and in effect ignored.
image

For the imported events it will be important that also the name for the maker-channel is visible and it will be extremely valuable, if I can sort the events not only by event name, but also by marker-channel. If that is not possible combing the event names with the marker-channel name could be an option.

So for now, I will keep the existing logic of combining the marker name with the first channel available for this marker (according to the specification, there can be multiple channels for one event).

I re-implemented some of the changes that I posted and removed two weeks ago, so that the reader is more aligned with the file format specification, and keeps the colors from the marker file. The frequency is also added as a note. But the event names now include again the channel label.

We have issues with rebuilding the Brainstorm package at the moment, so please wait before updating Brainstorm and trying again. We'll let you know when the software is ready to be updated.
@PavanMagesh

@Francois @mheers Latest brainstorm packages are now available on the Downloads page.

Thank you for working on that, Francois! It seems like it imports the markers correctly now. I created a custom montage with lower numbers of channels. But still the markers, which should be channel specific, occure at the very top of the panel and not on top of the marker-channel. The selected marker should show up on top of the very first channel. I am using Matlab 2018b on a windows 10 system.

Best regards,
Marcel

This behavior happens when the channels mentioned in the events are not found.
I suspect that the labels of the channels in the channel file are not strictly identical to the labels in the .mrk file.

If after double-checking that the labels are identical you still get the same behavior, please share a short example file:

  • Import a short segment of recordings to the database (eg.23-25s from the file shown in your last screen capture)
  • Right-click on the imported file > File > Show in file explorer
  • Zip together: the channel file, the new imported file, and the corresponding .mrk file
  • Upload the .zip file somewhere and post the download link here

Thanks

Hi Francois,

you were right. The names of the channels in the channel file and in the marker file were not exactly the same. Now the markers with duration show up as they should. We also removed the comma in the marker-file.
I would like to review the markers in brainstorm and correct them visually. Can you make it possible that we export the corrected markers to an AnyWave markerfile again?
Here is an example of the correct AnyWave file, which I import into brainstorm: https://bwsyncandshare.kit.edu/s/gg4tpNosH5z8diZ

Thanks in advance for your help!
Marcel

Hi Marcel,

I've added an export in AnyWave format: https://github.com/brainstorm-tools/brainstorm3/commit/ea15d1a7781c0cdedec7eda5cf66b30799a9e4d0

Update Brainstorm to get this fix.
In the Record tab, select the event groups you want to export, use the menu "File > Export selected events" (or all events), select the output file format "AnyWave (*.mrk)".

Note that if you import an AnyWave marker file to Brainstorm, and then export it again to AnyWave, you might observe differences:

  • The "events values" integers are discarded when importing to Brainstorm, so the exported files would only have -1 in the second column
  • The channel names are added to the event labels when importing into Brainstorm, and not removed when exporting.

Please let me know if there is anything to fix here.

Hi Francois,

thank you for implementing these recent changes. There still seems to be a problem. When trying to export all or selected markers from brainstorm to AnyWave-markerfiles I get the following error:

Best regards,
Marcel

Uploading: grafik.png...
Uploading: error_AnyWave_export.png...
error_AnyWave_export

Oops... This is actually an error due to a bug in the code when IMPORTING the AnyWave events...

In this commit : https://github.com/brainstorm-tools/brainstorm3/commit/aa630524dabfbf3d3502a7a1d8d2a008e42137da

  • I fixed the import function: next time you import events from a .mrk file to Brainstorm, there won't be this error in the data structures
  • I fixed the export function: I added a test to fix the structure on the fly, so you don't have to re-import existing data files
  • I added a test when loading the recordings, so that when you double-click on the file for display of the signals, it should fix automatically the events structures in the link (and you should see a warning in the matlab command window: "BST> Fixed events structure: Transposed list of "channels".")

Please update Brainstorm, and try exporting again your .mrk file.

Sorry for all these errors, we'll get there...

Dear Francois,

I want to import events according to their occurence during different sleep stages. Sleep stages are marked as events with a duration of 30 s. Can you make it possible to classify events according their occurence during other events with duration? This would be very helpful!

Thanks a lot, if you can spare some time to implement this!