{"id":20361122,"url":"https://github.com/reubendo/jstabl","last_synced_at":"2025-04-12T03:53:56.779Z","repository":{"id":56640886,"uuid":"256257552","full_name":"ReubenDo/jSTABL","owner":"ReubenDo","description":"Learning joint Segmentation of Tissues And Brain Lesions (jSTABL) from task-specific hetero-modal domain-shifted datasets","archived":false,"fork":false,"pushed_at":"2025-03-24T21:32:42.000Z","size":72,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T03:53:52.510Z","etag":null,"topics":["brain","domain-adaptation","glioma","missing-modalities","pytorch","segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReubenDo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-04-16T15:37:25.000Z","updated_at":"2025-03-24T21:32:46.000Z","dependencies_parsed_at":"2022-08-15T22:30:49.782Z","dependency_job_id":"5d0d83be-d575-46ca-ad6c-9684c37f5c1f","html_url":"https://github.com/ReubenDo/jSTABL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenDo%2FjSTABL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenDo%2FjSTABL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenDo%2FjSTABL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenDo%2FjSTABL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReubenDo","download_url":"https://codeload.github.com/ReubenDo/jSTABL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514205,"owners_count":21116899,"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":["brain","domain-adaptation","glioma","missing-modalities","pytorch","segmentation"],"created_at":"2024-11-14T23:46:37.218Z","updated_at":"2025-04-12T03:53:56.760Z","avatar_url":"https://github.com/ReubenDo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning joint Segmentation of Tissues And Brain Lesions (jSTABL) from task-specific hetero-modal domain-shifted datasets\n\nPublic PyTorch implementation of [Learning joint segmentation of tissues and brain lesions from task-specific hetero-modal domain-shifted datasets](https://arxiv.org/abs/2009.04009) published in Medical Image Analysis.\n\nThis work proposed a technique to perform joint brain tissue and lesion segmentation. Due to the lack of fully-annotated data, the framework has been trained  using hetero-modal (missing modalities), task-specific (tissue or lesion annotations) and domain-shifted (different acquisition protocols) datasets.\n\nTwo types of lesions are considered: gliomas and white matter lesions.\n\n### Example of joint brain tissues and glioma segmentation:\n![glioma_example](https://github.com/ReubenDo/reubendo.github.io/blob/master/assets/img/together_optimised_loop.gif)*Example of automatic joint brain tissues and glioma segmentation using jSTABL. Segmented tissue structures: grey matter (green), white matter (yellow), basal ganglia (light blue), ventricles (red), cerebellum (orange) and brainstem (dark blue). Segmented glioma sub-regions: oedema/invasion (purple), non-enhancing solid core (turquoise) and enhancing core (lime green).*\n\n\nIf you find this code useful for your research, please cite the following paper:\n```\n@article{DORENT2021101862,\ntitle = \"Learning joint segmentation of tissues and brain lesions from task-specific hetero-modal domain-shifted datasets\",\njournal = \"Medical Image Analysis\",\nvolume = \"67\",\npages = \"101862\",\nyear = \"2021\",\nissn = \"1361-8415\",\ndoi = \"https://doi.org/10.1016/j.media.2020.101862\",\nurl = \"http://www.sciencedirect.com/science/article/pii/S1361841520302267\",\nauthor = \"Reuben Dorent and Thomas Booth and Wenqi Li and Carole H. Sudre and Sina Kafiabadi and Jorge Cardoso and Sebastien Ourselin and Tom Vercauteren\",\nkeywords = \"Joint learning, Domain adaptation, Multi-Task learning, Multi-Modal\",\n}\n```\n\n## Installation\n### 1. Create a [conda](https://docs.conda.io/en/latest/) environment (recommended)\n```\nENVNAME=\"jstablenv\"\nconda create -n $ENVNAME python -y\nconda activate $ENVNAME\n```\n### 2. Install [PyTorch](https://pytorch.org/)\nPlease install [PyTorch](https://pytorch.org/) for your CUDA toolkit within the conda environment:\n\n### 3. Install jSTABL\nWithin the conda environment:\n```\n(jstablenv):~ pip install -e  git+https://github.com/ReubenDo/jSTABL#egg=jSTABL\n```\n\n### (Optionnal) 4. Install [MRIPreprocessor](https://github.com/ReubenDo/MRIPreprocessor)\nIf your data isn't preprocessed (skull-stripped and co-registered) you could use [MRIPreprocessor](https://github.com/ReubenDo/MRIPreprocessor). \n\nTo install it within the conda environment:\n```\n(jstablenv):~ pip install git+https://github.com/ReubenDo/MRIPreprocessor#egg=MRIPreprocessor\n```\n\n## Usage\nUsing jSTABL is straightforward in any terminal on your linux system. The following examples show how to perform: 1. joint brain tissues and glioma segmentation; 2. joint brain tissues and white matter lesion segmentation.\n\nThe framework has been trained on preprocessed data, i.e. on skull-stripped and coregistered scans.\nAdditionnally, the data has been cropped to avoid performing inference on patchs containing only zeros.\n\nIf the data is not already preprocessed, an external library [MRIPreprocessor](https://github.com/ReubenDo/MRIPreprocessor) can be directly employed in the framework to perform this preprocessing. Note that other options could be considered such as the [BraTS Toolkit](https://github.com/neuronflow/BraTS-Toolkit).\n\n### 1. Gliomas\n\n- If the T1, T1c, T2 and FLAIR scans are already preprocessed (skull-stripped, coregistered and cropped):\n  \n```\n(jstablenv):~$jstabl_glioma  -t1 subj_T1.nii.gz -t1c subj_T1c.nii.gz  \\\n-t2 subj_T2.nii.gz  -fl subj_FLAIR.nii.gz -res segmentation.nii.gz\nINFO] GPU available.\n[INFO] Reading data.\n[INFO] Building model.\n[INFO] Loading model.\n[INFO] Starting Inference.\n100%|███████████████████████████████████████████████████████| 27/27 [01:03\u003c00:00,  2.35s/it]\n[INFO] Inference done in 69s. Segmentation saved here: segmentation.nii.gz\nHave a good day!\n```\n  \n- If the data isn't preprocessed, you can install [MRIPreprocessor](https://github.com/ReubenDo/MRIPreprocessor) and perform the preprocessing+segmentation as follows:\n```\n(jstablenv):~$jstabl_glioma  -t1 subj_T1.nii.gz -t1c subj_T1c.nii.gz \\\n -t2 subj_T2.nii.gz  -fl subj_FLAIR.nii.gz -res segmentation.nii.gz --preprocess\n[INFO] GPU available.\n[INFO] Reading data.\n[INFO] Performing Coregistration\nT1 is used as reference\nRegistration performed for T2\nRegistration performed for T1c\nRegistration performed for Flair\n[INFO] Performing Skull Stripping using HD-BET\nFile: subj_T1.nii.gz \npreprocessing...\nimage shape after preprocessing:  (107, 160, 113)\nprediction (CNN id)...\n0\n1\n2\n3\n4\nexporting segmentation...\n[INFO] Building model.\n[INFO] Loading model.\n[INFO] Starting Inference.\n100%|███████████████████████████████████████████████████████| 27/27 [01:03\u003c00:00,  2.35s/it]\n[INFO] Inference done in 180s. Segmentation saved here: segmentation.nii.gz\nHave a good day!\n```\n\n### 2. White Matter Lesions\n\n- If the T1 and FLAIR scans are preprocessed (skull-stripped, coregistered and cropped):\n  \n```\n(jstablenv):~$ jstabl_wmh  -t1 subj_T1.nii.gz -fl subj_FLAIR.nii.gz -res segmentation.nii.gz\n[INFO] GPU available.\n[INFO] Reading data.\n[INFO] Building model.\n[INFO] Loading model.\n[INFO] Starting Inference.\n[INFO] Inference done in 6s. Segmentation saved here: segmentation.nii.gz\nHave a good day!\n```\n  \n- If the data isn't preprocessed, you can install [MRIPreprocessor](https://github.com/ReubenDo/MRIPreprocessor) and perform the preprocessing+segmentation as follows:\n```\n(jstablenv):~$ jstabl_glioma  -t1 subj_T1.nii.gz -fl subj_FLAIR.nii.gz \\\n-res segmentation.nii.gz --preprocess\n[INFO] GPU available.\n[INFO] Reading data.\n[INFO] Performing Coregistration\nT1 is used as reference\nRegistration performed for Flair\n[INFO] Performing Skull Stripping using HD-BET\nFile: subj_T1.nii.gz\npreprocessing...\nimage shape after preprocessing:  (96, 153, 153)\nprediction (CNN id)...\n0\n1\n2\n3\n4\nexporting segmentation...\n[INFO] Building model.\n[INFO] Loading model.\n[INFO] Starting Inference.\n[INFO] Inference done in 76s. Segmentation saved here: segmentation.nii.gz\nHave a good day!\n```\n# Copyright\n* Copyright (c) 2020, King's College London. All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freubendo%2Fjstabl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freubendo%2Fjstabl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freubendo%2Fjstabl/lists"}