All examples
Images

Reuse a native image pipeline

Run immutable analysis stages with a shared context, executor and explicit resource budget.

image_pipeline.aner
// One selected executor and context are reused across native stages and runs.
import aner.image
import aner.parallel
import aner.tensor

let execution = parallel.local(workers: 1)
let work = image.context_with(execution: execution, memory_mb: 32)
let samples: Tensor = [[0.0, 0.0, 0.0, 0.0, 0.0],
    [0.0, 6.0, 6.0, 6.0, 0.0], [0.0, 6.0, 6.0, 6.0, 0.0],
    [0.0, 6.0, 6.0, 6.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]
let source = image.from_tensor(work, samples)
let analysis = image.pipeline(work).channel(0)
    .gaussian(sigma: 0.5).otsu().components(connectivity: 4)
let result = analysis.run(source)
let regions = result.regions(source)
print(result.labels().count())
print(regions.count())
print(regions.intensity_mean(0))
print(analysis.run(source).labels().count())
print(work.workers())
print(work.peak_bytes())

Make it your experiment.

Use Aner 0.1.0 or newer. Save this program as examples/image_pipeline.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/image_pipeline.aner
aner run examples/image_pipeline.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires Aner 0.1.0 or newer. CPU image analysis and binary PNM work without optional image codecs. PNG, JPEG and TIFF require their compiled capabilities. Use a fresh writable directory for outputs.

Credential setup
aner check examples/image_pipeline.aner
aner run examples/image_pipeline.aner

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner