Skip to content

Conversation

@woolrich
Copy link
Collaborator

@woolrich woolrich commented Oct 6, 2025

Added bilateral beamformer
Changed bem_display to show bilateral pairs
Changed bem_display to be a pass through call to coreg_display
Changed Beamformer report to include a bem_display
Some docs might need additional updating to make folks aware of existence of bilateral beamformer

Example run using Wakeman Henson:

import os.path as op

from osl_ephys import utils, source_recon, preprocessing
from osl_ephys.source_recon import beamforming, parcellation

setup dirs

data_dir = '/Users/woolrich/yale_workshop/3.SourceRecon/wake_hen'
recon_dir = op.join(data_dir, "recon")
out_dir = op.join(data_dir, "recon", "glm")

sub_name = "sub{sub_num}"
smri_files_path = op.join(data_dir, sub_name, "anatomy", "highres001.nii.gz")
smri_files = utils.Study(smri_files_path).get()

fif files

subject = "{subject}"
preproc_fif_files_path = op.join(data_dir, subject + "_meg", subject + "_meg_preproc_raw.fif")
preproc_fif_files = utils.Study(preproc_fif_files_path)
subjects = preproc_fif_files.fields['subject']
preproc_fif_files = preproc_fif_files.get()

config = """
source_recon:
- extract_polhemus_from_info: {}
- compute_surfaces:
include_nose: false
- coregister:
use_nose: false
use_headshape: false
- forward_model:
model: Single Layer
gridstep: 10
- beamform_and_parcellate:
freq_range: [3, 20]
chantypes: [mag, grad]
rank: {meg: 55}
use_bilateral_pairs: True
bilateral_tol: 5
parcellation_file: Glasser52_binary_space-MNI152NLin6_res-8x8x8.nii.gz
method: spatial_basis
orthogonalisation: None
"""

Run source batch

source_recon.run_src_batch(
config,
outdir=recon_dir,
subjects=subjects,
preproc_files=preproc_fif_files,
smri_files=smri_files,
)

@woolrich woolrich requested review from cgohil8 and matsvanes October 6, 2025 16:18
@matsvanes
Copy link
Collaborator

Looking good so far @woolrich. Can you add an example or FAQ to guide the user regarding parameter settings? Do you have some minimal code for us to test the functions?

@woolrich
Copy link
Collaborator Author

woolrich commented Oct 7, 2025

Looking good so far @woolrich. Can you add an example or FAQ to guide the user regarding parameter settings? Do you have some minimal code for us to test the functions?

I pasted some example code in the first comment above.
Have a go at running and let me know.

Wrt "an example", where would you recommend putting that?

@woolrich
Copy link
Collaborator Author

woolrich commented Oct 10, 2025

Added patch beamformer

Example call:

config = """
source_recon:
- beamform_and_parcellate:
freq_range: [3, 20]
chantypes: [mag, grad]
rank: {meg: 55}
dipole_patches_file: Glasser52_binary_space-MNI152NLin6_res-8x8x8.nii.gz
group_patches: True
parcellation_file: Glasser52_binary_space-MNI152NLin6_res-8x8x8.nii.gz
method: spatial_basis
orthogonalisation: None
"""
source_recon.run_src_batch(
config,
outdir=recon_dir,
subjects=subjects,
preproc_files=preproc_fif_files,
smri_files=smri_files,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants