Skip to content
Back to skills

Simpleitk

ASecurity

"Use SimpleITK for medical-image IO, image metadata, NumPy

  • 247 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 9, 2026
developmentpythonc++bashrailsapibackend

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill simpleitk --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Simpleitk?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Simpleitk
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-simpleitk/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-simpleitk)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: simpleitk
description: "Use SimpleITK for medical-image IO, image metadata, NumPy
  conversion, filtering, segmentation, registration, transforms, and
  source-build troubleshooting."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# SimpleITK Repo Skill

Use this repo skill when a task names SimpleITK, `simpleitk`, `import SimpleITK as sitk`, medical-image IO, DICOM series, image spacing/origin/direction, NumPy image conversion, SimpleITK filters, segmentation, registration, transforms, resampling, or SimpleITK source builds and wrapping.

## Start Here

- Read [references/repo-provenance.md](references/repo-provenance.md) before deciding whether this skill is current for a SimpleITK checkout or whether `refresh-repo-skill` is needed.
- Read [references/source-evidence-map.md](references/source-evidence-map.md) to see which source, docs, examples, tests, scripts, and existing skills informed this self-contained skill.
- Read [references/troubleshooting.md](references/troubleshooting.md) for cross-cutting install/import/version, optional feature, ImageIO, and workflow routing failures.
- Run [scripts/check_simpleitk_env.py](scripts/check_simpleitk_env.py) to inspect a local `SimpleITK` install, NumPy bridge, ImageIO discovery, registration availability, and optional elastix wrappers without needing source data.

## Installation and Import

For ordinary Python usage, prefer a binary install before attempting source builds:

```bash
python -m pip install --upgrade pip
python -m pip install simpleitk
python - <<'PY'
import SimpleITK as sitk
print(sitk.Version())
PY
```

Use conda-forge consistently when the project is conda-based:

```bash
conda create --name sitk python=3.11 simpleitk --channel conda-forge --override-channels
conda activate sitk
```

Import the Python package with `import SimpleITK as sitk`; the distribution name is `simpleitk`.

## Route by Task

| User task | Read this sub-skill |
| --- | --- |
| Construct `sitk.Image`, preserve spacing/origin/direction, inspect pixel IDs, convert to or from NumPy, debug shape reversal | [image-core](sub-skills/image-core/SKILL.md) |
| Read/write MHA, NRRD, NIfTI, PNG, DICOM series, metadata tags, transforms, or ImageIO backends | [io-and-data](sub-skills/io-and-data/SKILL.md) |
| Apply filters, smooth/threshold images, run morphology, connected components, segmentation, N4, or label statistics | [filtering-segmentation](sub-skills/filtering-segmentation/SKILL.md) |
| Configure transforms, resampling, registration metrics/optimizers, callbacks, reproducibility, or optional elastix/transformix workflows | [registration-transforms](sub-skills/registration-transforms/SKILL.md) |
| Install/build SimpleITK, choose PyPI vs conda vs source/SuperBuild, inspect CMake `WRAP_*`, enable optional wrappers, or run maintainer checks | [builds-and-wrapping](sub-skills/builds-and-wrapping/SKILL.md) |

## Core Rules

- Treat a SimpleITK image as a physical object: preserve `GetOrigin()`, `GetSpacing()`, and `GetDirection()` when replacing pixels or moving through NumPy.
- Remember axis order: SimpleITK indexes are `(x, y, z, ...)`; NumPy arrays from SimpleITK are reversed spatially, such as `(z, y, x)` for a 3D scalar image.
- Use `sitk.ImageFileReader().GetRegisteredImageIOs()` and `sitk.ImageFileWriter().GetRegisteredImageIOs()` for registered ImageIO discovery in Python examples.
- Use `.mha` or `.nrrd` for deterministic smoke tests; avoid lossy formats such as JPEG when pixel equality matters.
- Cast registration inputs deliberately to `sitk.sitkFloat32` or `sitk.sitkFloat64` when a metric or optimizer requires floating-point images.
- For label images, use nearest-neighbor interpolation during resampling; use linear interpolation for intensities unless a workflow says otherwise.
- Treat `ElastixImageFilter` and `TransformixImageFilter` as optional build-dependent APIs; absence in a binary install is an installation/build feature issue, not necessarily a typo.

## Source Build Guardrails

Do not start a source build for ordinary SimpleITK API usage. Source builds use native C++/CMake/SWIG tooling and can fetch/build ITK or other dependencies. Route source-build, SuperBuild, wrapping, and optional elastix requests to [builds-and-wrapping](sub-skills/builds-and-wrapping/SKILL.md), and ask before running expensive or mutating commands.

## Self-Containment

This skill distills repository docs, examples, tests, source code, and an installed-package inspection into bundled references and scripts. Runtime instructions here do not require access to the original SimpleITK checkout.

Files in this skill

  • SKILL.md4.5 KB
  • references/repo-provenance.md2.8 KB
  • references/repo-routing-metadata.json498 B
  • references/source-evidence-map.md3.9 KB
  • references/troubleshooting.md5.1 KB
  • scripts/check_simpleitk_env.py5.3 KB
  • sub-skills/builds-and-wrapping/SKILL.md3.8 KB
  • sub-skills/builds-and-wrapping/references/cmake-wrapping.md7.3 KB
  • sub-skills/builds-and-wrapping/references/install-build.md6.6 KB
  • sub-skills/builds-and-wrapping/references/maintainer-checks.md5.4 KB
  • sub-skills/builds-and-wrapping/references/troubleshooting.md6.7 KB
  • sub-skills/builds-and-wrapping/scripts/check_build_metadata.py6.3 KB
  • sub-skills/filtering-segmentation/SKILL.md3.3 KB
  • sub-skills/filtering-segmentation/references/api-reference.md5.9 KB
  • sub-skills/filtering-segmentation/references/filter-patterns.md6.8 KB
  • sub-skills/filtering-segmentation/references/segmentation-recipes.md7.5 KB
  • sub-skills/filtering-segmentation/references/troubleshooting.md5.4 KB
  • sub-skills/filtering-segmentation/scripts/filter_segmentation_smoke.py7.7 KB
  • sub-skills/image-core/SKILL.md3.3 KB
  • sub-skills/image-core/references/api-reference.md5.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.