Cache and Visualization
FileCache needs the JLD2 extension (using JLD2), and detections! and the image viewer compare_images need a Makie backend.
VisualGeometryToolkitFeatures.CACHE_FORMAT — Constant
CACHE_FORMATThe layout version of the values a FileCache stores, part of every cache_key. The backend (JLD2) stores Julia types, so a cached value whose type's layout changes cannot be read back as the new type: raising this number makes every earlier entry a miss (recomputed), never a load that fails. Raise it with any change to the layout of a cached type.
- 1: the initial layout.
- 2 (2026-11): VisualGeometryToolkitCore's
CovMat/PrecMathold a static matrix (CovMat{N, T, M, C}; wasCovMat{N, T, L, C}), so cached uncertain detections of the earlier layout do not load. - 3 (2026-11):
LinearRaw{Mode, I, S, G, M}holds its image and saturation arrays as the mosaic's device made them (wasLinearRaw{Mode, G, M}), so cached decodes of the earlier layout do not load. - 4 (2026-11, Features 0.8.0):
LinearRawis VisualGeometryToolkitCore's (moved from this package), so a decode cached under this package's type does not load.
VisualGeometryToolkitFeatures.FileCache — Type
FileCache{D}Wrapper around an open file-backed key-value store. The concrete backend D is determined by the extension (e.g., JLD2).
VisualGeometryToolkitFeatures.cache_key — Method
cache_key(args...) -> StringCompute a stable hex-encoded SHA-256 cache key from arbitrary arguments and the cache's layout version (CACHE_FORMAT): an entry written under an earlier layout is a miss. The caller decides what else goes in; this function just hashes.
Example
key = cache_key(board_uid, model_hash, cutoff, patch_size)
get!(cache, key) do ... endVisualGeometryToolkitFeatures.close_cache — Method
close_cache(cache)Close the cache file handle. No-op for nothing.
VisualGeometryToolkitFeatures.open_cache — Method
open_cache(path) -> FileCache or nothingOpen a persistent cache file. Returns nothing if path is nothing or the file cannot be opened (logs a warning).
Requires a backend extension (e.g., using JLD2).
VisualGeometryToolkitFeatures.compare_images — Function
compare_images(entries; titles = nothing, default = first name, size = (1800, 1000)) -> FigureThe stack's one image viewer: a menu over named entries, each a tuple of images to compare (a pair, typically) or a function returning one (called when the entry is chosen, so a large set loads lazily), drawn on one axis per image with the axes linked (they pan and zoom together, pixel for pixel). Every image is drawn by VisualGeometryToolkitCore's orientation rule (imshow!: x right, y down, COLMAP pixels, row 1 at the top), whatever its element type (a srgb_image display image, a real matrix through a colormap). entries is a vector of name => images pairs, every entry the same number of images; titles names the axes (one per image), and default the entry shown first. Display it with a Makie backend (using GLMakie; display(fig)). An empty entries, a default not among them or a title count other than the images' is an ArgumentError.
Requires Makie.
VisualGeometryToolkitFeatures.detections! — Function
detections!(ax, dets::AbstractVector{<:Detection};
cutoff=1.0, color_by=nothing, colormap=:viridis, kwargs...)Overlay detections as batched ellipse boundaries (VisualGeometryToolkitCore's ellipses!).
color_by selects the stroke coloring:
nothing— constantstrokecolor:response—|metadata.response|throughcolormap- an
AbstractVector{<:Real}— explicit per-detection values
Requires Makie.