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

Bug/ieeg/coords #1051

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions mne_bids/tests/data/ieeg_bids/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
References
----------
Appelhoff, S., Sanderson, M., Brooks, T., Vliet, M., Quentin, R., Holdgraf, C., Chaumon, M., Mikulan, E., Tavabi, K., Höchenberger, R., Welke, D., Brunner, C., Rockhill, A., Larson, E., Gramfort, A. and Jas, M. (2019). MNE-BIDS: Organizing electrophysiological data into the BIDS format and facilitating their analysis. Journal of Open Source Software 4: (1896). https://doi.org/10.21105/joss.01896

Holdgraf, C., Appelhoff, S., Bickel, S., Bouchard, K., D'Ambrosio, S., David, O., … Hermes, D. (2019). iEEG-BIDS, extending the Brain Imaging Data Structure specification to human intracranial electrophysiology. Scientific Data, 6, 102. https://doi.org/10.1038/s41597-019-0105-7

8 changes: 8 additions & 0 deletions mne_bids/tests/data/ieeg_bids/dataset_description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Name": " ",
"BIDSVersion": "1.6.0",
"DatasetType": "raw",
"Authors": [
"[Unspecified]"
]
}
24 changes: 24 additions & 0 deletions mne_bids/tests/data/ieeg_bids/participants.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"participant_id": {
"Description": "Unique participant identifier"
},
"age": {
"Description": "Age of the participant at time of testing",
"Units": "years"
},
"sex": {
"Description": "Biological sex of the participant",
"Levels": {
"F": "female",
"M": "male"
}
},
"hand": {
"Description": "Handedness of the participant",
"Levels": {
"R": "right",
"L": "left",
"A": "ambidextrous"
}
}
}
2 changes: 2 additions & 0 deletions mne_bids/tests/data/ieeg_bids/participants.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
participant_id age sex hand
sub-01 n/a n/a n/a
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"iEEGCoordinateSystem": "MNI152NLin2009bAsym",
"iEEGCoordinateSystemDescription": "mni",
"iEEGCoordinateUnits": "mm"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name x y z type
ECOG_0 22.5 -38.5 83.0 ECOG
ECOG_1 28.0 -29.0 81.5 ECOG
ECOG_2 32.0 -19.5 78.0 ECOG
ECOG_3 37.0 -10.5 73.5 ECOG
ECOG_4 40.5 -2.0 69.5 ECOG
ECOG_5 42.5 6.5 63.0 ECOG
ECOG_6 45.5 13.5 55.5 ECOG
ECOG_7 48.0 22.5 48.5 ECOG
ECOG_8 45.5 13.5 55.5 ECOG
ECOG_9 48.0 22.5 48.5 ECOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name type units low_cutoff high_cutoff description sampling_frequency status status_description
ECOG_0 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_1 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_2 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_3 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_4 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_5 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_6 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_7 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_8 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
ECOG_9 ECOG µV 0.0 500.0 Electrocorticography 1000.0 good n/a
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"TaskName": "audiovisual",
"Manufacturer": "BrainProducts",
"PowerLineFrequency": "n/a",
"SamplingFrequency": 1000.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 0.999,
"RecordingType": "continuous",
"iEEGReference": "n/a",
"ECOGChannelCount": 10,
"SEEGChannelCount": 0,
"EEGChannelCount": 0,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 0,
"TriggerChannelCount": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Brain Vision Data Exchange Header File Version 1.0
; Written using pybv 0.6.0

[Common Infos]
Codepage=UTF-8
DataFile=sub-01_ses-01_task-audiovisual_run-01_ieeg.eeg
MarkerFile=sub-01_ses-01_task-audiovisual_run-01_ieeg.vmrk
DataFormat=BINARY
; Data orientation: MULTIPLEXED=ch1,pt1, ch2,pt1 ...
DataOrientation=MULTIPLEXED
NumberOfChannels=10
; Sampling interval in microseconds
SamplingInterval=1000.0

[Binary Infos]
BinaryFormat=IEEE_FLOAT_32

[Channel Infos]
; Each entry: Ch<Channel number>=<Name>,<Reference channel name>,
; <Resolution in "Unit">,<Unit>, Future extensions..
; Fields are delimited by commas, some fields might be omitted (empty).
; Commas in channel names are coded as "\1".
Ch1=ECOG_0,,0.1,µV
Ch2=ECOG_1,,0.1,µV
Ch3=ECOG_2,,0.1,µV
Ch4=ECOG_3,,0.1,µV
Ch5=ECOG_4,,0.1,µV
Ch6=ECOG_5,,0.1,µV
Ch7=ECOG_6,,0.1,µV
Ch8=ECOG_7,,0.1,µV
Ch9=ECOG_8,,0.1,µV
Ch10=ECOG_9,,0.1,µV

[Comment]

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Brain Vision Data Exchange Marker File, Version 1.0
;Exported using pybv 0.6.0

[Common Infos]
Codepage=UTF-8
DataFile=sub-01_ses-01_task-audiovisual_run-01_ieeg.eeg

[Marker Infos]
; Each entry: Mk<Marker number>=<Type>,<Description>,<Position in data points>,
; <Size in data points>, <Channel number (0 = marker is related to all channels)>
; <Date (YYYYMMDDhhmmssuuuuuu)>
; Fields are delimited by commas, some fields might be omitted (empty).
; Commas in type or description text are coded as "\1".
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
filename acq_time
ieeg/sub-01_ses-01_task-audiovisual_run-01_ieeg.vhdr n/a
15 changes: 15 additions & 0 deletions mne_bids/tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,3 +1335,18 @@ def test_gsr_and_temp_reading():
raw = read_raw_bids(bids_path)
assert raw.get_channel_types(['GSR']) == ['gsr']
assert raw.get_channel_types(['Temperature']) == ['temperature']


def test_read_ieeg_coord_frame():
sappelhoff marked this conversation as resolved.
Show resolved Hide resolved
"""Ensure that the iEEG coordinate frame is read correctly."""
bids_path = BIDSPath(
subject="01",
session="01",
task="audiovisual",
run="01",
root=Path(__file__).parent / "data" / "ieeg_bids",
)
raw_read = read_raw_bids(bids_path)

coord_frame = raw_read.get_montage().get_positions()["coord_frame"]
assert coord_frame == "MNI152NLin2009bAsym"