Skip to content

ENH: improving high resolution CT iEEG electrode localization example #11610

@mmagnuski

Description

@mmagnuski

Hi,

@alexrockhill
I have some questions and ideas for the high-res CT iEEG localization example.

First of all, since we already have head-MR and CT-MRI transforms (see the main iEEG localization example), can we create head-CT transform out of these instead of finding CT fiducials in freeview (as suggested in the hi-res CT example)? I tried to create head-CT transform by first inverting the CT-MRI affine to get MRI-CT transformation and then computing the dot product between head-MRI and MRI-CT:

# subj_trans is the head->MRI tranform obtained as in the main iEEG example (transforming fsaverage fiducials to individual MRI)
# reg_affine is the CT->MRI transform
mri_ct_trans = np.linalg.inv(reg_affine)
head_ct = subj_trans['trans'] @ mri_ct_trans
# (I then turn the head_ct matrix to a Transform instance)

but for some reason, after marking a few contacts in GUI and using the mne.transforms.apply_volume_registration_points as in the high-res CT example, all channel positions are NaNed-out in the info. This happens irrespective of channels selection (selecting only the channels in the info that were marked in the GUI) or replacing any NaNs with zeros in info['chs'][idx]['loc']).

BTW - I discovered that mne.transforms.apply_volume_registration_points modifies info in-place. I don't think it should do that.

One thing that would be great to clarify in the example would be the choice between using an adequate head-CT and an identity matrix. It is mentioned that one could fake the head-CT transform as identity matrix but the drawbacks are not dicsussed. I wasn't sure if not having the channel positions in head space would not cause problems at some point later so I didn't use the identity matrix. On the other hand creating the head-CT transform based on fiducials identified by hand sounds error-prone.

I'll post other issues/ideas in a separate post here today.

PS. I am waiting for a green light to share the CT with micro-channels, but it should be possible. Both MRI and CT would be de-faced, but I could share a CT-MRI transformation along with these files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions