Skip to content

Add process to merge adjacent event into a continious event - #945

Open
Edouard2laire wants to merge 2 commits into
brainstorm-tools:masterfrom
Edouard2laire:evt_merge
Open

Add process to merge adjacent event into a continious event#945
Edouard2laire wants to merge 2 commits into
brainstorm-tools:masterfrom
Edouard2laire:evt_merge

Conversation

@Edouard2laire

@Edouard2laire Edouard2laire commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

As discussed in the forum, this process is here to merge consecutive adjacent events into larger continuous events.

Additionnaly:

  • Allows users to remove parts of the events affected by artifacts.
  • Allows filtering shorter epochs (events with less than a specified duration)

Here is the GUI:

image

Do you want me to put the other process to classify events in this PR or submit another one?

@rcassani

Copy link
Copy Markdown
Member

Context: https://neuroimage.usc.edu/forums/t/merge-and-combine-events/57939

Which of the two is being solved with this PR?

@Edouard2laire

Edouard2laire commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

The first one:

Is there a way to merge consecutive events ? Sleep stage in my data is marked in epochs of 30s. So I have events at 30s, 60s, 90s … all with a duration of 30s. Is there a way to generate an event, in this case starting at 30s, lasting 90s (3 epochs) ?

I am currently cleaning the code I have for the second one, Let me know if you want an example file

@rcassani

Copy link
Copy Markdown
Member

In the forum, I provided a step-by-step solution for this with the current event processes

If needed, I can add a modification in the current "Merge overlapping extended events" to remove the one-sample issue, e.g., a checkbox to allow merging consecutive, 0-sample gap, extended events

For changes like this, discussing on the forum first lets us agree on the approach before any code

@Edouard2laire

Edouard2laire commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

In the forum, I provided a step-by-step solution for this with the current event processes

The proposed steps are quite complicated, whereas this is only one process which also ensures that there is no bad segment in the continuous event and ensures a minimum duration for the segment.

The idea is that the user (me in this case) would then segment the file based on the continuous event to then analyse each segment individually. Kind og like for MEG we do 'generate stable head'; but here, with a stable period for each sleep stage.

If needed, I can add a modification in the current "Merge overlapping extended events" to remove the one-sample issue, e.g., a checkbox to allow merging consecutive, 0-sample gap, extended events

Could be nice, but is it possible to remove bad period / only merge if the created events is longuer than a desired duration ?

For changes like this, discussing on the forum first lets us agree on the approach before any code

Yes i agree. Here i went directly to code as the code was already written from a long time ago; i just cleanned it. If it's too specific for brainstorm; i can always move it to a custom plugin now that it's clean :)

The cleaning of the other process involves very similar code so it was nice to start by this one :)

Regars,
Edouard

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

Successfully merging this pull request may close these issues.

2 participants