LabelFusion


NameLabelFusion JSON
Version 1.0.14 PyPI version JSON
download
home_pagehttps://github.com/FETS-AI/LabelFusion
SummaryLabel fusion strategies for multi-class labels.
upload_time2023-07-12 22:34:20
maintainer
docs_urlNone
authorMegh Bhalerao, Sarthak Pati
requires_python>=3.8
licenseApache-2.0
keywords semantic segmentation label-fusion fusion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LabelFusion

<p align="center">
    <a href="https://dev.azure.com/FETS-AI/LabelFusion/_build?definitionId=2&_a=summary" alt="Windows_3.6"><img src="https://dev.azure.com/FETS-AI/LabelFusion/_apis/build/status/FETS-AI.LabelFusion" /></a>
    <a href="https://doi.org/10.5281/zenodo.4534123"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.4534123.svg" alt="DOI"></a>
    <a href="https://anaconda.org/conda-forge/labelfusion" alt="Install"><img src="https://img.shields.io/conda/vn/conda-forge/labelfusion" /></a>
    <a href="https://pypi.org/project/LabelFusion/"><img src="https://img.shields.io/pypi/v/labelfusion"/></a>
</p>


This repo contains implementation of various label fusion approaches that can be used to fuse multiple labels.

## Installation

### For Usage
```powershell
conda create -n venv_labelFusion python=3.6.5 -y
conda activate venv_labelFusion
pip install LabelFusion
```

### For Development
```powershell
# 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)](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1LabelVotingImageFilter.html): [DOI:10.1016/j.patrec.2005.03.017](https://doi.org/10.1016/j.patrec.2005.03.017)
- [STAPLE (ITK)](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1MultiLabelSTAPLEImageFilter.html): [DOI:10.1109/TMI.2004.830803](https://doi.org/10.1109/TMI.2004.830803)
- Majority Voting: [DOI:10.1007/978-3-319-20801-5_11](https://doi.org/10.1007/978-3-319-20801-5_11)
- SIMPLE: [DOI:10.1109/tmi.2010.2057442](https://doi.org/10.1109/TMI.2010.2057442)

## Usage

### Command-Line interface

```powershell
# 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:
```powershell
# 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

```python
# 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](https://dev.azure.com/FETS-AI/LabelFusion/_build?definitionId=2&_a=summary) for the following [operating systems](https://github.com/FETS-AI/LabelFusion/blob/a51b82ad9880d466ed1d42441dd46de37e931df4/azure-pipelines.yml#L9):

- Windows
- Ubuntu
- macOS

And for the following python versions:

