registration-transforms
Register ANTsPy images and manage transform application, transform IO, displacement fields, motion correction, templates, landmarks, and Jacobian diagnostics.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- registration-transforms
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Register ANTsPy images and manage transform application, transform IO, displacement fields, motion correction, templates, landmarks, and Jacobian diagnostics.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md12.4 KB
- 参考文档references/transform-types.md8.3 KB
- 参考文档references/troubleshooting.md7.5 KB
- 参考文档references/workflows.md13.5 KB
- 脚本scripts/antspy_registration_smoke.py4.6 KB
03 SKILL.md 正文
ANTsPy Registration and Transforms
Use this sub-skill when a task is about image registration, transform lists, applying transforms to images or points, transform object IO, displacement-field composition/inversion, motion correction, template building, Jacobian/deformation diagnostics, warped grids, landmarks, or FSL-to-ANTs linear transform conversion.
Start Here
- Import the public package as
import ants; the package distribution isantspyx. - Choose the cheapest transform family that can solve the task using transform types.
- Check verified signatures, return keys, transform-list rules, and IO helpers in API reference.
- Use workflows for fast rigid/affine registration, transform application to images/points, multi-metric registration, motion correction, template building, Jacobians, displacement fields, landmarks, and validation.
- Use troubleshooting when output is misplaced, labels are interpolated incorrectly, transform files are missing, dimensions disagree, or SyN is too slow.
- Run scripts/antspy_registration_smoke.py for a tiny bounded runtime check in an environment with
antspyxinstalled.
Core Contracts
ants.registration(fixed, moving, ...)returnswarpedmovout,warpedfixout,fwdtransforms, andinvtransforms; time-varying registrations can also returnvelocityfield.- Use
tx["fwdtransforms"]withants.apply_transforms(fixed=fixed, moving=moving, ...)to resample the moving image into the fixed image domain. - Point mapping follows the opposite practical convention from image resampling: use physical-coordinate point DataFrames and set
whichtoinvertdeliberately, especially for affine.matfiles. whichtoinvertmust have one boolean per transform; only matrix transforms can be inverted this way, never warp/displacement-field files.- Prefer
Translation,Rigid,QuickRigid,AffineFast, orantsRegistrationSyNQuick[...]with explicit iteration limits for tests and debugging; default nonlinear SyN can be expensive. - Transform files are produced as task-owned runtime outputs. If they must be reused, set an explicit writable
outprefixor composition filename and keep those files with the task output.
Route Elsewhere
- Create, read, write, inspect, clone, compare, and repair
ANTsImagephysical metadata: image-core. - Preprocess before registration with masks, smoothing, denoising, cropping, thresholding, histogram matching, morphology, or resampling: image-ops-math.
- Use transformed outputs for segmentation, label overlap, label geometry, or label statistics: segmentation-labels.
- Plot warped images, grids, overlays, animations, or external visualization formats: visualization-interop.
- Use transforms inside learning-specific augmentation or patch pipelines: learning-deeplearn.
Boundary Notes
- This sub-skill covers registration mechanics and transform semantics. It does not teach image loading, mask construction, segmentation interpretation, or plotting beyond routing to the relevant sub-skill.
ants.apply_transformscan resample label images, but choose label-safe interpolation here and handle label-specific analysis insegmentation-labels.- Landmark helpers use physical coordinates. Convert voxel indices with image-core coordinate utilities before applying point transforms.
References
- API reference: verified public signatures, registration dict keys, transform application, transform IO, displacement helpers, landmarks, and FSL conversion.
- Workflows: bounded registration recipes, image/point transform application, multi-metric registration, motion correction, templates, Jacobians, fields, landmarks, and validation checks.
- Transform types: transform family selection, speed/quality tradeoffs, inversion/order semantics, interpolators,
imagetype, and composite/displacement outputs. - Troubleshooting: wrong transform direction, dimension/metadata mismatch, interpolation problems, missing files, expensive registrations, and temporary-output expectations.
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).