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

Get annotations from TRC file #12455

Open
RojanAsl opened this issue Feb 20, 2024 · 2 comments
Open

Get annotations from TRC file #12455

RojanAsl opened this issue Feb 20, 2024 · 2 comments
Labels

Comments

@RojanAsl
Copy link

RojanAsl commented Feb 20, 2024

Proposed documentation enhancement

Hi,

I am working with Micromed data, in which I only have access to TRC and video files.
Is there a way I can extract the annotations along with their timestamps from the TRC file?

Thanks in advance!

@RojanAsl RojanAsl added the DOC label Feb 20, 2024
Copy link

welcome bot commented Feb 20, 2024

Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴

@RojanAsl RojanAsl changed the title Get annotations from EDF file Get annotations from TRC file Feb 21, 2024
@mscheltienne
Copy link
Member

mscheltienne commented Feb 27, 2024

Hello, this is related to #10524
At the moment, I don't believe MNE offers a TRC (micromed) reader. You can look into neo (https://pypi.org/project/neo/) to read this file format and then you can create MNE's datastructure from the loaded file.

I did so a couple of days ago, this is the code snippet I ended up with:

import numpy as np
from mne import create_info
from mne.io import RawArray
from neo.io import MicromedIO


fname = r"/home/scheltie/Downloads/micromed_data.TRC"
reader = MicromedIO(fname)
data = reader.read()[0].segments[0].analogsignals[0]  # (n_samples, n_channels), 31 chs
sfreq = reader.get_signal_sampling_rate()
ch_names = [elt[0] for elt in reader.header["signal_channels"]]
info = create_info(ch_names, sfreq, "eeg")
raw = RawArray(np.array(data.T), info)

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

No branches or pull requests

2 participants