Skip to content

A machine learning model that does oriented bounding box cropping of CT scans to any bone of interest in the arm

License

Notifications You must be signed in to change notification settings

gregspangenberg/armcrop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

armcrop

PyPI Latest Release Code style: black

This package contains a machine learning model that can crop a CT scan to any of the following classes:

  • clavicle
  • scapula
  • humerus
  • radius_ulna
  • hand

It can do both axis aligned cropping and oriented bounding box (obb) cropping. The obb cropping allows for rigid registration of CT scans.

This model was trained on arm only scans and proximal half chest scans. A limitation of this model is that when using a full chest CT where the spine is present the model will struggle to differentiate between it and the scapula.

Installation

To use CPU execution install with:

pip install armcrop

To use CUDA execution you will need to also install torch and onnxruntime-gpu.

Usage

import armcrop
import SimpleITK as sitk

# load CT scan
volume = sitk.ReadImage("path/to/ct_scan.nrrd")

# Oriented Bounding Box Cropping
cropper = armcrop.CropOrientedBoundingBox(volume)
cropped_images = cropper.process(bone="humerus")
for i, img in enumerate(cropped_images):
    sitk.WriteImage(img, f"aligned_humerus-{i}.nrrd")

# Bounding Box Cropping
cropper = armcrop.Crop(volume)
output = cropper.process(bone="scapula")
for i, img in enumerate(output):
    sitk.WriteImage(img, f"cropped_scapula-{i}.nrrd")

About

A machine learning model that does oriented bounding box cropping of CT scans to any bone of interest in the arm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages