Nitrain

From lza6/Armor-piercing-system-prompts · View interactive version

Nitrain is an AI agent skill from the GitHub repository lza6/Armor-piercing-system-prompts. Routes Nitrain medical-imaging dataset, preprocessing, training, and prediction workflows.

How to use this skill

Skill file

Nitrain

Nitrain is a framework-agnostic Python library for medical-imaging datasets,

image transforms, sampling, model training, and prediction. Use this skill when

users ask about Dataset, Loader, Trainer, Predictor, ANTsPy-based image

workflows, or the package-level APIs exposed by nitrain.

Install at a glance

Read references/installation.md for the

verified CPU stack, workflow-specific pins, and the small set of packages that

cover the inspected workflows.

For a quick import check from an installed environment:

python -c "import nitrain as nt; print(nt.__version__); from nitrain import readers, transforms, samplers; print(readers.ImageReader, transforms.RangeNormalize, samplers.SliceSampler)"

For a broader smoke check, run scripts/check_install.py:

python scripts/check_install.py --mode all

Use --mode base, --mode datasets, --mode preprocess, --mode models,

--mode predictor, or --mode torch if you only want one workflow family.

Route map

[sub-skills/datasets-readers/SKILL.md](sub-skills/datasets-readers/SKILL.md)

Use this route when you need to build datasets from local files, CSV/TSV

columns, folder labels, in-memory arrays or images, nested reader structures,

example data, or Google Cloud storage.

Typical requests:

Read sub-skills/datasets-readers/SKILL.md when the task is about data layout, reader choice, or missing-file / credential errors.

[sub-skills/preprocessing-and-loading/SKILL.md](sub-skills/preprocessing-and-loading/SKILL.md)

Use this route when you need to apply transforms, compose random augmentations,

choose samplers, or batch data with Loader and Loader.to_keras().

Typical requests:

Read sub-skills/preprocessing-and-loading/SKILL.md when the task is about shape changes, augmentation pipelines, or loader batching.

[sub-skills/models-training/SKILL.md](sub-skills/models-training/SKILL.md)

Use this route when you need to discover architectures, list available model

families, fetch pretrained weights, or train/evaluate Keras/TensorFlow or

Torch/MONAI models with Nitrain trainers.

Typical requests:

Read sub-skills/models-training/SKILL.md when the task is about model construction, trainer defaults, metrics, saving, or framework detection.

[sub-skills/prediction-and-explanation/SKILL.md](sub-skills/prediction-and-explanation/SKILL.md)

Use this route when you need to run slice-based prediction with Predictor or

inspect the current OcclusionExplainer surface.

Typical requests:

Read sub-skills/prediction-and-explanation/SKILL.md when the task is about inference output shape, slice-axis handling, or the explainer stub.

Common prerequisites

Keras/TensorFlow model and trainer workflows.

Public quirks worth remembering

callable from nitrain.models.fetch_pretrained.

in the inspected source tree.

When to read the supporting references

install matrix and the safest package pins for this snapshot.

cross-cutting import, version, and backend issues that affect several

workflows.

whether this skill still matches the current checkout before you reuse it or

refresh it.

the package and the selected workflow family without reopening the source

checkout.

How to think about the package

Nitrain is best treated as four user-facing workflow families:

  1. dataset and reader construction,
  2. preprocessing and loading,
  3. model discovery and training,
  4. prediction and the current explainer surface.

Each family has its own sub-skill because the package combines imaging data

layout, transforms, samplers, model backends, and output post-processing in a

way that is easier to use when routed separately.

Before you refresh or reuse this skill

If the current repository commit, package version, or exported API surface has

changed, this skill may be stale. Read references/repo-provenance.md first,

then refresh the skill instead of assuming the guidance still matches the code.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.