- MNE version: 1.4.2
- operating system: Windows 10 / Ubuntu 22.04.2 LTS
Dear MNE community,
I am using mne/mne-bids to convert my data (from a TMSi SAGA in Poly5 format) to BIDS. Where I get stuck is in defining the electrode placements and properly document recorded fiducials.
We use an easycap with standard 10-20 electrode layout and have recorded lpa/rpa/nasion with Localite neuronavigation.
However, a couple of things tell me I am doing something wrong.
First, the electrodes are documented as being stored in CapTrak space, even though the standard montage in mne that I use should be defined in fsaverage space.
Second, when I try to register the electrodes to the individuals MRI, it does not look very good, not what I would expect after transforming from fsaverage to individual freesurfer space.
This is roughly what I did:
First, I import the standard 10-20 montage and add it to my raw data:
mont=mne.channels.make_standard_montage('standard_1020')
raw.set_montage(mont)
…and write it in bids format:
write_raw_bids(raw, bids_path=[my bids path],event_id=event_id,allow_preload=True,
format='BrainVision',overwrite=True)
I also add fiducials recorded with neuronavigation software to the T1w sidecar:
entries = {
'AnatomicalLandmarkCoordinates': {
'NAS': [],
'LPA': [],
'RPA': []
}
}
anat_nii=anat_folder.copy().update(extension='.nii.gz')
nif=nib.load(anat_nii)
nii_mat=nif.header.get_qform()
fiducial_voxels=fiducials
for idx,fid in enumerate(fiducials):
coord=np.append(np.reshape(fid, (3,-1)),[[1]],axis=0)
fiducial_voxels[idx,:]=np.reshape(np.linalg.lstsq(nii_mat,coord,rcond=0)[0][0:3],[1,3])
landmarks = mne.channels.make_dig_montage(lpa=fiducial_voxels[0],nasion=fiducial_voxels[1],rpa=fiducial_voxels[2],coord_frame="mri_voxel")
anat_folder = BIDSPath(subject=subject,session=session,datatype='anat',acquisition='lowres',suffix='T1w',root=bids_folder)
anat_sidecar = anat_folder.copy().update(extension='.json')
update_sidecar_json(bids_path=anat_sidecar, entries=entries)
update_anat_landmarks(anat_folder, landmarks)
I notice that fiducials have been added to the ‘coordsystem.json’ as well. I guess they are part of the standard monetage then?
Now, I try to read the bids formatted data and calculate transforms from standard electrode placements to the individual MRI:
raw=read_raw_bids(eeg_data)
trans=get_head_mri_trans(eeg_data,
t1_bids_path=t1_data,
fs_subject=subject,
fs_subjects_dir=fsdir)
…and plot the results:
fig = mne.viz.plot_alignment(
raw.info,
trans=trans,
subject=subject,
subjects_dir=fsdir,
show_axes=True,
dig='fiducials',
mri_fiducials=True,
coord_frame="mri",
)
And this is the result:
Is there anthing obviously wrong with my approach or are the results to be expected?
Any help is much appreciated!