Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to import BrainVision files without marker types #12608

Open
cbrnr opened this issue May 10, 2024 · 5 comments
Open

Add option to import BrainVision files without marker types #12608

cbrnr opened this issue May 10, 2024 · 5 comments

Comments

@cbrnr
Copy link
Contributor

cbrnr commented May 10, 2024

BrainVision markers (stored in .vmrk files) consist of the following fields (the last field is optional):

Mk<number>=<Type>,<Description>,<Position>,<Size>,<Channel>,<Date>

For example:

Mk2=Comment,bad_segment,251,391,0

This is a marker as exported via raw.export() using pybv from an annotation with the description bad_segment. Since the Type field must be present, pybv uses Comment by default.

However, when importing the exported BrainVision file, annotations are created from markers, and the description will be pieced together as <Type>/<Description>, i.e. Comment/bad_segment in this case.

This makes the round-trip inconsistent, because I'd like to recover the original annotation descriptions from markers. This simply means that I'd need an option for read_raw_brainvision() to ignore the Type fields when constructing annotations. This would require a new parameter, e.g. ignore_marker_types=False (or something along these lines).

Would that be an addition that everyone is OK with (pinging @sappelhoff explicitly as one of the pybv maintainers)?

@hoechenberger
Copy link
Member

ignore_marker_types=False

It could make sense to support a list of strings here too, wdyt?

@cbrnr
Copy link
Contributor Author

cbrnr commented May 12, 2024

It could make sense to support a list of strings here too, wdyt?

You mean to ignore only specific types, e.g. ignore_marker_types=["Comment", "Stimulus"]? I'm not sure how often this is needed, but of course it would be no problem to implement it. I was thinking of just one use case where ignoring types could be needed, namely importing a file that was exported by MNE, in which case all markers will have the Comment type. Since this is a bit arbitrary, it makes sense to remove those "artificial" types on import. In contrast, "native" BrainVision files (e.g. those created by BrainVision Analyzer) will contain various marker types and descriptions in general, so I'd want to keep those (at least by default).

@cbrnr cbrnr changed the title Add option to import BrainVision files without type in markers Add option to import BrainVision files without marker types May 13, 2024
@drammock
Copy link
Member

You mean to ignore only specific types, e.g. ignore_marker_types=["Comment", "Stimulus"]? I'm not sure how often this is needed

Seems to me like there's clear motivation for "ignore marker types when they're all identical" and uncertain motivation for "let me specify which one(s) to ignore". I'd suggest to assume YAGNI on the second one, and we can overload the param later (to accept list-likes) if folks ask for it.

I'd also consider something like an "always/auto/never" pattern, where "auto" means "ignore them IFF they're all identical". But a simple boolean seems adequate for now --- again, we can update the param later to give more flexibility if folks ask for it.

@sappelhoff
Copy link
Member

sounds good to me, and agreed with YAGNI for the second suggestion.

@hoechenberger
Copy link
Member

agreed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants