Closed alexrockhill closed 3 years ago
Ok I think a reasonable first PR would be to load in the CT and the MR, resampling the CT to MR space if needed and taking in some channel names from a raw
object and then allow the user to move around and mark electrodes and return the positions.
Ok I think a reasonable first PR would be to load in the CT and the MR, resampling the CT to MR space if needed and taking in some channel names from a raw object and then allow the user to move around and mark electrodes and return the positions.
Let's not include resampling in the GUI. This is easily scripted and done once ahead of time. The GUI I think should load a T1 and the CT-resampled-to-T1-space.
Do you have an idea of the API? I'm thinking something like:
def electrode_location_gui(info, subject=None, ct='CT_aligned.mgz', mri='T1.mgz', subjects_dir=None)
thus the common use case would be to resample your CT and save it to SUBJECTS_DIR/SUBJECT/CT_aligned.mgz
and then just do:
raw = mne.io.read_raw_fif(...)
mne.gui.electrode_location_gui(raw.info, 'whoever')
and under the hood if subject
is provided, we use f'{subjects_dir}/{subject}/{ct}'
and f'{subjects_dir}/{subject}/{t1}'
.
... and instead of returning the localized positions, it can just set info['chs']['loc']
directly. That way at the end if you do raw.save(...)
that instance will have the correct locations.
People can always use raw.get_montage
if they want to see the locations they set.
what do you think about putting such a GUI while at it's infancy in a dedicated package where contributing guidelines are less strict. Should allow you to iterate faster and accept mistakes more easily?
what do you think about putting such a GUI while at it's infancy in a dedicated package
The current state is actually already better than this -- it already lives in a dedicated package (img_pipe) that has been pretty well manually tested. So one important gain by / motivation for moving to MNE I think is following the full contributing guidelines (TDD included)
Do you have an idea of the API? I'm thinking something like:
def electrode_location_gui(info, subject=None, ct='CT_aligned.mgz', mri='T1.mgz', subjects_dir=None)
Sounds good to me except where is subject coming from if it's None?
subject=None
is just provided in case people don't want to use FreeSurfer volumes at all. In other words, if people pass full paths to ct
and mri
then subject
won't be used at all (so no need to provide it)
... but I'm okay with not supporting that use case right away
let's do a video call to discuss this ok?
Hmmm, yeah for the elec_img
PR I had it resample but then I thought it was leading down the wrong path with lots of coordinate transforms to do it in a coordinate frame other than surface RAS
@agramfort sure, let us know your availability in the iEEG GSoC discord channel and we'll coordinate there
The intracranial electrophysiology analysis pipeline could use a manual or semiautomated GUI to pick the locations of the electrode contacts based on a CT that has been aligned to the MR of that subject so that brain structures can be used to aid contact identification.
Basic Requirements:
raw
object and associate them with a location on the CT in MR (surface RAS) spaceAdvanced Requirements:
voxel_neighbors
) to speed up locationcc @larsoner