io-and-data
Read and write SimpleITK images and transforms, choose ImageIO backends, discover DICOM series, inspect metadata, and validate safe IO round trips.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- io-and-data
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Read and write SimpleITK images and transforms, choose ImageIO backends, discover DICOM series, inspect metadata, and validate safe IO round trips.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/dicom-series.md5.2 KB
- 参考文档references/image-io.md5.8 KB
- 参考文档references/transform-io.md3.0 KB
- 参考文档references/troubleshooting.md5.3 KB
- 脚本scripts/io_roundtrip_smoke.py7.3 KB
03 SKILL.md 正文
SimpleITK IO and Data
Use this sub-skill when a task mentions ReadImage, WriteImage, ImageFileReader, ImageFileWriter, ImageSeriesReader, DICOM series, metadata tags, ImageIO backends, transform IO, or file formats such as MHA, NRRD, NIfTI, PNG, TIFF, JPEG, and DICOM.
Route by Task
- For procedural and object-oriented image reads/writes,
outputPixelType, suffix choices, compression, explicitimageIO, and registered backend discovery, read image-io. - For DICOM directory discovery, series IDs, sorted filenames, metadata dictionaries, tag inspection, and multi-series pitfalls, read dicom-series.
- For
ReadTransform/WriteTransformworkflows, transform format choices, and displacement-field storage caveats, read transform-io. - For missing ImageIO backends, empty DICOM discovery, directory-vs-file mistakes, lossy casts, compression surprises, and transform IO failures, read troubleshooting.
- To validate an installed SimpleITK environment with generated data only, run io_roundtrip_smoke.py.
Core APIs
- Import the Python package as
import SimpleITK as sitk; the package distribution issimpleitk. sitk.ReadImage(fileName, outputPixelType=-1, imageIO='')reads a single image file or an ordered filename sequence; useoutputPixelTypeonly for deliberate casts such as registration float inputs.sitk.WriteImage(image, fileName, useCompression=False, compressionLevel=-1, *, imageIO='', compressor='')writes one image file or a filename sequence when writing a series.sitk.ImageFileReader()andsitk.ImageFileWriter()provideSetFileName,SetImageIO, metadata probing, output pixel type selection, compression settings, and registered ImageIO discovery.- Discover ImageIO backends with
sitk.ImageFileReader().GetRegisteredImageIOs()orsitk.ImageFileWriter().GetRegisteredImageIOs(); do not use a module-level helper for this. sitk.ImageSeriesReader.GetGDCMSeriesIDs(directory)andsitk.ImageSeriesReader.GetGDCMSeriesFileNames(directory, seriesID)discover and sort DICOM slices beforeImageSeriesReader.Execute()reads them.sitk.ReadTransform(filename)andsitk.WriteTransform(transform, filename)round-trip transforms through supported transform IO formats.
Boundaries
- For image construction, pixel containers, spacing/origin/direction fundamentals, indexing, and NumPy views, route to
../image-core/SKILL.md. - For filters, segmentation, intensity transforms, and algorithms that consume loaded images, route to
../filtering-segmentation/SKILL.md. - For registration-generated transforms, transform composition, resampling, displacement-field interpretation, and optimizer-specific output, route to
../registration-transforms/SKILL.md. - Optional
ElastixImageFilterandTransformixImageFilterare build-dependent; do not assume they exist in a SimpleITK install.
Guardrails
- Prefer
.mhaor.nrrdfor deterministic smoke tests and metadata-preserving examples; avoid JPEG for pixel equality because it is lossy. - Use DICOM series discovery for directories; do not pass a directory to
ReadImageand expect a volume. - Treat DICOM metadata as potentially identifying; inspect or copy only tags required by the task.
- Keep runtime workflows self-contained; examples here use generated data or user-supplied paths and do not depend on the original repository checkout.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).