MCPcopy
hub / github.com/mne-tools/mne-python / scale_source_space

Function scale_source_space

mne/coreg.py:1237–1338  ·  view source on GitHub ↗

Scale a source space for an mri created with scale_mri(). Parameters ---------- subject_to : str Name of the scaled MRI subject (the destination mri subject). src_name : str Source space name. Can be a spacing parameter (e.g., ``'7'``, ``'ico4'``, ``'oct6'``)

(
    subject_to,
    src_name,
    subject_from=None,
    scale=None,
    subjects_dir=None,
    n_jobs=None,
    verbose=None,
)

Source from the content-addressed store, hash-verified

1235
1236@verbose
1237def scale_source_space(
1238 subject_to,
1239 src_name,
1240 subject_from=None,
1241 scale=None,
1242 subjects_dir=None,
1243 n_jobs=None,
1244 verbose=None,
1245):
1246 """Scale a source space for an mri created with scale_mri().
1247
1248 Parameters
1249 ----------
1250 subject_to : str
1251 Name of the scaled MRI subject (the destination mri subject).
1252 src_name : str
1253 Source space name. Can be a spacing parameter (e.g., ``'7'``,
1254 ``'ico4'``, ``'oct6'``) or a file name of a source space file relative
1255 to the bem directory; if the file name contains the subject name, it
1256 should be indicated as "{subject}" in ``src_name`` (e.g.,
1257 ``"{subject}-my_source_space-src.fif"``).
1258 subject_from : None | str
1259 The subject from which to read the source space. If None, subject_from
1260 is read from subject_to's config file.
1261 scale : None | float | array, shape = (3,)
1262 Scaling factor. Has to be specified if subjects_from is specified,
1263 otherwise it is read from subject_to's config file.
1264 subjects_dir : None | str
1265 Override the SUBJECTS_DIR environment variable.
1266 n_jobs : int
1267 Number of jobs to run in parallel if recomputing distances (only
1268 applies if scale is an array of length 3, and will not use more cores
1269 than there are source spaces).
1270 %(verbose)s
1271
1272 Notes
1273 -----
1274 When scaling volume source spaces, the source (vertex) locations are
1275 scaled, but the reference to the MRI volume is left unchanged. Transforms
1276 are updated so that source estimates can be plotted on the original MRI
1277 volume.
1278 """
1279 subjects_dir, subject_from, scale, uniform = _scale_params(
1280 subject_to, subject_from, scale, subjects_dir
1281 )
1282 # if n_params==1 scale is a scalar; if n_params==3 scale is a (3,) array
1283
1284 # find the source space file names
1285 if src_name.isdigit():
1286 spacing = src_name # spacing in mm
1287 src_pattern = src_fname
1288 else:
1289 match = re.match(r"(oct|ico|vol)-?(\d+)$", src_name)
1290 if match:
1291 spacing = "-".join(match.groups())
1292 src_pattern = src_fname
1293 else:
1294 spacing = None

Callers 2

test_scale_mriFunction · 0.90
scale_mriFunction · 0.85

Calls 6

_scale_paramsFunction · 0.85
read_source_spacesFunction · 0.85
_normalize_vectorsFunction · 0.85
write_source_spacesFunction · 0.85
infoMethod · 0.80

Tested by 1

test_scale_mriFunction · 0.72