lina-usc / pylossless

🧠 EEG Processing pipeline that annotates continuous data
https://pylossless.readthedocs.io/en/latest/
MIT License
20 stars 8 forks source link

Fiducials not preserved by bidsification #20

Open christian-oreilly opened 1 year ago

christian-oreilly commented 1 year ago

The bidsification of EEG recordings using PyLossless does not preserve the information about the fiducials. It is not clear if the issue is in PyLossless per se or mne-bids.

Example:

import pylossless as ll

path = ('/Users/christian/Library/CloudStorage/OneDrive-UniversityofSouthCarolina/Data/'
        'ABC/PASSAGE_EEG/ABC1020.SM.passage.vhdr')

def import_fct(path_in):
    return mne.io.read_raw_brainvision(path_in, preload=True), None, None

import_args = [{"path_in": path}]
bids_path_args = [{'subject': "1020", 'session': '01', "task": "narative"}]

raw1 = mne.io.read_raw_brainvision(path, preload=True)

bids_paths = ll.bids.convert_dataset_to_bids(import_fct, import_args, bids_path_args, 
                                                 bids_root=path_eegp / "bids_dataset", overwrite=True)

raw2 = mne_bids.read_raw_bids(bids_paths[0])

Then

print(raw1.info["dig"][:4])

gives

[<DigPoint |        LPA : (-94.3, 0.0, 0.0) mm      : head frame>,
 <DigPoint |     Nasion : (0.0, 94.3, 0.0) mm       : head frame>,
 <DigPoint |        RPA : (94.3, 0.0, 0.0) mm       : head frame>,
 <DigPoint |     EEG #1 : (-29.4, 90.4, 0.0) mm     : head frame>]

whereas

print(raw2.info["dig"][:4])

gives

[<DigPoint |        LPA : (nan, nan, nan) mm        : head frame>,
 <DigPoint |     Nasion : (nan, nan, nan) mm        : head frame>,
 <DigPoint |        RPA : (nan, nan, nan) mm        : head frame>,
 <DigPoint |     EEG #1 : (-29.4, 90.4, 0.0) mm     : head frame>]

To check and to file the issue with mne-bids if the error is on their side.

scott-huberty commented 1 year ago

@christian-oreilly I am not certain, but maybe the mne and mne-bids functions mentioned below could be helpful?

From this mne-bids page on the latest release:

mne_bids.update_anat_landmarks() can now directly work with fiducials saved from the MNE-Python coregistration GUI or mne.io.write_fiducials(), by Richard Höchenberger (#977)