Skip to main content

A machine learning model that crops CT scans to a bone of interest in the arm

Project description

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")

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

armcrop-1.2.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

armcrop-1.2.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file armcrop-1.2.0.tar.gz.

File metadata

  • Download URL: armcrop-1.2.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.7 Linux/6.11.0-26-generic

File hashes

Hashes for armcrop-1.2.0.tar.gz
Algorithm Hash digest
SHA256 80ddba66bc5b0b3f81c5b9adfa3d35a554a3f21c1d4ea66df0e6bad24f5890ff
MD5 23412adbd6e7863289cfa483706e949b
BLAKE2b-256 3e6fcb489ce91f0b0551d09ced4cf0f3f7f2274af5091a94848eefc323c5e664

See more details on using hashes here.

File details

Details for the file armcrop-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: armcrop-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.7 Linux/6.11.0-26-generic

File hashes

Hashes for armcrop-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a74face081eca804e8d1bdebcea397f24e4a78c6a4c6a2a4bbd10ffcfdef3c9d
MD5 f0193e0da348f1bc92c681594291132b
BLAKE2b-256 eff80fcc9eee609c434d64d28da9f6c82a594d2fcbfada40a70523154aa85416

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page