Skip to content
Back to skills

Data Pipelines

ASecurity

"Implement and validate DLTK TensorFlow 1.x medical-image readers,

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
devopspythonrustapi

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill data-pipelines --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Pipelines?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Data Pipelines
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-data-pipelines/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-data-pipelines)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: data-pipelines
description: "Implement and validate DLTK TensorFlow 1.x medical-image readers,
  preprocessing, augmentation, patch extraction, and NIfTI/CSV input contracts."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# DLTK data pipelines

Use this route when a task must turn medical-image files or synthetic arrays into
DLTK `Reader`/Estimator inputs. It covers `dltk.io.preprocessing`,
`dltk.io.augmentation`, `dltk.io.abstract_reader`, SimpleITK/NIfTI layouts,
CSV-driven file references, serving placeholders, and safe resampling choices.
It does **not** cover network architecture, optimizer/Estimator orchestration,
or exported-model prediction/stitching; route those to
[model-building](../model-building/SKILL.md),
[training-and-estimators](../training-and-estimators/SKILL.md), or the
inference route.

## Compatibility gate

The public package baseline is DLTK 0.2.1 (provenance: commit
`f94d3bb509eb0741164149acbef0788769a869e4`). Its reader uses TensorFlow 1.x
graph/session APIs (`tf.Session`, `tf.data.Dataset.from_generator`,
`tf.train.SessionRunHook`, and `tf.estimator`). For source-compatible
execution, provision Python 3.7 with TensorFlow 1.15 and dependency versions
that expose those APIs. Do not imply that the code is TensorFlow 2.x
compatible: NumPy-only preprocessing/augmentation checks can run without
TensorFlow, while `abstract_reader` requires the TF1 hook API. SimpleITK,
NIfTI data, and any dataset permissions are separate prerequisites.

## Operating sequence

1. **Freeze the sample contract.** Define the row layout in `file_references`,
   the `mode`, `params`, spatial patch `example_size`, channel count, label
   shape/dtype, and whether a full volume or patches are emitted. A custom
   reader has the exact signature `read_fn(file_references, mode,
   params=None)` and yields dictionaries, normally with `features` and (outside
   PREDICT) `labels`.
2. **Read and orient data explicitly.** Read NIfTI with SimpleITK, convert with
   `sitk.GetArrayFromImage`, and add/stack channels last so a 3-D volume is
   `[z, y, x, channels]` for the TensorFlow examples. Keep the original
   `sitk.Image` metadata outside TensorFlow if output reslicing is needed.
3. **Normalize before training augmentation.** Choose whitening, `[0, 1]`, or
   `[-1, 1]` based on the model contract. Copy an array before using the
   in-place Gaussian offset/noise helpers. Use the safe crop/pad logic in the
   reference rather than assuming the legacy list-indexing implementation works
   with modern NumPy 2.x.
4. **Augment only where valid.** Apply random flips to every synchronized image
   and label with the same decision; apply intensity noise/offset only to image
   channels. Elastic deformation in the legacy helper is not a label interpolation
   contract. In a training reader, ensure `params` has defaults before indexing
   `params['extract_examples']`.
5. **Extract patches with a label policy.** For ordinary patches use
   `extract_random_example_array`; for segmentation use
   `extract_class_balanced_example_array` with image shape `[spatial..., C]` and
   label shape `[spatial...]`. Verify every requested class exists and expect
   fewer than `n_examples` when class availability/weights cannot supply all
   requested patches.
6. **Bind the nested TensorFlow contract.** Construct `dtypes` and
   `example_shapes` with the same dictionary/list structure as each yielded
   example. Shapes describe one unbatched element; `Reader.get_inputs` adds the
   batch dimension. Extra keys are recursively removed by the legacy cleaner,
   while missing keys or dict/list mismatches fail. Do not put arbitrary
   SimpleITK objects in a TensorFlow dtype tree.
7. **Treat PREDICT as a separate branch.** Yield exactly one prediction record
   containing only feature keys declared for prediction, then `return`. Several
   source application readers yield their prediction record and continue into
   label/patch code; copying that pattern can duplicate examples or dereference
   absent labels/params. Test PREDICT independently from TRAIN/EVAL.
8. **Validate on synthetic data first.** Run
   `scripts/preprocessing_smoke.py` and
   `scripts/validate_reader_contract.py` from any working directory. Then use a
   small, permissioned fixture and a bounded TF1 session/Estimator check. Do not
   download, delete, extract untrusted archives, or start full training from
   this route.

## Handoffs

- Pass feature rank/channel and label shape facts to
  [model-building](../model-building/SKILL.md).
- Pass `Reader.get_inputs`, hook, mode, batch, and serving contracts to
  [training-and-estimators](../training-and-estimators/SKILL.md).
- Keep metadata-preserving output and sliding-window stitching in the sibling
  inference/deployment route.

For exact signatures and mutation/shape caveats, read
[references/api-reference.md](references/api-reference.md). For complete reader
and serving wiring, read [references/reader-workflows.md](references/reader-workflows.md).
For CSV, SimpleITK, IXI/MRBrainS conventions, and resampling boundaries, read
[references/data-formats-and-resampling.md](references/data-formats-and-resampling.md).
Use [references/troubleshooting.md](references/troubleshooting.md) when a
contract or compatibility check fails.

Files in this skill

  • SKILL.md5.2 KB
  • references/api-reference.md7.8 KB
  • references/data-formats-and-resampling.md5.6 KB
  • references/reader-workflows.md6.2 KB
  • references/troubleshooting.md5.4 KB
  • scripts/preprocessing_smoke.py5.1 KB
  • scripts/validate_reader_contract.py6.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.