{"id":18785254,"url":"https://github.com/dbouget/raidionics_seg_lib","last_synced_at":"2026-02-26T15:32:46.018Z","repository":{"id":40465470,"uuid":"488638748","full_name":"dbouget/raidionics_seg_lib","owner":"dbouget","description":"Backend segmentation/classification library (using ONNX runtime) for Raidionics","archived":false,"fork":false,"pushed_at":"2025-02-18T12:17:57.000Z","size":428,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T03:41:37.504Z","etag":null,"topics":["3d-segmentation","ct","mri","raidionics","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbouget.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":"2022-05-04T15:15:00.000Z","updated_at":"2025-03-01T12:56:33.000Z","dependencies_parsed_at":"2025-02-04T11:38:19.599Z","dependency_job_id":null,"html_url":"https://github.com/dbouget/raidionics_seg_lib","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbouget%2Fraidionics_seg_lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbouget%2Fraidionics_seg_lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbouget%2Fraidionics_seg_lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbouget%2Fraidionics_seg_lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbouget","download_url":"https://codeload.github.com/dbouget/raidionics_seg_lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714736,"owners_count":21149958,"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":["3d-segmentation","ct","mri","raidionics","tensorflow"],"created_at":"2024-11-07T20:46:05.028Z","updated_at":"2026-02-26T15:32:45.998Z","avatar_url":"https://github.com/dbouget.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raidionics backend for segmentation and classification\n\n[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![](https://img.shields.io/badge/python-3.9|3.10|3.11|3.12|3.13-blue.svg)](https://www.python.org/downloads/)\n[![Paper](https://zenodo.org/badge/DOI/10.3389/fneur.2022.932219.svg)](https://www.frontiersin.org/articles/10.3389/fneur.2022.932219/full)\n[![codecov](https://codecov.io/gh/dbouget/raidionics_seg_lib/branch/master/graph/badge.svg?token=ZSPQVR7RKX)](https://codecov.io/gh/dbouget/raidionics_seg_lib)\n[![PyPI version](https://img.shields.io/pypi/v/raidionicsseg.svg)](https://pypi.org/project/raidionicsseg/)\n\n\nThe code corresponds to the segmentation or classification backend of MRI/CT volumes, using ONNX runtime for inference.  \nThe module can either be used as a Python library, as CLI, or as Docker container. By default, inference is performed on CPU only.\n\n## [Installation](https://github.com/dbouget/raidionics_seg_lib#installation)\n\n```\npip install raidionicsseg\n(or)\npip install git+https://github.com/dbouget/raidionics_seg_lib.git\n```\n\nAdditional packages (i.e., torch and onnxruntime-gpu), if needed, can also be installed as follows:\n```\npip instal raidionicsseg[ort-gpu]\npip instal raidionicsseg[torch]\n```\n\n## [How to cite](https://github.com/dbouget/raidionics_seg_lib#how-to-cite)\nIf you are using Raidionics in your research, please cite the following references.\n\nThe final software including updated performance metrics for preoperative tumors and introducing postoperative tumor segmentation:\n```\n@article{bouget2023raidionics,\n    author = {Bouget, David and Alsinan, Demah and Gaitan, Valeria and Holden Helland, Ragnhild and Pedersen, André and Solheim, Ole and Reinertsen, Ingerid},\n    year = {2023},\n    month = {09},\n    pages = {},\n    title = {Raidionics: an open software for pre-and postoperative central nervous system tumor segmentation and standardized reporting},\n    volume = {13},\n    journal = {Scientific Reports},\n    doi = {10.1038/s41598-023-42048-7},\n}\n```\n\nFor the preliminary preoperative tumor segmentation validation and software features:\n```\n@article{bouget2022preoptumorseg,\n    title={Preoperative Brain Tumor Imaging: Models and Software for Segmentation and Standardized Reporting},\n    author={Bouget, David and Pedersen, André and Jakola, Asgeir S. and Kavouridis, Vasileios and Emblem, Kyrre E. and Eijgelaar, Roelant S. and Kommers, Ivar and Ardon, Hilko and Barkhof, Frederik and Bello, Lorenzo and Berger, Mitchel S. and Conti Nibali, Marco and Furtner, Julia and Hervey-Jumper, Shawn and Idema, Albert J. S. and Kiesel, Barbara and Kloet, Alfred and Mandonnet, Emmanuel and Müller, Domenique M. J. and Robe, Pierre A. and Rossi, Marco and Sciortino, Tommaso and Van den Brink, Wimar A. and Wagemakers, Michiel and Widhalm, Georg and Witte, Marnix G. and Zwinderman, Aeilko H. and De Witt Hamer, Philip C. and Solheim, Ole and Reinertsen, Ingerid},\n    journal={Frontiers in Neurology},\n    volume={13},\n    year={2022},\n    url={https://www.frontiersin.org/articles/10.3389/fneur.2022.932219},\n    doi={10.3389/fneur.2022.932219},\n    issn={1664-2295}\n}\n```\n\n# [Usage](https://github.com/dbouget/raidionics_seg_lib#usage)\n\n## [1. CLI](https://github.com/dbouget/raidionics_seg_lib#cli)\n```\nraidionicsseg CONFIG\n```\n\nCONFIG should point to a configuration file (*.ini), specifying all runtime parameters,\naccording to the pattern from [**blank_main_config.ini**](https://github.com/dbouget/raidionics-seg-lib/blob/master/blank_main_config.ini).\n\n## [2. Python module](https://github.com/dbouget/raidionics_seg_lib#python-module)\n```\nfrom raidionicsseg import run_model\nrun_model(config_filename=\"/path/to/main_config.ini\")\n```\n\n## [3. Docker](https://github.com/dbouget/raidionics_seg_lib#docker)\nWhen calling Docker images, the --user flag must be properly used in order for the folders and files created inside\nthe container to inherit the proper read/write permissions. The user ID is retrieved on-the-fly in the following\nexamples, but it can be given in a more hard-coded fashion if known by the user.\n\n:warning: The following Docker image can only perform inference using the CPU. Another Docker image has been created, able to leverage\nthe GPU (see further down below). If the CUDA version does not match your machine, a new Docker image can be built manually, \nsimply modifying the base torch image to pull from inside Dockerfile_gpu.\n\n```\ndocker pull dbouget/raidionics-segmenter:v1.5.0-py39-cpu\n```\n\nFor opening the Docker image and interacting with it, run:  \n```\ndocker run --entrypoint /bin/bash -v /home/\u003cusername\u003e/\u003cresources_path\u003e:/workspace/resources -t -i --network=host --ipc=host --user $(id -u) dbouget/raidionics-segmenter:v1.5.0-py39-cpu\n```\n\nThe `/home/\u003cusername\u003e/\u003cresources_path\u003e` before the column sign has to be changed to match a directory on your local \nmachine containing the data to expose to the docker image. Namely, it must contain folder(s) with images you want to \nrun inference on, as long as a folder with the trained models to use, and a destination folder where the results will \nbe placed.\n\nFor launching the Docker image as a CLI, run:  \n```\ndocker run -v /home/\u003cusername\u003e/\u003cresources_path\u003e:/workspace/resources -t -i --network=host --ipc=host --user $(id -u) dbouget/raidionics-segmenter:v1.5.0-py39-cpu -c /workspace/resources/\u003cpath\u003e/\u003cto\u003e/main_config.ini -v \u003cverbose\u003e\n```\n\nThe `\u003cpath\u003e/\u003cto\u003e/main_config.ini` must point to a valid configuration file on your machine, as a relative path to the `/home/\u003cusername\u003e/\u003cresources_path\u003e` described above.\nFor example, if the file is located on my machine under `/home/myuser/Data/Segmentation/main_config.ini`, \nand that `/home/myuser/Data` is the mounted resources partition mounted on the Docker image, the new relative path will be `Segmentation/main_config.ini`.  \nThe `\u003cverbose\u003e` level can be selected from [debug, info, warning, error].\n\nFor running models on the GPU inside the Docker image, run the following CLI, with the gpu_id properly filled in the configuration file:\n```\ndocker run -v /home/\u003cusername\u003e/\u003cresources_path\u003e:/workspace/resources -t -i --runtime=nvidia --network=host --ipc=host --user $(id -u) dbouget/raidionics-segmenter:v1.5.0-py39-cuda12.4 -c /workspace/resources/\u003cpath\u003e/\u003cto\u003e/main_config.ini -v \u003cverbose\u003e\n```\n\n# [Models](https://github.com/dbouget/raidionics_seg_lib#models)\n\nThe trained models are automatically downloaded when running Raidionics or Raidionics-Slicer.  \nAlternatively, all existing Raidionics models can be browsed [here](https://github.com/dbouget/Raidionics-models) directly.\n\n\n# [Developers](https://github.com/dbouget/raidionics_seg_lib#developers)\nFor running inference on GPU, your machine must be properly configured (cf. [here](https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html))  \nIn the configuration file, the gpu_id parameter should then point to the GPU that is to be used during inference.\nThe onnxruntime-gpu Python package must be installed in addition, with a version matching the driver and cuda version,\nmore info can be accessed [here](https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#cuda-12x)\n\nTo run the unit tests, type the following within your virtual environment and within the raidionics_seg_lib folder:\n```\npip install pytest\npytest tests/\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbouget%2Fraidionics_seg_lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbouget%2Fraidionics_seg_lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbouget%2Fraidionics_seg_lib/lists"}