Yep. Sorry for the confusion.
This is for FieldLine OPM recordings with a fixed helmet. Basically, my goal is to source localization with my data, but for that I need a successful coordinate frame registration inside MNE. For example, I think that I need the sensor locations in the head coordinate frame, and to check that alignment using viz.plot_alignment. However, right now the alignment looks bad, and I think that is due to coordinate frame registration issues.
Currently, FieldLine software outputs sensor locations in āmegā (i.e., helmet) coordinate system, and does not have an integrated registration process. That means that there is no meg-head coordinate transform in the raw fif file.
I read in the FieldLine fif file as follows:
- fifFile = os.path.join(dataDir, subjectID, scanDate, āmegā, fifName)
- raw = mne.io.read_raw_fif(fifFile, preload=True)
I then visualize the sensor locations wrt the fsaverage brain:
- kwargs = dict(eeg=False, coord_frame=āmegā, show_axes=True, verbose=True, trans=āfsaverageā, subject=āfsaverageā, subjects_dir=subjects_dir, surfaces=(āheadā, āpialā))
- mne.viz.plot_alignment(defaultPosRaw.info, meg=āsensorsā, **kwargs)
I get the same (mis-aligned) result whether I set coord_frame to āmegā or āheadā. I think that is because the raw object probably has an identity matrix for the meg-head transform, as a default.
As I mentioned, FieldLineās prototype acq software does not include a meg-head registration step. I created my own meg-head transform based on Kinect digitization of the head in the OPM sensor array, and save it as a .npy file (in a different loooong script). Then, I load that transform into MNE python:
- transMatrix = np.load(os.path.join(procDataDir, subjectID, scanDate, ādigiā, āmeg_head_trans.npyā))
- trans = mne.transforms.Transform(fro=āmegā, to=āheadā, trans=transMatrix)
I would like to add this transform to the raw object, so that I can check my registration using plot_aligment, and then move onto localization, as per the OPM example on the MNE website.
I hope that is helpful, but please let me know if there are outstanding questions. Looking forward to your guidance.
Best,
Tim.