LabelFusion
This repo contains implementation of various label fusion approaches that can be used to fuse multiple labels.
Installation
For Usage
conda create -n venv_labelFusion python=3.12 -y
conda activate venv_labelFusion
pip install LabelFusion
For Development
# fork to your own repo
git clone ${yourFork_labelFusion_repo_link}
cd LabelFusion
conda create -p ./venv python=3.12 -y
conda activate ./venv
pip install -e .
# develop, push
# initiate pull request
Available LabelFusion:
- Voting (ITK): DOI:10.1016/j.patrec.2005.03.017
- STAPLE (ITK): DOI:10.1109/TMI.2004.830803
- Majority Voting: DOI:10.1007/978-3-319-20801-5_11
- SIMPLE: DOI:10.1109/tmi.2010.2057442
Usage
Command-Line interface
# continue from previous shell
python fusion_run -h
-h, --help show this help message and exit
-inputs INPUTS The absolute, comma-separated paths of labels that need to be fused
-classes CLASSES The expected labels; for example, for BraTS, this should be '0,1,2,4' - not used for STAPLE or ITKVoting
-method METHOD The method to apply; currently available: STAPLE | ITKVoting | MajorityVoting | SIMPLE
-output OUTPUT The output file to write the results
Example:
# continue from previous shell
python fusion_run \
-inputs /path/to/seg_algo_1.nii.gz,/path/to/seg_algo_2.nii.gz,/path/to/seg_algo_3.nii.gz \
-classes 0,1,2,4 \
-method STAPLE \
-output /path/to/seg_fusion.nii.gz
Python interface
# assuming virtual environment containing LabelFusion is activated
import SimpleITK as sitk
from LabelFusion.wrapper import fuse_images
label_to_fuse_0 = '/path/to/image_0.nii.gz'
label_to_fuse_1 = '/path/to/image_1.nii.gz'
images_to_fuse = []
images_to_fuse.append(sitk.ReadImage(label_to_fuse_0, sitk.sitkUInt8))
images_to_fuse.append(sitk.ReadImage(label_to_fuse_1, sitk.sitkUInt8))
fused_staple = fuse_images(images_to_fuse, 'staple') # class_list is not needed for staple/itkvoting
sitk.WriteImage(fused_staple, '/path/to/output_staple.nii.gz')
fused_simple = fuse_images(images_to_fuse, 'simple', class_list=[0,1,2,4])
sitk.WriteImage(fused_simple, '/path/to/output_simple.nii.gz')
Testing
This repo has continuous integration enbabled via Azure DevOps for the following operating systems:
- Windows
- Ubuntu
- macOS
And for the following python versions:
- 3.9
- 3.10
- 3.11
- 3.12
Metadata
Release files for LabelFusion 1.0.15
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 |
|---|---|---|---|---|
| labelfusion-1.0.15.tar.gz | 14.8 kB | Without provenance | Details for labelfusion-1.0.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| labelfusion-1.0.15-py3-none-any.whl | Python 3 | none | any | Details for labelfusion-1.0.15-py3-none-any.whl |
Total release size: 31.9 kB
Release files / labelfusion-1.0.15.tar.gz
| Download URL | labelfusion-1.0.15.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88021d97ffabe111825cd8d1f68a8c4595a0ad001ffb1bff3a6017fe9df45691
|
|
BLAKE2b-256 checksum How to use checksums |
78e0a398bfd985d03a0ea5a6eec40472f620d3c7a644869d022730d117f685d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / labelfusion-1.0.15-py3-none-any.whl
| Download URL | labelfusion-1.0.15-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
974e272e70a0ec7dc22dfc1fbc221ae550991f73e0236921101aba5ab811d5bb
|
|
BLAKE2b-256 checksum How to use checksums |
ed73cbca0a36bacf79e00871a47797597aaf213c45f282905fe70ca4048d5692
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Security for LabelFusion 1.0.15
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.