Skip to content

Commit

Permalink
Coreg with epoch files.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgohil8 committed Aug 31, 2024
1 parent c474078 commit 053633a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions osl/source_recon/rhino/coreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ def coreg(
# -------------------------------------------------------------------------------------------------------------------
# Copy fif_file to new file for modification, and (optionally) changes dev_head_t to equal dev_ctf_t in fif file info

if fif_file[-7:] == "raw.fif":
if "raw.fif" in fif_file:
raw = read_raw(fif_file)
elif fif_file[-10:] == "epochs.fif":
elif "epo.fif" in fif_file:
raw = read_epochs(fif_file)
else:
raise ValueError("Invalid fif file, needs to be a *raw.fif or a *epochs.fif file")
raise ValueError("Invalid fif file, needs to be a *-raw.fif or a *-epo.fif file")
info = raw.info

if use_dev_ctf_t:
Expand Down
12 changes: 9 additions & 3 deletions osl/source_recon/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ def compute_surfaces(
def coregister(
outdir,
subject,
preproc_file,
smri_file,
preproc_file=None,
epoch_file=None,
use_nose=True,
use_headshape=True,
already_coregistered=False,
Expand All @@ -267,11 +268,13 @@ def coregister(
Path to where to output the source reconstruction files.
subject : str
Subject name/id.
preproc_file : str
Path to the preprocessed fif file.
smri_file : str
Path to the T1 weighted structural MRI file to use in source
reconstruction.
preproc_file : str, optional
Path to the preprocessed fif file.
epoch_file : str, optional
Path to the preprocessed epochs fif file.
use_nose : bool, optional
Should we use the nose in the coregistration?
use_headshape : bool, optional
Expand All @@ -291,6 +294,9 @@ def coregister(
reportdir : str, optional
Path to report directory.
"""
if preproc_file is None:
preproc_file = epoch_file

# Run coregistration
rhino.coreg(
fif_file=preproc_file,
Expand Down

0 comments on commit 053633a

Please sign in to comment.