Skip to main content

armcortnet

PyPI Latest Release Code style: black

Armcortnet provides automatic segmentation of the humerus and scapula from CT scans. The deep learning model is trained to also segment out the cortical and trabecular subregions from each bone as well.

The deep learning pipeple consists of using armcrop to crop to an oriented bounding box around each humerus or scapula in the image and then a neural network based traine from the nnUNet framework segments that cropped volume. The segmetnation is then transformed back to the original coordinate system, post-processed and finally saved as a .seg.nrrd file.

Installation

Please install pytorch first before installing armcortnet. You can learn about installing pytorch from the official website here.

Then install armcortnet using pip:

pip install armcortnet

For faster oriented bounding box cropping you can replace onnxruntime with onnxruntime-gpu.

Usage

To generate a segmentation of the humerus or scapula from a CT volume, use the following:

import armcortnet
import SimpleITK as sitk

# initialize the segmentation model
model = armcortnet.Net(bone_type="scapula")  # or "humerus"

# perform segmentation prediction on a CT volume
pred_segmentations = model.predict(
    vol_path="path/to/input/ct.nrrd"
)
# output is a list of SimpleITK images, one for each bone_type detected in the CT
for i, pred_seg in enumerate(pred_segmentations):
    # write each of the segmentations to the disk
    sitk.WriteImage(pred_seg, f"scapula-{i}.seg.nrrd")

A mesh of the predicted bone can be generated using the following:

# perform mesh prediction on a CT volume, returns list of vtkPolyData objects
pred_meshes = model.predict_poly(
    vol_path="path/to/input/ct.nrrd"
)

# iterate over each detected object
for i, cort_trab_polys in enumerate(pred_meshes):
    # iterate over the cortical and trabecular meshes
    for j, poly in enumerate(cort_trab_polys):
        armcortnet.write_polydata(p, f"scapula_{i}_{j}.ply")

Output Labels

The segmentation output contains the following labels:

  • 0: Background
  • 1: Other adjacent bones ("i.e clavicle, radius, ulna, etc.")
  • 2: Cortical region of bone of interest
  • 3: Trabecular region of bone of interest

Note: label 1 is removed when post-processing is used

Models

Trained models are automatically downloaded from HuggingFace Hub (gregspangenberg/armcortnet) on first use.

How to Cite

If you use armcortnet in your research, please cite the package:

@software{armcortnet,
  author = {Spangenberg, Greg},
  title = {armcortnet: Automatic segmentation of humerus and scapula from CT scans},
  url = {https://pypi.org/project/armcortnet/},
  year = {2025}
}

Metadata

Release files for armcortnet 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for armcortnet 0.8.0
File Size Uploaded
armcortnet-0.8.0.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for armcortnet 0.8.0
File Interpreter ABI Platform
armcortnet-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / armcortnet-0.8.0.tar.gz

Download URL armcortnet-0.8.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
32d87b2f77bc5f6cb16dbe69d499a04e6eb85f457f6ed2217b84a58a2167918f
BLAKE2b-256 checksum
How to use checksums
64d695009c6ca1e69b87499c69b461d1132e35a7d42077b73db501cff1fb8404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / armcortnet-0.8.0-py3-none-any.whl

Download URL armcortnet-0.8.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1d79c5d9d18e4d7356889fb456889843c5fc6258d8dc913b904db7d8bcd8b08
BLAKE2b-256 checksum
How to use checksums
2f7369809e6fa276bf188b7afb8ad3f2e2a7078f7989f958a9fe99dc5200e1ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page