Remod offers a friendly collection of command line tools for analysing and tweaking neuronal morphologies stored in the SWC format. Whether you want detailed statistics or structural edits, Remod helps you measure, modify and visualise your neurons.
- Parse SWC files to compute branch point counts, branch order distributions, lengths, surface areas and Sholl measurements.
- Automatically save all aggregated statistics in
downloads/statistics/. - Remodel morphologies with
remod_cli.py editby removing, shrinking, extending, branching or scaling dendrites. Pick dendrites manually or randomly and adjust radii as needed. - Node indices are renumbered automatically after editing.
- Visualise original and edited trees using the export helpers in
file_io.pyfor individual plots or overlays. - Summarise multiple runs with
plot_statistics.pyusing thesimpleorsmartcommands.
Requires Python 3.10 or later with NumPy and Matplotlib:
pip install numpy matplotlibUsing a virtual environment is recommended but not required.
-
Prepare SWC files – place your
.swcfiles in a directory (see examples underswc_files/). -
Compute statistics – run
remod_cli.py analyzeon the directory with a comma separated list of file names:python remod_cli.py analyze /path/to/swc 0-2.swc
Results such as total dendritic length, branch point counts and Sholl intersections are written to
downloads/statistics/.To get the statistics in a single JSON file without intermediate text files, use
json_stats.py:python json_stats.py /path/to/swc 0-2.swc
-
Edit morphologies –
remod_cli.py editapplies structural changes. The following removes 50% of all terminal dendrites from0-2.swcand writes the result todownloads/files/0-2_new.swc:python remod_cli.py edit \ --directory /path/to/swc \ --file-name 0-2.swc \ --who all_terminal \ --action remove \ --hm-choice percent \ --amount 50 \ --var-choice percent \ --radius-change 10
Other actions include
shrink,extend,branchandscale. Choose dendrites randomly via--random-ratioor specify them with--manual-dendrites. -
Visualise – use the helpers in
file_io.pyto generate 3‑D plots or overlays.plot_statistics.pybuilds summary graphs fromdownloads/statistics/; add--averageor--comparefor group averages or comparisons. Figures are saved in thedownloads/directory.
A typical pipeline looks like this:
- Analyse –
remod_cli.py analyzerecords baseline statistics indownloads/statistics/. - Modify –
remod_cli.py editperforms the chosen remodeling operations and saves results indownloads/files/. - Reassign indices – node indices are automatically renumbered after modifications.
- Visualise and plot – generate 3‑D views and overlays with
file_io.pyand produce summary plots viaplot_statistics.py. - Combine statistics – use
plot_statistics.pywithsimpleorsmartto merge and compare runs.
swc_parser.pyalso providesindex_reassignto renumber nodes after editing.core_utils.pyoffers weighted dendrite sampling utilities and warning helpers.remodeling_actions.pyimplements the remodeling operations.- Plotting and merging functionality resides in
plot_statistics.py. swc_parser.pyexposes anSWCParserclass wrapping the originalparse_swc_filefunction.logger_utils.pycontains a smallMarkdownLoggerfor logs.core_utils.pycollects CLI parsers in theCLIParsersclass.- Common file helpers live under
FileIOinfile_io.py. - Morphometric functions are grouped in
MorphologyStats. json_stats.pyexports aStatisticsComputerfor JSON output.- Plotting helpers are accessible via the
StatisticsPlotterclass. - The main entry points reside in
RemodCLIwithinremod_cli.py. - Remodeling actions are available through the
RemodelActionsclass.
Run any script with the --help flag to see its command line options.