AGENT SKILL

segmentation-labels

Use ANTsPy segmentation and label workflows for Atropos, k-means, Otsu, priors, joint label fusion, label statistics, overlap, geometry, matrices, centroids, points, and multi-label morphology.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
segmentation-labels
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use ANTsPy segmentation and label workflows for Atropos, k-means, Otsu, priors, joint label fusion, label statistics, overlap, geometry, matrices, centroids, points, and multi-label morphology.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

ANTsPy Segmentation and Labels

Use this sub-skill when a task asks for ANTsPy segmentation, label images, connected components, label statistics, overlap/geometry measures, label matrices, centroid or point-image workflows, multi-label morphology, or segmentation-to-mask/registration handoffs.

Start Here

  1. Import the public package as import ants; the package distribution is antspyx.
  2. Check verified signatures and return contracts in API reference.
  3. Pick a recipe from workflows: k-means, Atropos, Otsu, prior-based segmentation, joint label fusion, label stats/overlap/matrix, point images, or mask alignment validation.
  4. Use troubleshooting before changing class counts, masks, priors, label dtypes, or physical metadata.
  5. Run scripts/antspy_segmentation_smoke.py for a tiny deterministic in-memory check in an environment with antspyx installed.

Core Contracts

  • ants.atropos(...), ants.kmeans_segmentation(...), and ants.prior_based_segmentation(...) return dictionaries with segmentation and probabilityimages; ants.otsu_segmentation(...) returns only an ANTsImage label image.
  • ants.joint_label_fusion(...) returns an ANTsImage for intensity-only fusion when no labels are supplied, and a dictionary with segmentation, intensity, probabilityimages, and segmentation_numbers when label_list is supplied.
  • ants.fuzzy_spatial_cmeans_segmentation(...) and ants.functional_lung_segmentation(...) use snake_case keys segmentation_image and probability_images; lung segmentation also returns processed_image.
  • Label-measure helpers generally clone labels to unsigned int; non-integer or out-of-range labels can fail or silently collapse if not validated first.
  • Overlap, statistics, matrices, and label/image interactions assume matching dimension, shape, origin, spacing, and direction; validate with image-core helpers before computing metrics.
  • Register intensity images with registration-transforms, apply transforms to labels with nearest-neighbor or label-safe interpolation, then return here for label statistics and overlap.

Route Elsewhere

  • Image creation, IO, cloning, metadata repair, dtype conversion, image_physical_space_consistency, and coordinate transforms: image-core.
  • Generic masks, thresholding, binary/grayscale morphology, smoothing, resampling, bias correction, and iMath: image-ops-math.
  • Registration mechanics, transform lists, and label-safe transform application: registration-transforms.
  • Plotting label overlays or exporting images for visualization: visualization-interop.
  • Learning one-hot segmentation, patch extraction, and augmentation workflows: learning-deeplearn.

References

  • API reference: verified public signatures, return keys, label dataframe contracts, dtype rules, and expensive-function caveats.
  • Workflows: self-contained recipes for segmentation, priors, labels, overlap/statistics, label matrices, centroids, points, and registration/mask interactions.
  • Troubleshooting: Atropos probability failures, mask/image mismatch, class ordering, label dtype handling, joint label fusion/KellyKapowski costs, and physical-space consistency before overlap.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351