SALINE (part of DBS-ElecNet)
Segmentation Algorithm using LINe-fitting for Electrodes
V. H. Yu et al., "DBS-ElecNet: Automated Localization and Segmentation of DBS Electrodes in Clinical MRI," 2026 IEEE 23rd International Symposium on Biomedical Imaging (ISBI), London, United Kingdom, 2026, pp. 1-4, doi:10.1109/ISBI61048.2026.11515562
Give SALINE a raw clinical T1-weighted MR image and it handles the rest: resampling, skull-stripping (SynthStrip), bias correction (N4), and segmentation (SynthSeg) all run via Docker, with no other install needed. It runs as a fully standalone CLI tool.
It is the core of DBS-ElecNet's classical (non-deep-learning) segmentation pipeline.
Why SALINE?
SALINE is a classical, filtering-based automatic segmentation method for DBS electrodes: no training, no manual annotation, no GPU. Give it an MRI, a brain mask, and a SynthSeg segmentation, and it finds the electrode track with a Laplacian/Frangi filter cascade and a line fit.
That makes it well suited to building a large database of electrode segmentations, at scale, without a human labeling each scan by hand. In the DBS-ElecNet paper, SALINE segmented 280 post-operative MRI scans in about 1.5 minutes each, and those segmentations became the training data for DBS-ElecNet's 3D U-Net. Any similar segmentation model can be trained the same way: run SALINE over a cohort, use its output as ground truth.
Install
Requires Python 3.12+ and Docker (recommended; see below for running without it).
pip install git+https://github.com/srikash/SALINE.git@v0.3.0
Usage
Dual-electrode (default, also available explicitly as saline dual):
saline --input subject.nii.gz
Single-electrode:
saline single --input subject.nii.gz
--input is a raw, native-space clinical MRI. SALINE resamples it to 1mm
isotropic, skull-strips it (SynthStrip), bias-corrects it (N4), and segments
it (SynthSeg) before finding the electrode track. All of this runs via
Docker, pulling antsx/ants,
freesurfer/synthstrip, and
cookpa/synthseg on first use.
Output:
subject_saline_elecSeg.nii.gz: the electrode segmentation, in--input's native space.subject_1mm_iso.nii.gz: the resampled MRI, kept for reference.subject_1mm_iso_saline_elecSeg.nii.gz: the electrode segmentation, in 1mm-isotropic space.
Running without Docker:
If Docker isn't available, pass precomputed files instead. Both must already
be in the same 1mm-isotropic space as subject_1mm_iso.nii.gz:
--brain_mask PATH: skips Docker-based SynthStrip.--synthseg PATH: skips Docker-based SynthSeg.
ANTs (resampling, N4, mask multiply) falls back to a local install
(ResampleImage, N4BiasFieldCorrection, ImageMath on PATH) if Docker
isn't available. There's no equivalent precomputed-file option for those.
Optional arguments:
--threads(default5): threads for SynthSeg.--laplacian_threshold(default0.21)--frangi_threshold(default0.25)--lower_frangi_threshold(default0.2): used if the higher threshold finds no candidates.--expand_radius(default6): dilation radius applied to the final line mask.--save_intermediate: also save the thresholded Laplacian, Frangi, and combined masks.
Citation
If you use this in your work, please cite the paper above (see CITATION.cff
for the full machine-readable record).
Releasing
Publishing a GitHub Release triggers .github/workflows/release.yml, which
builds the package and publishes it to PyPI via
trusted publishing (no API token
stored in the repo). One-time setup on PyPI, before the first release:
add a trusted publisher on the saline-dbs project (or as a pending
publisher if the project doesn't exist yet) pointing at this repository,
workflow release.yml, environment pypi.
Metadata
Release files for saline-dbs 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| saline_dbs-0.3.0.tar.gz | 14.2 kB | With provenance | Details for saline_dbs-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| saline_dbs-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for saline_dbs-0.3.0-py3-none-any.whl |
Total release size: 28.7 kB
Release files / saline_dbs-0.3.0.tar.gz
| Download URL | saline_dbs-0.3.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ec293a1753d594eb12af7beafeb847084330b6ca8b7e4dbe96a90868d07d504
|
|
BLAKE2b-256 checksum How to use checksums |
e931245afaceb31652439f4d0f3b03943c4af4b1254fabee054855c0c73fa887
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.
Transparency logRelease files / saline_dbs-0.3.0-py3-none-any.whl
| Download URL | saline_dbs-0.3.0-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85095b811b69d64c20d7f0ce9b3e9df51f9c92b35d559b10564468b76d172773
|
|
BLAKE2b-256 checksum How to use checksums |
2482024da041cd3baf7f304baf97f4282d28b901415c5b58ba44b6f356215a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.
Transparency logSecurity for saline-dbs 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for saline_dbs-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.