Skip to main content

Utilities for 3D Slicer

Project description

Python package Upload Python Package PyPI version

slicerutils

Python utilities for 3D Slicer interoperability.

The package contains utility functions for reading and writing segmentation files. More functions will be added in the future.

Installation

Using pip:

pip install slicerutils

Example

  1. Read segmentation and show some information about segments
import slicerutils
segmentation_info = slicerutils.read_segmentation_info("Segmentation.seg.nrrd")

number_of_segments = len(segmentation_info["segments"])
print(f"Number of segments: {number_of_segments}")

segment_names = slicerutils.segment_names(segmentation_info)
print(f"Segment names: {', '.join(segment_names)}")

segment0 = segment_from_name(segmentation_info, names[0])
print(f"First segment info: {segment0})

Extract selected segments with chosen label values

extracted_filename = "c:/Users/andra/OneDrive/Projects/SegmentationPynrrd/SegmentationExtracted.seg.nrrd"
voxels, header = nrrd.read(filename)
segment_list = [("Segment_1", 10), ("Segment_3", 12), ("Segment_4", 6)]
extracted_voxels, extracted_header = extract_segments(voxels, header, segmentation_info, segment_list)
nrrd.write(extracted_filename, extracted_voxels, extracted_header)

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

slicerio-0.1.0.tar.gz (761.7 kB view details)

Uploaded Source

Built Distribution

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

slicerio-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file slicerio-0.1.0.tar.gz.

File metadata

  • Download URL: slicerio-0.1.0.tar.gz
  • Upload date:
  • Size: 761.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.4

File hashes

Hashes for slicerio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65011ed0eaae00c9bcf1e0df1cc1ee070f820229a5b1b5be9eafd560d10c96ee
MD5 4e06a6ded1389b5e6f889dd3126d69dc
BLAKE2b-256 804673da14240fa9656c14c6f966b19df3dfd785ed59e995ca02c07824065e13

See more details on using hashes here.

File details

Details for the file slicerio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: slicerio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.4

File hashes

Hashes for slicerio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aec416e0db61ff70d5aa067628caa9462a8e7d2591e6e09a1d3f695215bd8630
MD5 63fc94546872f9e54336ca2e060431d4
BLAKE2b-256 e7e82507cc06e59b18933fcecbb58c1b245e5b08211dbb883d1f5b1eea845d8e

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