{"id":18785253,"url":"https://github.com/andreped/livermask","last_synced_at":"2025-04-05T19:12:58.488Z","repository":{"id":47211366,"uuid":"238680374","full_name":"andreped/livermask","owner":"andreped","description":"💥 Command line tool for automatic liver parenchyma and liver vessel segmentation in CT using a pretrained deep learning model","archived":false,"fork":false,"pushed_at":"2024-10-07T10:25:44.000Z","size":6199,"stargazers_count":66,"open_issues_count":4,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T17:11:37.146Z","etag":null,"topics":["command-line-tool","ct","deep-learning","free-to-use","hepatic-veins","liver","liver-segmentation","liver-vessels","livermask","open","parenchyma","portal-veins","pretrained-models","segmentation","unet","vessels"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/livermask/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreped.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-06T12:09:10.000Z","updated_at":"2025-01-19T17:00:36.000Z","dependencies_parsed_at":"2024-11-07T20:47:08.006Z","dependency_job_id":"8f36bb89-580d-406b-a267-99f0a1655f4a","html_url":"https://github.com/andreped/livermask","commit_stats":{"total_commits":194,"total_committers":4,"mean_commits":48.5,"dds":"0.046391752577319534","last_synced_commit":"af0234e3082e928364105ea6def7a6b3565449cc"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreped%2Flivermask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreped%2Flivermask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreped%2Flivermask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreped%2Flivermask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreped","download_url":"https://codeload.github.com/andreped/livermask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","ct","deep-learning","free-to-use","hepatic-veins","liver","liver-segmentation","liver-vessels","livermask","open","parenchyma","portal-veins","pretrained-models","segmentation","unet","vessels"],"created_at":"2024-11-07T20:46:04.754Z","updated_at":"2025-04-05T19:12:58.467Z","avatar_url":"https://github.com/andreped.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: 'livermask: Automatic Liver Parenchyma and vessel segmentation in CT'\ncolorFrom: indigo\ncolorTo: indigo\nsdk: docker\napp_port: 7860\nemoji: 🔎\npinned: false\nlicense: mit\napp_file: demo/app.py\n---\n\n\n\u003cdiv align=\"center\"\u003e\n\u003ch1 align=\"center\"\u003elivermask\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eAutomatic liver parenchyma and vessel segmentation in CT using deep learning\u003c/h3\u003e\n\n[![license](https://img.shields.io/github/license/DAVFoundation/captain-n3m0.svg?style=flat-square)](https://github.com/DAVFoundation/captain-n3m0/blob/master/LICENSE)\n[![Build Actions Status](https://github.com/andreped/livermask/workflows/Build/badge.svg)](https://github.com/andreped/livermask/actions)\n[![DOI](https://zenodo.org/badge/238680374.svg)](https://zenodo.org/badge/latestdoi/238680374)\n[![GitHub Downloads](https://img.shields.io/github/downloads/andreped/livermask/total?label=GitHub%20downloads\u0026logo=github)](https://github.com/andreped/livermask/releases)\n[![Pip Downloads](https://img.shields.io/pypi/dm/livermask?label=pip%20downloads\u0026logo=python)](https://pypi.org/project/livermask/)\n \n**livermask** was developed by SINTEF Medical Technology to provide an open tool to accelerate research.\n\n\u003cimg src=\"figures/Segmentation_3DSlicer.PNG\" width=\"70%\"\u003e\n\u003c/div\u003e\n\n## Demo \u003ca target=\"_blank\" href=\"https://huggingface.co/spaces/andreped/livermask\"\u003e\u003cimg src=\"https://img.shields.io/badge/🤗%20Hugging%20Face-Spaces-yellow.svg\"\u003e\u003c/a\u003e\n\nAn online version of the tool has been made openly available at Hugging Face spaces, to enable researchers to easily test the software on their own data without downloading it. To access it, click on the badge above.\n\n## Install\n\nA stable release is available on PyPI:\n```\npip install livermask\n```\n\nAlternatively, to install from source do:\n```\npip install git+https://github.com/andreped/livermask.git\n```\n\nAs TensorFlow 2.4 only supports Python 3.6-3.8, so does livermask. Software \nis also compatible with Anaconda. However, best way of installing livermask is using `pip`, which\nalso works for conda environments.\n\n(Optional) To add GPU inference support for liver vessel segmentation (which uses Chainer and CuPy), you need to install [CuPy](https://github.com/cupy/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:\n```\npip install cupy-cuda110\n```\n\nProgram has been tested using Python 3.7 on Windows, macOS, and Ubuntu Linux 20.04.\n\n## Usage\n\n```\nlivermask --input path-to-input --output path-to-output\n```\n\n|  command\u003cimg width=10/\u003e | description |\n| ------------------- | ------------- |\n| `--input`  | the full path to the input data. Could be nifti file or directory (if directory is provided as input) |\n| `--output`  | the full path to the output data. Could be either output name or directory (if directory is provided as input)  |\n| `--cpu`  | to disable the GPU (force computations on CPU only) |\n| `--verbose`  | to enable verbose |\n| `--vessels` | to segment vessels |\n| `--extension` | which extension to save output in (default: `.nii`) |\n\n\u003cdetails open\u003e\n\u003csummary\u003e\n\n### Using code directly\u003c/summary\u003e\nIf you wish to use the code directly (not as a CLI and without installing), you can run this command:\n```\npython -m livermask.livermask --input path-to-input --output path-to-output\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\n### DICOM/NIfTI format\u003c/summary\u003e\nPipeline assumes input is in the NIfTI format, and output a binary volume in the same format (.nii or .nii.gz).\nDICOM can be converted to NIfTI using the CLI [dcm2niix](https://github.com/rordenlab/dcm2niix), as such:\n```\ndcm2niix -s y -m y -d 1 \"path_to_CT_folder\" \"output_name\"\n```\n\nNote 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...\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\n### Troubleshooting\u003c/summary\u003e\nYou might have issues downloading the model when using VPN. If any issues are observed, try to disable VPN and try again.\n\nIf the program struggles to install, attempt to install using:\n```\npip install --force-reinstall --no-deps git+https://github.com/andreped/livermask.git\n```\n\nIf you experience issues with numpy after installing CuPy, try reinstalling CuPy with this extension:\n```\npip install 'cupy-cuda110\u003e=7.7.0,\u003c8.0.0'\n```\n\u003c/details\u003e\n\n## Applications of livermask\n* Wang et al., Machine learning-based radiomic models for predicting metachronous liver metastases in colorectal cancer patients: a multimodal study, Research Square (preprint), 2024, https://doi.org/10.21203/rs.3.rs-3320033/v1\n* Yevdokimov et al., Recognition of Diffuse Hepatic Steatosis, 33rd Conference of Open Innovations Association, FRUCT, 2023, https://doi.org/10.23919/FRUCT58615.2023.10143062\n* Pérez de Frutos et al., Learning deep abdominal CT registration through adaptive loss weighting and synthetic data generation, PLOS ONE, 2023, \nhttps://doi.org/10.1371/journal.pone.0282110\n* Lee et al., Robust End-to-End Focal Liver Lesion Detection Using Unregistered Multiphase Computed Tomography Images, IEEE Transactions on Emerging Topics in Computational Intelligence, 2021, https://doi.org/10.1109/TETCI.2021.3132382\n* Survarachakan et al., Effects of Enhancement on Deep Learning Based Hepatic Vessel Segmentation, Electronics, 2021, https://doi.org/10.3390/electronics10101165\n\n## Segmentation performance metrics\nThe segmentation models were evaluated on an internal dataset against manual annotations. See Table E in S4 Appendix in the Supporting Information of [this paper](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0282110) for more information. The table presented there can also be seen below:\n\n| Class | DSC | HD95 |\n|--------|-------------------|------------------|\n| Parenchyma | 0.946±0.046 | 10.122±11.032 |\n| Vessels | 0.355±0.090 | 24.872±5.161 |\n\nThe parenchyma segmentation model was trained on the LITS dataset, whereas the vessel model was trained on a local dataset (Oslo-CoMet). The LITS dataset is openly accessible and can be downloaded from [here](https://competitions.codalab.org/competitions/17094).\n\nThe Oslo-CoMet included 60 patients, of which 11 representative patients were used as hold out sample for the performance metrics assessment.\n\n## Acknowledgements\nIf you found this tool helpful in your research, please, consider citing it (see [here](https://zenodo.org/badge/latestdoi/238680374) for more information on how to cite):\n\u003cpre\u003e\n@software{andre_pedersen_2023_7574587,\n  author       = {André Pedersen and Javier Pérez de Frutos},\n  title        = {andreped/livermask: v1.4.1},\n  month        = jan,\n  year         = 2023,\n  publisher    = {Zenodo},\n  version      = {v1.4.1},\n  doi          = {10.5281/zenodo.7574587},\n  url          = {https://doi.org/10.5281/zenodo.7574587}\n}\n\u003c/pre\u003e\n\nIn addition, the segmentation performance of the tool was presented in [this paper](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0282110), thus, cite this tool as well if that is of relevance for you study:\n\u003cpre\u003e\n@article{perezdefrutos2022ddmr,\n    title = {Learning deep abdominal CT registration through adaptive loss weighting and synthetic data generation},\n    author = {Pérez de Frutos, Javier AND Pedersen, André AND Pelanis, Egidijus AND Bouget, David AND Survarachakan, Shanmugapriya AND Langø, Thomas AND Elle, Ole-Jakob AND Lindseth, Frank},\n    journal = {PLOS ONE},\n    publisher = {Public Library of Science},\n    year = {2023},\n    month = {02},\n    volume = {18},\n    doi = {10.1371/journal.pone.0282110},\n    url = {https://doi.org/10.1371/journal.pone.0282110},\n    pages = {1-14},\n    number = {2}\n}\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreped%2Flivermask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreped%2Flivermask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreped%2Flivermask/lists"}