mne.viz.plot_alignment trans parameter

Hello

MNE version 1.1.1

in the documentation it is stated that whenever the “trans” parameter of mne.viz.plot_alignment (and other mne.vis.plot format functions) is None it will automatically asumes an identity matrix. but when trans is None the following error will occur:

ValueError: A head<->mri transformation matrix (trans) is required to plot head-dense surfaces in head coordinates, `trans=None` is not allowed

and when i pass the “fsaverage” as trans argument this error occurs:

RuntimeError: Could not find the transformation for fsaverage

i should note that i created the bem from terminal using “mri_watershed” command of freesurfer
and there is no .fif file in fsaverge directory and subdirectories.

my question is that what is the shape of trans so that i can make an identity matrix of it. or is there any way to get around this issue?
i am using fsaverage as a template for eeg data.

thank you so much for your time and attention
best wishes

i tried to get trans via:

nasion = np.array([ 5.27205792e-18,  8.60992398e-02, -4.01487349e-02])
lpa = np.array([-0.08609924, -0.        , -0.04014873])
rpa = np.array([ 0.08609924,  0.        , -0.04014873])
fiducials = {"nasion":nasion, "lpa":lpa, "rpa":rpa,}

coreg = mne.coreg.Coregistration(raw.info, "fsaverage", fiducials=fiducials)

which results in:

RuntimeError: No standard head model was found for subject fsaverage

ok :slight_smile:

i got the trans via:

trans = mne.transforms.Transform("head", "mri", trans=None)

are my “fro” and “to” parameters correct according to my application?

thanks so much in advance

you passed : coord_frame=‘auto’ and trans=None and it failed?

Alex

thank you for your time
i used the following code

import mne
sphere = mne.make_sphere_model(info=np_raw.info, r0='auto', head_radius='auto')
# VolVectorSourceEstimate(data)
src = mne.setup_volume_source_space(sphere=sphere, pos=10)
mne.viz.plot_alignment(
    np_raw.info, src=src, trans=None, coord_frame="auto")

and it returns this error:

ValueError: A head<->mri transformation matrix (trans) is required to plot a mri-coordinate source space in head coordinates, `trans=None` is not allowed

best wishes