Wrap SimpleITK functions as command lines
Project description
Wrap SimpleITK functions as command lines
Overview
Create Typer command line interface from functions that use SimpleITK images (and transforms) as arguments or return type.
import SimpleITK as sitk
import typer
from sitk_cli import make_cli
def fill_holes_slice_by_slice(mask: sitk.Image) -> sitk.Image:
mask = mask != 0
output = sitk.Image(mask.GetSize(), mask.GetPixelID())
output.CopyInformation(mask)
for k in range(mask.GetSize()[2]):
output[:, :, k] = sitk.BinaryFillhole(mask[:, :, k], fullyConnected=False)
return output
if __name__ == "__main__":
typer.run(make_cli(fill_holes_slice_by_slice))
Installation
pip install sitk-cli
Demo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sitk-cli-0.4.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file sitk-cli-0.4.0.tar.gz
.
File metadata
- Download URL: sitk-cli-0.4.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46c3392d1c4adee7a11253ef414e4e64a525f32b8a80d7c2f059e81222608479 |
|
MD5 | 7ea778d126722b4f3f9c3ab1b84d3274 |
|
BLAKE2b-256 | 58533ab7ec7fc7eb9a4397f8d6b9e38e54431513b2b53098bdddf46212a9d498 |
File details
Details for the file sitk_cli-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: sitk_cli-0.4.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 360c57a3b88db35fc1147785a0341ad96bc95085ea21568020c065bad085f71a |
|
MD5 | 3382211fd35acbbc4282d90523875cf2 |
|
BLAKE2b-256 | 456f500bf979085fe3805071afda08310a63c0671e6d412c0176753327b74a42 |