API Reference

Running registration

RegisterDriver.driverFunction
driver(outfile, algorithm, img, mon)
driver(outfile, algorithms, img, mon)

Register the image(s) in img and save results to outfile in JLD format.

algorithm is a single AbstractWorker instance; algorithms is an AbstractVector of such instances for parallel (multi-threaded) computation. See the RegisterWorkerShell module for details on constructing workers.

mon is an AbstractDict mapping Symbol keys to communication values, or for the parallel form an AbstractVector of such AbstractDicts (one per worker). The keys specify which computed quantities are communicated back from each worker. Set them up with the worker's monitor function:

algorithm = RegisterRigid(fixed, params...)     # construct an AbstractWorker
mon = monitor(algorithm, (:tform, :mismatch))   # select fields to record
driver("results.jld", algorithm, img, mon)      # register and save

Scalars are stored as plain vectors indexed by image number; bit-type arrays are stored as higher-dimensional HDF5 datasets; other values are stored per-image inside "stack<n>" groups.

Additional local worker variables can be recorded by adding their keys to mon and calling monitor_copy! inside the worker:

# inside the worker algorithm:
monitor_copy!(mon, :extra, extra)   # saved only if :extra is a key in mon

Pass parallel=true (or false) to force multi-threaded (or sequential) execution. By default, parallel = length(algorithms) > 2.

Returns nothing.

source
driver(algorithm, img, mon) -> Dict

Register the single image in img and return the populated result Dict.

img must contain exactly one image; for multi-image stacks use the file-saving form of driver. The returned Dict is the same object as mon, with each key's value updated to the quantity computed by the worker.

Example

algorithm = RegisterRigid(fixed, params...)
mon = monitor(algorithm, (:tform, :mismatch))
mon = driver(algorithm, img, mon)
tform = mon[:tform]
source

Utilities

RegisterDriver.prepare_mm_packageFunction
prepare_mm_package(algorithm::AbstractWorker)
prepare_mm_package(algorithms::AbstractVector{<:AbstractWorker})

Load the mismatch-computation package appropriate for algorithm's compute device.

Thin wrapper around RegisterWorkerShell.load_mm_package that accepts either a single worker or a vector of workers (delegating to the first element). Call this before driver when the algorithm requires a device-specific backend (e.g., a CUDA mismatch package) to be loaded on the driver process.

Returns nothing.

source
RegisterDriver.threadidsFunction
threadids() -> Vector{Int}

Return the sorted list of thread IDs that Julia's scheduler actually assigns to tasks spawned with @threads and Threads.@spawn.

Julia's main thread (ID 1) typically does not execute worker tasks. The returned IDs are useful for configuring AbstractWorker instances that pin execution to a specific thread via the workertid field.

Example

# On a Julia session started with 4 threads
threadids()    # e.g. [2, 3, 4, 5]
source