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

Function _write_mri_config

mne/coreg.py:822–853  ·  view source on GitHub ↗

Write the cfg file describing a scaled MRI subject. Parameters ---------- fname : path-like Target file. subject_from : str Name of the source MRI subject. subject_to : str Name of the scaled MRI subject. scale : float | array_like, shape = (3,)

(fname, subject_from, subject_to, scale)

Source from the content-addressed store, hash-verified

820
821
822def _write_mri_config(fname, subject_from, subject_to, scale):
823 """Write the cfg file describing a scaled MRI subject.
824
825 Parameters
826 ----------
827 fname : path-like
828 Target file.
829 subject_from : str
830 Name of the source MRI subject.
831 subject_to : str
832 Name of the scaled MRI subject.
833 scale : float | array_like, shape = (3,)
834 The scaling parameter.
835 """
836 scale = np.asarray(scale)
837 if np.isscalar(scale) or scale.shape == ():
838 n_params = 1
839 else:
840 n_params = 3
841
842 config = configparser.RawConfigParser()
843 config.add_section("MRI Scaling")
844 config.set("MRI Scaling", "subject_from", subject_from)
845 config.set("MRI Scaling", "subject_to", subject_to)
846 config.set("MRI Scaling", "n_params", str(n_params))
847 if n_params == 1:
848 config.set("MRI Scaling", "scale", str(scale))
849 else:
850 config.set("MRI Scaling", "scale", " ".join([str(s) for s in scale]))
851 config.set("MRI Scaling", "version", "1")
852 with open(fname, "w") as fid:
853 config.write(fid)
854
855
856def _scale_params(subject_to, subject_from, scale, subjects_dir):

Callers 1

scale_mriFunction · 0.85

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected