Code Monkey home page Code Monkey logo

labelfusion's Introduction

LabelFusion

DOI

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:

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

labelfusion's People

Contributors

dependabot[bot] avatar sarthakpati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

labelfusion's Issues

Publish on PyPi

Is your feature request related to a problem? Please describe.
Currently, the only way to run LabelFusion is to do a git clone and follow setup steps.

Describe the solution you'd like
It would make it much easier to work with if this is presented in PyPI.

Describe alternatives you've considered
Publish on conda is also a solution.

Additional context
A few examples:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.