Image API reference
Inspect exact native image signatures, defaults, typed views, analysis contracts and integration boundaries.
ImplementedAner 0.1.0 or newerGenerated from the same declarations as native bindings and editor help. See Aner Image for resource, precision, ownership, coordinate, codec and execution contracts.
All indices are zero based. Images, views, masks, labels, regions and plans are immutable. Contexts share a live byte ledger and persistent executor. Scalar sample access is for inspection; bulk operations execute native kernels. Tensor exports are owned detached CPU copies with explicit dtype/layout; no hidden device readback. Named defaults do not change source evaluation order.
| Native call | Result | Contract |
|---|---|---|
image.context(memory_mb:Int64=512, workers:Int64=0, tile_rows:Int64=32, max_components:Int64=1000000) | ImageContext | Create one persistent native executor and shared image buffer byte ledger. Zero workers uses CPU admission policy; reuse this context. |
image.context_with(execution:ParallelContext, memory_mb:Int64=512, tile_rows:Int64=32, max_components:Int64=1000000) | ImageContext | Borrow an existing local CPU executor. Nested/concurrent use follows aner.parallel admission rules. |
image.create(context:ImageContext, width:Int64, height:Int64, channels:Int64=1, dtype:String="UInt8", value:Float64=0.0) | Image | Create a typed constant image. Integer values must be exactly representable. |
image.load(context:ImageContext, path:String, page:Int64=0) | Image | Decode a local image under the context budget; preserve sample dtype and range. Optional codecs are explicit capabilities. |
image.load_region(context:ImageContext, path:String, x:Int64, y:Int64, width:Int64, height:Int64, page:Int64=0) | Image | Read a pixel region. Decoder specific source/workspace limits still apply; this is not a universal out of core guarantee. |
image.inspect(context:ImageContext, path:String, page:Int64=0) | ImageInfo | Read a typed header without decoding pixel storage. |
image.save(value:Image, path:String, format:String="auto", quality:Int64=95) | Unit | Write a new image file; existing files are preserved. JPEG encoding is explicitly lossy; unsupported dtype/format pairs fail. |
image.available(format:String) | Bool | Report a compiled native format capability; does not open files. |
image.capabilities() | String | Report native format capabilities; configuration and execution never download codecs. |
image.pipeline(context:ImageContext) | ImagePlan | Create an immutable reusable analysis plan using the supplied context. |
image.channel(value:Image, index:Int64) | Image | Select one channel; Image selection is a strided immutable view. |
image.gaussian(value:Image, sigma:Float64=1.0, border:String="reflect", invalid:String="reject") | Image | Separable native Gaussian filter with explicit border and invalid sample policy. |
image.threshold(value:Image, cutoff:Float64, above:Bool=true, invalid:String="reject") | ImageMask | Create a strict threshold mask; ignored invalid samples are excluded. |
image.otsu(value:Image, bins:Int64=256, invalid:String="reject") | ImageMask | Otsu mask from the finite source range. Constant images produce empty strict above foreground. |
image.channel(value:ImagePlan, index:Int64) | ImagePlan | Select one channel; Image selection is a strided immutable view. |
image.gaussian(value:ImagePlan, sigma:Float64=1.0, border:String="reflect", invalid:String="reject") | ImagePlan | Separable native Gaussian filter with explicit border and invalid sample policy. |
image.threshold(value:ImagePlan, cutoff:Float64, above:Bool=true, invalid:String="reject") | ImagePlan | Create a strict threshold mask; ignored invalid samples are excluded. |
image.otsu(value:ImagePlan, bins:Int64=256, invalid:String="reject") | ImagePlan | Otsu mask from the finite source range. Constant images produce empty strict above foreground. |
image.components(value:ImageMask, connectivity:Int64=8) | ImageLabels | Exact UInt32 connected component labels, background zero; stable first pixel ordering with four or eight connectivity. |
image.components(value:ImagePlan, connectivity:Int64=8) | ImagePlan | Exact UInt32 connected component labels, background zero; stable first pixel ordering with four or eight connectivity. |
image.run(value:ImagePlan, source:Image) | ImageResult | Execute the plan in order; source input and previous results remain immutable. |
image.run(value:ImagePlan, source:String) | ImageResult | Execute the plan in order; source input and previous results remain immutable. |
image.copy(value:Image) | Image | Make an explicit owned copy under the image context budget. |
image.crop(value:Image, x:Int64, y:Int64, width:Int64, height:Int64) | Image | Read only ROI view; retains the parent allocation and updates physical origin. |
image.cast(value:Image, dtype:String, conversion:String="exact") | Image | Explicit sample conversion. Exact conversion rejects precision loss; clipping requires an explicit policy. |
image.scale(value:Image, factor:Float64, offset:Float64=0.0, dtype:String="Float32") | Image | Apply value*factor+offset into the explicit destination dtype. |
image.resize(value:Image, width:Int64, height:Int64, filter:String="nearest", invalid:String="reject") | Image | Resize with explicit nearest/bilinear sampling and calibrated geometry. |
image.flip(value:Image, axis:String="horizontal") | Image | Flip pixels and physical coordinate mapping. |
image.rotate(value:Image, turns:Int64=1) | Image | Rotate by integer quarter turns without interpolation. |
image.grayscale(value:Image, method:String="mean") | Image | Explicit channel reduction; no hidden gamma or ICC transformation. |
image.rgb(value:Image) | Image | Explicit replication of one numeric channel into three RGB channels; alpha is not silently discarded. |
image.calibrate(value:Image, spacing_x:Float64, spacing_y:Float64, units:String="pixel") | Image | Metadata only view with positive pixel spacing. Unit labels are descriptive and are not automatically converted. |
image.physical_x(value:Image, x:Float64, y:Float64) | Float64 | Map a pixel center coordinate into calibrated physical coordinates. |
image.physical_y(value:Image, x:Float64, y:Float64) | Float64 | Map a pixel center coordinate into calibrated physical coordinates. |
image.dilate(value:ImageMask, radius:Int64=1) | ImageMask | Native binary morphology with declared zero background borders. |
image.erode(value:ImageMask, radius:Int64=1) | ImageMask | Native binary morphology with declared zero background borders. |
image.open(value:ImageMask, radius:Int64=1) | ImageMask | Native binary morphology with declared zero background borders. |
image.close(value:ImageMask, radius:Int64=1) | ImageMask | Native binary morphology with declared zero background borders. |
image.stats(value:Image, channel:Int64=0, invalid:String="reject") | ImageStatistics | Deterministic statistics. Empty valid support has count zero and undefined moments; inspect count before moment access. |
image.masked_stats(value:Image, mask:ImageMask, channel:Int64=0, invalid:String="reject") | ImageStatistics | Statistics on selected pixels with exact validity counts. |
image.histogram(value:Image, bins:Int64=256, minimum:Float64=0.0, maximum:Float64=255.0, channel:Int64=0, invalid:String="reject") | ImageHistogram | Exact integer bin counts in an explicit inclusive range; out of range finite samples fail. |
image.cutoff(value:ImageHistogram) | Float64 | Return the deterministic Otsu threshold for this histogram. |
image.bin(value:ImageHistogram, index:Int64) | Int64 | Read an exact bin count. |
image.regions(value:ImageLabels, source:Image, channel:Int64=0, invalid:String="reject") | ImageRegions | Measure components against the explicit original intensity image. Shape/geometry must match. |
image.regions(value:ImageResult, source:Image, channel:Int64=0, invalid:String="reject") | ImageRegions | Measure components against the explicit original intensity image. Shape/geometry must match. |
image.label(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.area(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.x(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.y(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.region_width(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.region_height(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.valid_count(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.invalid_count(value:ImageRegions, index:Int64) | Int64 | Read one checked native region measurement; region indices are zero based. |
image.centroid_x(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.centroid_y(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.physical_area(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.intensity_mean(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.intensity_minimum(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.intensity_maximum(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.intensity_sum(value:ImageRegions, index:Int64) | Float64 | Read one checked native region measurement; region indices are zero based. |
image.width(value:Image) | Int64 | Read image dimensions without copying pixels. |
image.height(value:Image) | Int64 | Read image dimensions without copying pixels. |
image.width(value:ImageMask) | Int64 | Read image dimensions without copying pixels. |
image.height(value:ImageMask) | Int64 | Read image dimensions without copying pixels. |
image.width(value:ImageLabels) | Int64 | Read image dimensions without copying pixels. |
image.height(value:ImageLabels) | Int64 | Read image dimensions without copying pixels. |
image.width(value:ImageInfo) | Int64 | Read image dimensions without copying pixels. |
image.height(value:ImageInfo) | Int64 | Read image dimensions without copying pixels. |
image.dtype(value:Image) | String | Read the exact stored sample dtype or channel count. |
image.channels(value:Image) | Int64 | Read the exact stored sample dtype or channel count. |
image.dtype(value:ImageInfo) | String | Read the exact stored sample dtype or channel count. |
image.channels(value:ImageInfo) | Int64 | Read the exact stored sample dtype or channel count. |
image.pages(value:ImageInfo) | Int64 | Read retained file/page header metadata. |
image.page(value:ImageInfo) | Int64 | Read retained file/page header metadata. |
image.orientation(value:ImageInfo) | Int64 | Read retained file/page header metadata. |
image.format(value:ImageInfo) | String | Read the detected format, independent of filename extension. |
image.spacing_x(value:Image) | Float64 | Read calibrated sample spacing. |
image.spacing_y(value:Image) | Float64 | Read calibrated sample spacing. |
image.units(value:Image) | String | Read the descriptive physical unit label. |
image.metadata(value:Image) | String | Return bounded geometry/source metadata as JSON; contains no pixel payload. |
image.contiguous(value:Image) | Bool | Report whether the image view is contiguous. |
image.retained_bytes(value:Image) | Int64 | Read the full retained parent allocation, including pixels outside a crop. |
image.sample(value:Image, x:Int64, y:Int64, channel:Int64=0) | Float64 | Read one checked scalar sample; bulk kernels avoid per pixel language overhead. |
image.sample(value:ImageMask, x:Int64, y:Int64, channel:Int64=0) | Bool | Read one checked scalar sample; bulk kernels avoid per pixel language overhead. |
image.sample(value:ImageLabels, x:Int64, y:Int64, channel:Int64=0) | Int64 | Read one checked scalar sample; bulk kernels avoid per pixel language overhead. |
image.image(value:ImageMask) | Image | Return the immutable numeric image associated with this result. |
image.image(value:ImageResult) | Image | Return the immutable numeric image associated with this result. |
image.mask(value:ImageResult) | ImageMask | Return the immutable typed pipeline result. |
image.labels(value:ImageResult) | ImageLabels | Return the immutable typed pipeline result. |
image.count(value:ImageLabels) | Int64 | Read component/region/valid-sample count. |
image.count(value:ImageRegions) | Int64 | Read component/region/valid-sample count. |
image.count(value:ImageStatistics) | Int64 | Read component/region/valid-sample count. |
image.count(value:ImageHistogram) | Int64 | Read component/region/valid-sample count. |
image.invalid(value:ImageStatistics) | Int64 | Read invalid selected sample count. |
image.minimum(value:ImageStatistics) | Float64 | Read a finite bound; undefined statistics fail explicitly. |
image.maximum(value:ImageStatistics) | Float64 | Read a finite bound; undefined statistics fail explicitly. |
image.invalid(value:ImageHistogram) | Int64 | Read invalid selected sample count. |
image.minimum(value:ImageHistogram) | Float64 | Read a finite bound; undefined statistics fail explicitly. |
image.maximum(value:ImageHistogram) | Float64 | Read a finite bound; undefined statistics fail explicitly. |
image.sum(value:ImageStatistics) | Float64 | Read a checked statistic. Variance uses the documented population denominator. |
image.mean(value:ImageStatistics) | Float64 | Read a checked statistic. Variance uses the documented population denominator. |
image.variance(value:ImageStatistics) | Float64 | Read a checked statistic. Variance uses the documented population denominator. |
image.stddev(value:ImageStatistics) | Float64 | Read a checked statistic. Variance uses the documented population denominator. |
image.used_bytes(value:ImageContext) | Int64 | Read context owned allocation accounting; Tensor exports and external provider allocations have separate accounting. |
image.peak_bytes(value:ImageContext) | Int64 | Read context owned allocation accounting; Tensor exports and external provider allocations have separate accounting. |
image.remaining_bytes(value:ImageContext) | Int64 | Read context owned allocation accounting; Tensor exports and external provider allocations have separate accounting. |
image.workers(value:ImageContext) | Int64 | Read configured native compute worker count; this is not a claim about all provider/OS threads. |
image.summary(value:Image) | String | Return a bounded native summary. |
image.summary(value:ImageMask) | String | Return a bounded native summary. |
image.summary(value:ImageLabels) | String | Return a bounded native summary. |
image.summary(value:ImageRegions) | String | Return a bounded native summary. |
image.from_tensor(context:ImageContext, samples:Tensor, dtype:String="native", layout:String="HW", scale:Float64=1.0, offset:Float64=0.0) | Image | Owned CPU copy; native preserves Tensor dtype. Integer conversions must be exact. No hidden device readback. |
image.tensor(value:Image, dtype:String="Float32", layout:String="NCHW", scale:Float64=1.0, offset:Float64=0.0) | Tensor | Explicit detached owned CPU Tensor; supports HW/HWC/CHW/NCHW/FLAT. Scaling is explicit; invalid samples fail. |
image.features(value:Image, dtype:String="Float64") | Tensor | Owned rank two features: Image uses one HWC order row; Regions uses area,physical_area,centroid_x,centroid_y,width,height,mean,minimum,maximum. Empty/undefined regions fail. |
image.features(value:ImageRegions, dtype:String="Float64") | Tensor | Owned rank two features: Image uses one HWC order row; Regions uses area,physical_area,centroid_x,centroid_y,width,height,mean,minimum,maximum. Empty/undefined regions fail. |
image.values(value:ImageLabels) | Tensor | Owned HW Tensor; exact UInt32 labels use Float64, binary mask values use Float32. |
image.values(value:ImageMask) | Tensor | Owned HW Tensor; exact UInt32 labels use Float64, binary mask values use Float32. |
image.from_frame(context:ImageContext, frame:VideoFrame) | Image | Explicit immutable RGB8 frame copy retaining source/session/sequence/timestamps. |
image.from_frame(context:ImageContext, frame:VideoFrameSlot) | Image | Explicit immutable RGB8 frame copy retaining source/session/sequence/timestamps. |
image.plot(value:Image, minimum:Float64=0.0, maximum:Float64=255.0, max_pixels:Int64=65536) | Chart | Bounded native PNG raster preview. Display mapping never changes analysis values. |
image.mask_plot(value:Image, mask:ImageMask, minimum:Float64=0.0, maximum:Float64=255.0, max_pixels:Int64=65536) | Chart | Bounded raster preview with coordinate aligned typed overlay. |
image.label_plot(value:Image, labels:ImageLabels, minimum:Float64=0.0, maximum:Float64=255.0, max_pixels:Int64=65536) | Chart | Bounded raster preview with coordinate aligned typed overlay. |
vision.prepare_into(plan:VisionPlan, frame:Image, input:VisionInput) | Unit | Prepare a typed three channel Image directly; use explicit RGB conversion and model normalization. |
Aner documentation · Reference and guides