Label fusion strategies for multi-class labels.
Project description
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.6.5 -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.6.5 -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.6
- 3.7
- 3.8
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
LabelFusion-1.0.14.tar.gz
(14.7 kB
view details)
Built Distribution
File details
Details for the file LabelFusion-1.0.14.tar.gz
.
File metadata
- Download URL: LabelFusion-1.0.14.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4daf4e66be26e7e7b4908ae8cc049b94383b9bb6255c609bdc7ba082b3cb3a4c |
|
MD5 | 281dfb997963118ca51d475d9b21a5c9 |
|
BLAKE2b-256 | d5020c2f1eabe11d213571167b6ecc5afbb47cc55a48bc4da02f8befa1d64228 |
File details
Details for the file LabelFusion-1.0.14-py3-none-any.whl
.
File metadata
- Download URL: LabelFusion-1.0.14-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95be5b840b081acd5900d001e8f4f65190312cfa06813370f85b51400ee9b24a |
|
MD5 | 6b8cea06adfa301b528e85394ba7cd20 |
|
BLAKE2b-256 | fb286a9060f97e07abb00a5845039986efbc6e5b19b814e5bd1b84760ac33ddb |