All examples
Images

Analyze a typed native image

Create bounded native pixels, retain read only views and make numerical conversion explicit.

image_basics.aner
// Unpublished image APIs; all data is local and deterministic.
import aner.image
import aner.tensor

let work = image.context(workers: 1, memory_mb: 32)
let samples: Tensor = [[0.0, 1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0, 7.0], [8.0, 9.0, 10.0, 11.0]]
let pixels = image.from_tensor(work, samples, dtype: "UInt16", layout: "HW")
let view = pixels.crop(x: 1, y: 1, width: 2, height: 2)
let packed = view.copy()
print(pixels.dtype())
print(view.sample(0, 0))
print(view.contiguous())
print(packed.contiguous())
print(pixels.cast("Float64").stats().mean())
print(work.used_bytes())
print(work.peak_bytes())

Make it your experiment.

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

Terminal
aner check examples/image_basics.aner
aner run examples/image_basics.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_basics.aner
aner run examples/image_basics.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