charm
tit.pre.charm ¶
SimNIBS CHARM head-mesh creation and subject atlas segmentation.
Wraps the SimNIBS charm command to generate m2m head-mesh directories
and the subject_atlas command to create cortical parcellation
.annot files for a2009s, DK40, and HCP_MMP1 atlases.
Public API¶
run_charm
Run SimNIBS charm for a subject.
run_subject_atlas
Create atlas .annot files from an existing m2m directory.
copy_charm_report
Copy SimNIBS's charm_report.html into the subject's report folder.
See Also¶
tit.pre.fastsurfer : FastSurfer --seg_only deep segmentation.
tit.pre.structural.run_pipeline : Full preprocessing pipeline.
run_charm ¶
run_charm(project_dir: str, subject_id: str, *, logger, runner: CommandRunner | None = None, threads: int | None = None, options: dict | None = None) -> None
Run SimNIBS charm to generate a head mesh for a subject.
Creates an m2m directory at the standard BIDS derivatives location containing the volumetric head model required for TI simulations.
Parameters¶
project_dir : str
BIDS project root.
subject_id : str
Subject identifier without the sub- prefix.
logger : logging.Logger
Logger used for progress and command output.
runner : CommandRunner or None, optional
Subprocess runner used to stream output.
Raises¶
PreprocessError
If no T1 image is found, the m2m directory already exists, or
charm exits with a non-zero code.
See Also¶
run_subject_atlas : Create atlas .annot files after CHARM.
run_fastsurfer : FastSurfer deep segmentation.
Source code in tit/pre/charm.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
copy_charm_report ¶
Copy m2m_<id>/charm_report.html to reports/sub-<id>/charm_report.html.
The report is SimNIBS's own, self-contained (images are inline data: URIs), so one
file is the whole report. It is copied, not moved: SimNIBS and users expect it in m2m.
A missing or uncopyable report is logged and never fails the head model.
Source code in tit/pre/charm.py
run_subject_atlas ¶
run_subject_atlas(project_dir: str, subject_id: str, *, logger, runner: CommandRunner | None = None) -> None
Run subject_atlas to create .annot files for a subject.
Should be called after run_charm completes successfully.
Generates all three atlases: a2009s, DK40, and HCP_MMP1.
Parameters¶
project_dir : str
BIDS project root.
subject_id : str
Subject identifier without the sub- prefix.
logger : logging.Logger
Logger used for progress and command output.
runner : CommandRunner or None, optional
Subprocess runner used to stream output.
Raises¶
PreprocessError
If the m2m directory does not exist or subject_atlas fails.
See Also¶
run_charm : Generate the m2m head mesh (prerequisite).