kylemath / pyoptical

Imagent optical imaging interface to MNE loading
MIT License
4 stars 1 forks source link

load in source detector locations and compute channel locations #9

Closed kylemath closed 4 years ago

kylemath commented 4 years ago

need to load in source detector locations from .elp file use .mtg file to find used locations get their location and write them into the MNE raw object

raw.info['dig'] - has the .elp information in it raw.info['chs'] - has a 3d location for each channel

kylemath commented 4 years ago
Screen Shot 2020-04-17 at 12 43 28 PM

These are the same locations that we would digitize into the .elp file for each participant

kylemath commented 4 years ago

>>> raw_intensity.info['chs'][0]
{
'loc': array([-4.01877067e-02,  4.46422957e-02,  1.23576592e-01, -4.16132047e-02,
        2.67997753e-02,  1.29904394e-01, -3.76195887e-02,  6.32285163e-02,
        1.15728028e-01,  7.60000000e+02,             nan,             nan]), 
'unit_mul': 0, 
'range': 1.0, 
'cal': 1.0, 
'kind': 1100 (FIFFV_FNIRS_CH), 
'coil_type': 302 (FIFFV_COIL_FNIRS_RAW), 
'unit': 107 (FIFF_UNIT_V), 
'coord_frame': 0 (FIFFV_COORD_UNKNOWN), 
'ch_name': 'S1_D1 760', 
'scanno': 1, 
'logno': 1}```

        # Store channel, source, and detector locations
        # The channel location is stored in the first 3 entries of loc.
        # The source location is stored in the second 3 entries of loc.
        # The detector location is stored in the third 3 entries of loc.
        # NIRx NIRSite uses MNI coordinates.
kylemath commented 4 years ago

good start to this in https://github.com/kylemath/pyoptical/pull/12, still working

kylemath commented 4 years ago

here is the pull request in which they made the nirx loader: https://github.com/mne-tools/mne-python/pull/6674/files/b02600eba9e46d7b6738153d3753c4bfbc447d44

kylemath commented 4 years ago

Note that the meg and fnirs parameters of pick_types() accept strings as well as boolean values, to allow selecting only magnetometer or gradiometer channels (via meg='mag' or meg='grad') or to pick only oxyhemoglobin or deoxyhemoglobin channels (via fnirs='hbo' or fnirs='hbr', respectively).

-https://mne.tools/dev/auto_tutorials/intro/plot_30_info.html#sphx-glr-auto-tutorials-intro-plot-30-info-py

kylemath commented 4 years ago

A third way to pick channels from an Info object is to apply regular expression matching to the channel names using mne.pick_channels_regexp(). Here the ^ represents the beginning of the string and . character matches any single character, so both EEG and EOG channels will be selected:

print(mne.pick_channels_regexp(info['ch_names'], '^E.G'))
kylemath commented 4 years ago

gonna keep this open so we can test on the head plots

kylemath commented 4 years ago

@kuziekj - i think you've already solved this but check this out: https://mne.tools/dev/overview/implementation.html#dig-formats

kylemath commented 4 years ago

https://mne.tools/dev/auto_tutorials/source-modeling/plot_source_alignment.html#plot-source-alignment

kylemath commented 4 years ago

https://mne.tools/dev/auto_examples/visualization/plot_montage.html https://mne.tools/dev/auto_examples/visualization/plot_eeg_on_scalp.html

kuziekj commented 4 years ago

continuing discussion in https://github.com/kylemath/pyoptical/issues/16