adam2392 / improve_icalabel

Repo for studying the improvements of ICA labeling
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Conversion of the MARA dataset #1

Open mscheltienne opened 2 years ago

mscheltienne commented 2 years ago

Hey @adam2392,

The conversion script is almost complete. Can you please run it and fix the last BIDS-related issue? You'll figure it out quicker than me.. From the ica_to_bids current directory (to load the function loader from mara_loader.py with the line below). https://github.com/adam2392/improve_icalabel/blob/f87e381b4fe23cf40294937455bbca9f4c3c9e97/mnestudy/ica_to_bids/mara.py#L10

Run the function convert with directory_in set as the fasor folder of the dataset (folder which contains all the .mat files). https://github.com/adam2392/improve_icalabel/blob/f87e381b4fe23cf40294937455bbca9f4c3c9e97/mnestudy/ica_to_bids/mara.py#L13-L22


The ICA, sources, and montage are correctly written (feel free to change the bids-path elements, I've used the key processing to differentiate, but it does not matter). The label of the components are not getting written and raises an error: https://github.com/adam2392/improve_icalabel/blob/f87e381b4fe23cf40294937455bbca9f4c3c9e97/mnestudy/ica_to_bids/mara.py#L49-L54

It's getting late, and I'm getting confused by the write_components_tsv function https://github.com/mne-tools/mne-icalabel/blob/ab090dd1ae0c8279f94594bdf634c69ac8bc09fb/mne_icalabel/annotation/bids.py#L10-L74

Does it write .tsv or .json?

mscheltienne commented 2 years ago

Also, for now, it writes the loaded montage for each file, but as I said today, it might actually be a template montage and it might be the same for all files. To be checked.

adam2392 commented 2 years ago

Sounds good.

I would just use what is in the Original dataset Right?

Or do you have a special dropbox folder where some preprocessing was done?

mscheltienne commented 2 years ago

Just the original dataset shared on the private repo.

adam2392 commented 2 years ago

https://github.com/mne-tools/mne-icalabel/blob/ab090dd1ae0c8279f94594bdf634c69ac8bc09fb/mne_icalabel/annotation/bids.py#L10-L74

This will write both a sidecar JSON explaining the columns, as well as a *channels.tsv for the ICA components.

adam2392 commented 2 years ago

I will try to get to it today before I leave. Sorry swamped.

Just released v0.2 tho!

mscheltienne commented 2 years ago

@adam2392 How to run the conversion:

  1. Set your current working directory to improve_icalabel/mnestudy/ica_to_bids.
  2. In a python interpreter:
from mara import convert

directory_in = r"path/to/fasor"
directory_out = r"path/to/where/you/want"

Where fasor is a folder in the MARA zip/tar/(whatever the compression was) file shared by Alexandre Gramfort.

IIRC, you'll see that those lines https://github.com/adam2392/improve_icalabel/blob/2b91b34b9e59baa05cca16170fccc5aad0bfcb5c/mnestudy/ica_to_bids/mara.py#L49-L54 are failing.