retuve

The first fully Open Source Infant Hip Analysis Package

Retuve (from the scottish gaelic Ri taobh meaning beside) is a framework for analysing infant hips. It is designed to be a flexible and extensible framework that can be used by developers, AI researchers and clinicians.

It takes in raw Hip Ultrasound and X-Ray images, and outputs a report with the labelled images, and the results, exactly as a clinician would.

drawing

Attribution of the above Ultrasound Images: Case courtesy of Ryan Thibodeau from https://radiopaedia.org 172535 (https://radiopaedia.org/cases/172535)

Attribution of the above X-Ray Images: Fraiwan, Mohammad; Al-Kofahi, Noran; Hanatleh, Omar; ibnian, ali (2022), “A dataset of DDH x-ray images”, Mendeley Data, V2, doi: 10.17632/jf3pv98m9g.2

Quickstart

To get started with Retuve, you can install it via pip:

pip install git+https://github.com/radoss-org/retuve.git

You can then run the following code to get a basic report:

import pydicom
from radstract.data.dicom import convert_dicom_to_images
from retuve.defaults.hip_configs import default_US
from retuve.defaults.manual_seg import manual_predict_us
from retuve.funcs import analyse_hip_2DUS
from retuve.testdata import Cases, download_case

# Example usage
dcm_file, seg_file = download_case(Cases.ULTRASOUND_DICOM)

dcm = pydicom.dcmread(dcm_file)
images = convert_dicom_to_images(dcm)

hip_data, img, dev_metrics = analyse_hip_2DUS(
    images[0],
    keyphrase=default_US,
    modes_func=manual_predict_us,
    modes_func_kwargs_dict={"seg": seg_file},
)

img.save("2dus.png")

drawing

Attribution of the above Ultrasound Images: Case courtesy of Ryan Thibodeau from https://radiopaedia.org 172535 (https://radiopaedia.org/cases/172535)

Features

  • pip installable (easy to intergrate with you existing systems)
  • Apache 2.0 Licensed
  • AI is fully pluggable/modular
  • Basic Web Interface bundled
  • CLI Interface
  • Swagger API Provided

Examples

Examples can be found at https://github.com/radoss-org/retuve/tree/main/examples

Docs

We provide high level overviews for different types of users. This includes a tailored description of Retuve, and some highlighted features:

Modalities

Retuve can analyse Hips for:

Developer Guide

You can clone the repository and install the dependencies with the following command:

git clone https://github.com/radoss-org/retuve.git

You can then install retuve with poetry, and then run the tests:

# Needed for the scripts
pip install poethepoet

cd retuve
poetry install

# Generate the test data
poe testgen

# Run all tests, including examples.
poe test_all

# Get info on all other dev scripts
poe help
  1# Copyright 2024 Adam McArthur
  2#
  3# Licensed under the Apache License, Version 2.0 (the "License");
  4# you may not use this file except in compliance with the License.
  5# You may obtain a copy of the License at
  6#
  7#     http://www.apache.org/licenses/LICENSE-2.0
  8#
  9# Unless required by applicable law or agreed to in writing, software
 10# distributed under the License is distributed on an "AS IS" BASIS,
 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12# See the License for the specific language governing permissions and
 13# limitations under the License.
 14
 15"""
 16# The first fully Open Source Infant Hip Analysis Package
 17
 18Retuve (from the scottish gaelic `Ri taobh` meaning `beside`) is a framework for analysing infant hips. It is designed to be a flexible and extensible framework that can be used by developers, AI researchers and clinicians.
 19
 20It takes in raw Hip Ultrasound and X-Ray images, and outputs a report with the labelled images, and the results, exactly as a clinician would.
 21
 22<img src="https://raw.githubusercontent.com/radoss-org/radoss-creative-commons/main/other/224_ddh_115_%26_172535_0_diagram.jpg" alt="drawing" width="500"/>
 23
 24Attribution of the above Ultrasound Images: Case courtesy of Ryan Thibodeau from https://radiopaedia.org 172535 (https://radiopaedia.org/cases/172535)
 25
 26Attribution of the above X-Ray Images: Fraiwan, Mohammad; Al-Kofahi, Noran; Hanatleh, Omar; ibnian, ali (2022), “A dataset of DDH x-ray images”, Mendeley Data, V2, doi: 10.17632/jf3pv98m9g.2
 27
 28# Quickstart
 29
 30To get started with Retuve, you can install it via pip:
 31
 32```bash
 33pip install git+https://github.com/radoss-org/retuve.git
 34```
 35
 36You can then run the following code to get a basic report:
 37
 38```python
 39import pydicom
 40from radstract.data.dicom import convert_dicom_to_images
 41from retuve.defaults.hip_configs import default_US
 42from retuve.defaults.manual_seg import manual_predict_us
 43from retuve.funcs import analyse_hip_2DUS
 44from retuve.testdata import Cases, download_case
 45
 46# Example usage
 47dcm_file, seg_file = download_case(Cases.ULTRASOUND_DICOM)
 48
 49dcm = pydicom.dcmread(dcm_file)
 50images = convert_dicom_to_images(dcm)
 51
 52hip_data, img, dev_metrics = analyse_hip_2DUS(
 53    images[0],
 54    keyphrase=default_US,
 55    modes_func=manual_predict_us,
 56    modes_func_kwargs_dict={"seg": seg_file},
 57)
 58
 59img.save("2dus.png")
 60```
 61<img src="https://raw.githubusercontent.com/radoss-org/radoss-creative-commons/main/other/ultrasound/172535_0_processed.png" alt="drawing" width="500"/>
 62
 63Attribution of the above Ultrasound Images: Case courtesy of Ryan Thibodeau from https://radiopaedia.org 172535 (https://radiopaedia.org/cases/172535)
 64# Features
 65
 66- pip installable (easy to intergrate with you existing systems)
 67- Apache 2.0 Licensed
 68- AI is fully pluggable/modular
 69- Basic Web Interface bundled
 70- CLI Interface
 71- Swagger API Provided
 72
 73# Examples
 74
 75Examples can be found at https://github.com/radoss-org/retuve/tree/main/examples
 76
 77# Docs
 78
 79We provide high level overviews for different types of users. This includes a tailored description of Retuve, and some highlighted features:
 80
 81- For Developers: `retuve.docs.overviews.developers`
 82- For AI Researchers: `retuve.docs.overviews.ai_researchers`
 83- For Clinicians: `retuve.docs.overviews.clinicians`
 84
 85# Modalities
 86
 87Retuve can analyse Hips for:
 88
 89- Ultrasound: `retuve.hip_us`
 90- X-Ray: `retuve.hip_xray`
 91
 92# Developer Guide
 93
 94You can clone the repository and install the dependencies with the following command:
 95
 96```bash
 97git clone https://github.com/radoss-org/retuve.git
 98```
 99
100You can then install retuve with poetry, and then run the tests:
101
102```bash
103# Needed for the scripts
104pip install poethepoet
105
106cd retuve
107poetry install
108
109# Generate the test data
110poe testgen
111
112# Run all tests, including examples.
113poe test_all
114
115# Get info on all other dev scripts
116poe help
117```
118
119"""
120
121__version__ = "0.1.0"