技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
simpleitk【数据与研究】Use SimpleITK for medical-image IO, image metadata, NumPy conversion, filtering, segmentation, registration, transforms, and source-build troubleshooting.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
refresh-repo-skill is needed.SimpleITK install, NumPy bridge, ImageIO discovery, registration availability, and optional elastix wrappers without needing source data.For ordinary Python usage, prefer a binary install before attempting source builds:
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:
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.
| 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 |
| Read/write MHA, NRRD, NIfTI, PNG, DICOM series, metadata tags, transforms, or ImageIO backends | io-and-data |
| Apply filters, smooth/threshold images, run morphology, connected components, segmentation, N4, or label statistics | filtering-segmentation |
| Configure transforms, resampling, registration metrics/optimizers, callbacks, reproducibility, or optional elastix/transformix workflows | registration-transforms |
Install/build SimpleITK, choose PyPI vs conda vs source/SuperBuild, inspect CMake WRAP_*, enable optional wrappers, or run maintainer checks | builds-and-wrapping |
GetOrigin(), GetSpacing(), and GetDirection() when replacing pixels or moving through NumPy.(x, y, z, ...); NumPy arrays from SimpleITK are reversed spatially, such as (z, y, x) for a 3D scalar image.sitk.ImageFileReader().GetRegisteredImageIOs() and sitk.ImageFileWriter().GetRegisteredImageIOs() for registered ImageIO discovery in Python examples..mha or .nrrd for deterministic smoke tests; avoid lossy formats such as JPEG when pixel equality matters.sitk.sitkFloat32 or sitk.sitkFloat64 when a metric or optimizer requires floating-point images.ElastixImageFilter and TransformixImageFilter as optional build-dependent APIs; absence in a binary install is an installation/build feature issue, not necessarily a typo.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, and ask before running expensive or mutating commands.
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.