No project description provided
Project description
BOA::Contrast
Package to compute contrast information from a CT image, part of the BOA (soon online!). The package uses the open-source software TotalSegmentator to compute segmentations of important anatomical landmarks, which are then used to create features for a machine learning model to predict the contrast information.
Install
pip install boa-contrast
will install only the basic package (without the TotalSegmentator), if you also want to install the TotalSegmentator you can
pip install "boa-contrast[totalsegmentator]"
However, the TotalSegmentator can also be used together with docker, and in such case it is not needed to install it.
Command Line
constrast-recognition --help
Once a CT and a folder where to store the TotalSegmentator segmentations is given, you can run it using the following command
contrast-recognition [-h] --ct-path CT_PATH --segmentation-folder SEGMENTATION_FOLDER [--docker] [--user-id USER_ID] [--device-id DEVICE_ID] [-v]
You can run it using docker by using the --docker
flag. If you are using docker, you need to specify your user ID using the --user-id
flag, otherwise you will have to change the ownership of the segmentations afterwards.
If you are using a GPU, you can specify the device ID using the --device-id
flag.
You can enable verbosity with the -v
flag.
To not download the TotalSegmentator weights all the time, you can specify their location using the TOTALSEG_WEIGHTS_PATH
environment variable.
A sample output looks as follows:
IV Phase: NON_CONTRAST
Contrast in GIT: NO_CONTRAST_IN_GI_TRACT
From Python
Compute the segmentation with the TotalSegmentator with docker
from boa_contrast import compute_segmentation
compute_segmentation(
ct_path=..., # The path to the CT
segmentation_folder=..., # The root where the segmentation should be stored
device_id=..., # The ID of the GPU device or -1
user_id=..., # Your user ID for docker to run in user mode
compute_with_docker=False, # Whether to use docker or not
)
Once the segmentation is computed
from boa_contrast import predict
predict(
ct_path=..., # path to the CT
segmentation_folder=..., # path to this CT's segmentation
)
Output:
{
"phase_ensemble_prediction": 0,
"phase_ensemble_predicted_class": "NON_CONTRAST",
"phase_ensemble_probas": array(
[
9.89733540e-01,
3.60637282e-04,
4.79974664e-04,
5.55973168e-04,
8.86987492e-03,
]
),
"git_ensemble_prediction": 0,
"git_ensemble_predicted_class": "NO_CONTRAST_IN_GI_TRACT",
"git_ensemble_probas": array(
[
9.99951577e-01,
4.84187825e-05,
]
),
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file boa_contrast-0.1.4.tar.gz
.
File metadata
- Download URL: boa_contrast-0.1.4.tar.gz
- Upload date:
- Size: 78.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.18 Linux/6.2.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c2081482c804afd89d9f6f75674f2453d2a8d7ab69adbb134034f019e1e8415 |
|
MD5 | f2ae763447108447dd0dbd8c6cb0df96 |
|
BLAKE2b-256 | 88aeed73a562d1d0abd16bffd1ac0b916aa6a3ed50556e1dfaa51606b07b404e |
File details
Details for the file boa_contrast-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: boa_contrast-0.1.4-py3-none-any.whl
- Upload date:
- Size: 78.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.18 Linux/6.2.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c3cb0ebb16b13ac3189aa09d8ad4849af5ba8d480d954a80d5a86e2178f12c8 |
|
MD5 | 69131c668aab7ec68271e8f637ef07dc |
|
BLAKE2b-256 | 7f93879d1f172e3a247ad8014c5805cf1c26154c04c022eb5f0b5f95c62d01af |