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.1.tar.gz (6.4 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slicerio-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 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.1.tar.gz
Algorithm Hash digest
SHA256 6536c3df655ebd45216b27c6df9bf62a6de54ea8b4a66d94b8e2ebacef8cbcfb
MD5 330f0caddd5829772dc187a0faf7cdfb
BLAKE2b-256 8fca576f730a55a10897864e44573ec00d9e0731c6a2101757a7874557cdbe20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slicerio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25665929e1cf1cc699c5699cd94e7ac16f265ee8dc89aa7028545599488c6c5e
MD5 d881eb9c4fb7650556883e5a3258856b
BLAKE2b-256 3b6b856bc0bf67cfa86e58dd376dde09e9a8c985b22971e1409985cc2e922b60

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