Skip to main content

A package for automatic segmentation of liver from CT data

Project description

livermask

Automatic liver parenchyma and vessel segmentation in CT using deep learning

license Build Actions Status DOI GitHub Downloads Pip Downloads

livermask was developed by SINTEF Medical Technology to provide an open tool to accelerate research.

Install

pip install livermask

Alternatively, to install from source do:

pip install git+https://github.com/andreped/livermask.git

As TensorFlow 2.4 only supports Python 3.6-3.8, so does livermask. Software is also compatible with Anaconda. However, best way of installing livermask is using pip, which also works for conda environments.

(Optional) To add GPU inference support for liver vessel segmentation (which uses Chainer and CuPy), you need to install CuPy. This can be easily done by adding cupy-cudaX, where X is the CUDA version you have installed, for instance cupy-cuda110 for CUDA-11.0:

pip install cupy-cuda110

(DEBUG) If you experience issues with numpy, after installing CuPy, try reinstalling CuPy with this extension:

pip install 'cupy-cuda110>=7.7.0,<8.0.0'

Program has been tested using Python 3.7 on Windows, macOS, and Ubuntu Linux 18.04.

Usage:

livermask --input path-to-input --output path-to-output
command description
--input the full path to the input data. Could be nifti file or directory (if directory is provided as input)
--output the full path to the output data. Could be either output name or directory (if directory is provided as input)
--cpu to disable the GPU (force computations on CPU only)
--verbose to enable verbose
--vessels to segment vessels
--extension of the output file (default: .nii)

Using code directly:

If you wish to use the code directly (not as a CLI and without installing), you can run this command:

python -m livermask.livermask --input path-to-input --output path-to-output

DICOM/NIfTI format

Pipeline assumes input is in the NIfTI format, and output a binary volume in the same format (.nii or .nii.gz). DICOM can be converted to NIfTI using the CLI dcm2niix, as such:

dcm2niix -s y -m y -d 1 "path_to_CT_folder" "output_name"

Note that "-d 1" assumed that "path_to_CT_folder" is the folder just before the set of DICOM scans you want to import and convert. This can be removed if you want to convert multiple ones at the same time. It is possible to set "." for "output_name", which in theory should output a file with the same name as the DICOM folder, but that doesn't seem to happen...

Troubleshooting

You might have issues downloading the model when using VPN. If any issues are observed, try to disable VPN and try again.

If the program struggles to install, attempt to install using:

pip install --force-reinstall --no-deps git+https://github.com/andreped/livermask.git

Acknowledgements

If you found this tool helpful in your research, please, consider citing it:

  @software{andre_pedersen_2022_7448865,
  author       = {André Pedersen},
  title        = {andreped/livermask: v1.4.0},
  month        = dec,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {v1.4.0},
  doi          = {10.5281/zenodo.7448865},
  url          = {https://doi.org/10.5281/zenodo.7448865}}

Information on how to cite can be found here.

The model was trained on the LITS dataset. The dataset is openly accessible and can be downloaded from here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

livermask-1.4.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file livermask-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: livermask-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for livermask-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a03a7564f2e5f557aabf4d387952ffcfab508dbc47f04d02c46050b4c36f4ea
MD5 30da3f4b5294bc63b0d0a7a9025265d5
BLAKE2b-256 d0011b2141c36f8b1a984f8d17afbf9c64d36ccb8cc8a00cfa271fda0b9a263d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page