Skip to main content

Add your description here

Project description

Model

Setup

Install uv

https://docs.astral.sh/uv/getting-started/installation/

uv venv                                     # creates venv
uv sync --all-extras --dev                  # installs dependencies on venv
uv run -m segmentation.examples.models      # this is how to run .py files

Format code with ruff

uv run ruff check --select I --fix    # format imports, or run without --fix to check only
uv run ruff format                    # format code, or run with --check

Check typing

uv run mypy . --config-file pyproject.toml  # runs type linter

Library quickstart

Minimal, copy-pasteable way to predict the packaged TorchScript model on your own NIfTI image

from pathlib import Path

import torch

from neuroimaging import VolumeSegmenter, Transforms

image_path = Path("path/to/your_scan.nii.gz")
device = "cpu"

input_tensor = VolumeSegmenter.prepare_input(image_path, device=device)

preprocessor = Transforms.normalize_input()
normalized_data = preprocessor({"image": input_tensor})
input_tensor = normalized_data["image"].to(device)

segmenter = VolumeSegmenter.from_pretrained(device=device)
mask = segmenter.predict(
    input_tensor, output_path=image_path.with_name("predicted_mask.nii.gz")
)

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

neuroimaging-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

neuroimaging-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neuroimaging-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for neuroimaging-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aa6ca83fda0cc03789029da2beef5064e640cbfbbd6633eb934718a54c353018
MD5 06c2bcfc62a830e16a7c7a171e155924
BLAKE2b-256 f8e11c525a8c9cccf122c55e983230ee9c1da6863822a651adf2ba0514f12ece

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroimaging-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for neuroimaging-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0ed979fbc1136531519468e384218f7277688a1f27374fe590054d1247356c9
MD5 c6dcf61ffc42ce880044de25497ea083
BLAKE2b-256 cb396d0318537b510313c74ba8a6e0a757daef55a57426fe888396e78f44fe59

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