- 3.6
- 3.7
- 3.8

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/FETS-AI/LabelFusion",
    "name": "LabelFusion",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "semantic,segmentation,label-fusion,fusion",
    "author": "Megh Bhalerao, Sarthak Pati",
    "author_email": "software@cbica.upenn.edu",
    "download_url": "https://files.pythonhosted.org/packages/d5/02/0c2f1eabe11d213571167b6ecc5afbb47cc55a48bc4da02f8befa1d64228/LabelFusion-1.0.14.tar.gz",
    "platform": null,
    "description": "# LabelFusion\n\n<p align=\"center\">\n    <a href=\"https://dev.azure.com/FETS-AI/LabelFusion/_build?definitionId=2&_a=summary\" alt=\"Windows_3.6\"><img src=\"https://dev.azure.com/FETS-AI/LabelFusion/_apis/build/status/FETS-AI.LabelFusion\" /></a>\n    <a href=\"https://doi.org/10.5281/zenodo.4534123\"><img src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.4534123.svg\" alt=\"DOI\"></a>\n    <a href=\"https://anaconda.org/conda-forge/labelfusion\" alt=\"Install\"><img src=\"https://img.shields.io/conda/vn/conda-forge/labelfusion\" /></a>\n    <a href=\"https://pypi.org/project/LabelFusion/\"><img src=\"https://img.shields.io/pypi/v/labelfusion\"/></a>\n</p>\n\n\nThis repo contains implementation of various label fusion approaches that can be used to fuse multiple labels.\n\n## Installation\n\n### For Usage\n```powershell\nconda create -n venv_labelFusion python=3.6.5 -y\nconda activate venv_labelFusion\npip install LabelFusion\n```\n\n### For Development\n```powershell\n# fork to your own repo\ngit clone ${yourFork_labelFusion_repo_link}\ncd LabelFusion\nconda create -p ./venv python=3.6.5 -y\nconda activate ./venv\npip install -e .\n# develop, push\n# initiate pull request\n```\n\n## Available LabelFusion:\n\n- [Voting (ITK)](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1LabelVotingImageFilter.html): [DOI:10.1016/j.patrec.2005.03.017](https://doi.org/10.1016/j.patrec.2005.03.017)\n- [STAPLE (ITK)](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1MultiLabelSTAPLEImageFilter.html): [DOI:10.1109/TMI.2004.830803](https://doi.org/10.1109/TMI.2004.830803)\n- Majority Voting: [DOI:10.1007/978-3-319-20801-5_11](https://doi.org/10.1007/978-3-319-20801-5_11)\n- SIMPLE: [DOI:10.1109/tmi.2010.2057442](https://doi.org/10.1109/TMI.2010.2057442)\n\n## Usage\n\n### Command-Line interface\n\n```powershell\n# continue from previous shell\npython fusion_run -h\n  -h, --help        show this help message and exit\n  -inputs INPUTS    The absolute, comma-separated paths of labels that need to be fused\n  -classes CLASSES  The expected labels; for example, for BraTS, this should be '0,1,2,4' - not used for STAPLE or ITKVoting\n  -method METHOD    The method to apply; currently available: STAPLE | ITKVoting | MajorityVoting | SIMPLE\n  -output OUTPUT    The output file to write the results\n```\n\nExample:\n```powershell\n# continue from previous shell\npython fusion_run \\\n-inputs /path/to/seg_algo_1.nii.gz,/path/to/seg_algo_2.nii.gz,/path/to/seg_algo_3.nii.gz \\\n-classes 0,1,2,4 \\\n-method STAPLE \\\n-output /path/to/seg_fusion.nii.gz\n```\n\n### Python interface\n\n```python\n# assuming virtual environment containing LabelFusion is activated\nimport SimpleITK as sitk\nfrom LabelFusion.wrapper import fuse_images\n\nlabel_to_fuse_0 = '/path/to/image_0.nii.gz'\nlabel_to_fuse_1 = '/path/to/image_1.nii.gz'\n\nimages_to_fuse = []\nimages_to_fuse.append(sitk.ReadImage(label_to_fuse_0, sitk.sitkUInt8))\nimages_to_fuse.append(sitk.ReadImage(label_to_fuse_1, sitk.sitkUInt8))\nfused_staple = fuse_images(images_to_fuse, 'staple') # class_list is not needed for staple/itkvoting\nsitk.WriteImage(fused_staple, '/path/to/output_staple.nii.gz')\nfused_simple = fuse_images(images_to_fuse, 'simple', class_list=[0,1,2,4])\nsitk.WriteImage(fused_simple, '/path/to/output_simple.nii.gz')\n```\n\n## Testing\n\nThis repo has continuous integration enbabled via [Azure DevOps](https://dev.azure.com/FETS-AI/LabelFusion/_build?definitionId=2&_a=summary) for the following [operating systems](https://github.com/FETS-AI/LabelFusion/blob/a51b82ad9880d466ed1d42441dd46de37e931df4/azure-pipelines.yml#L9):\n\n- Windows\n- Ubuntu\n- macOS\n\nAnd for the following python versions:\n\n- 3.6\n- 3.7\n- 3.8\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Label fusion strategies for multi-class labels.",
    "version": "1.0.14",
    "project_urls": {
        "Homepage": "https://github.com/FETS-AI/LabelFusion"
    },
    "split_keywords": [
        "semantic",
        "segmentation",
        "label-fusion",
        "fusion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb286a9060f97e07abb00a5845039986efbc6e5b19b814e5bd1b84760ac33ddb",
                "md5": "6b8cea06adfa301b528e85394ba7cd20",
                "sha256": "95be5b840b081acd5900d001e8f4f65190312cfa06813370f85b51400ee9b24a"
            },
            "downloads": -1,
            "filename": "LabelFusion-1.0.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b8cea06adfa301b528e85394ba7cd20",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 16942,
            "upload_time": "2023-07-12T22:34:18",
            "upload_time_iso_8601": "2023-07-12T22:34:18.847208Z",
            "url": "https://files.pythonhosted.org/packages/fb/28/6a9060f97e07abb00a5845039986efbc6e5b19b814e5bd1b84760ac33ddb/LabelFusion-1.0.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5020c2f1eabe11d213571167b6ecc5afbb47cc55a48bc4da02f8befa1d64228",
                "md5": "281dfb997963118ca51d475d9b21a5c9",
                "sha256": "4daf4e66be26e7e7b4908ae8cc049b94383b9bb6255c609bdc7ba082b3cb3a4c"
            },
            "downloads": -1,
            "filename": "LabelFusion-1.0.14.tar.gz",
            "has_sig": false,
            "md5_digest": "281dfb997963118ca51d475d9b21a5c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14663,
            "upload_time": "2023-07-12T22:34:20",
            "upload_time_iso_8601": "2023-07-12T22:34:20.267935Z",
            "url": "https://files.pythonhosted.org/packages/d5/02/0c2f1eabe11d213571167b6ecc5afbb47cc55a48bc4da02f8befa1d64228/LabelFusion-1.0.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-12 22:34:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "FETS-AI",
    "github_project": "LabelFusion",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "labelfusion"
}
        
Elapsed time: 0.09875s