Skip to main content

NodeBuilder

Struct NodeBuilder 

Source
pub struct NodeBuilder { /* private fields */ }
Expand description

Records a node configuration; NodeBuilder::build checks it and creates the node on a host.

The reconstruction settings are a Plan (same fields and TOML as crate::declare); the input folder is the image root, positions/stride are not used (input is declared live), and GPS comes with each set.

Implementations§

Source§

impl NodeBuilder

Source

pub fn id(self, id: impl Into<String>) -> Self

Node id on the host (default "default").

Source

pub fn plan(self, plan: Plan) -> Self

Replaces the reconstruction settings with a plan (e.g. read from TOML). Input positions/stride and the GPS file are ignored; sinks are ignored (use NodeBuilder::output).

Source

pub fn images(self, dir: impl Into<PathBuf>) -> Self

Image folder: file payloads are relative to it, in-memory payloads are spooled inside it.

Source

pub fn cameras<S: Into<String>>(self, cams: impl IntoIterator<Item = S>) -> Self

Cameras of one synchronized set, in position order.

Source

pub fn zones(self, span: usize, overlap: usize) -> Self

Zone size and overlap in positions.

Source

pub fn align(self, frame: AlignFrame) -> Self

Coordinate alignment (ENU needs GPS fixes in the sets).

Source

pub fn fixed_enu_origin(self, on: bool) -> Self

Fixes the ENU origin at the first GPS fix.

Source

pub fn features(self, f: Features) -> Self

Feature extraction settings.

Source

pub fn match_backend(self, name: &str) -> Self

Descriptor matching backend (cpu | cuda).

Source

pub fn gpu(self) -> Self

CUDA for features, matching, the sparse stages, densification, undistortion and bundle adjustment.

Source

pub fn stable_display(self, on: bool) -> Self

Stable display (see SessionConfig::stable_display): intrinsics are settled then frozen, later zones are anchored to the shown ones with shared 3D points, and shown zones are re-densified in place (ZoneRefined of an earlier zone again), so the displayed cloud only gets refined and never jumps. Settle parameters come from the plan (sparse.settle_tol, sparse.settle_max_zone). Combine with NodeBuilder::fixed_enu_origin(true) for a display in a fixed ENU frame.

Source

pub fn display_deltas(self, opts: LiveOptions) -> Self

Computes the in-memory display updates in the library: after every dense zone result a point-keyed Event::DisplayDelta is delivered to subscribers and hooks (EventKind::DisplayDelta). Thinning (stride), overlap voxel ownership and zone composition follow crate::post::LiveDisplay; relocate is decided by the node (on only when previews exist). Needs dense clouds with point keys (.dense(..), which the session always keys). The composition runs on the composing thread right after the causing event; the ENU origin reported in the delta frame is the first GPS fix declared.

Source

pub fn incremental_triangulation(self, on: bool) -> Self

Triangulate only newly registered images.

Source

pub fn lookahead(self, positions: usize) -> Self

Feature lookahead (see SessionConfig::lookahead, default 2; 0 = off): on a spawned node (ReconNode::spawn) the features of up to this many queued positions are extracted by a worker thread while earlier positions are matched, registered and triangulated, so the throughput approaches the slowest stage instead of the sum of the stages. Nothing is read ahead for sets whose payload is raw RGB pixels (their spooling stays on the worker). Results do not change.

Source

pub fn batch(self, threshold: usize) -> Self

Backlog batching (default 1 = off; 0 or 1 = off): when a spawned node finds at least threshold states waiting (the one it takes plus the queued ones), it processes up to 32 of them as one batch (ReconNode::compose_batch): features, matching of all pending pairs in one call, registration and triangulation once per batch (split where a zone closes), so a backlog is worked off at the cost of one triangulation instead of one per position. The result is equivalent to position by position within the tolerance of registration order. Off with ReconcilePolicy::ReplayWindow (a rewind needs the state after every position).

Source

pub fn preview(self, on: bool) -> Self

Stable display: a sparse preview of every zone as soon as it closes (see SessionConfig::preview), before the refined zone replaces it. With NodeBuilder::display_deltas it arrives as a crate::live::DeltaKind::Preview delta.

Source

pub fn settle(self, tol: f64, max_zone: usize) -> Self

Stable display settling: intrinsics change tolerance and the last zone that may still settle (see SessionConfig::settle_tol, SessionConfig::settle_max_zone).

Source

pub fn live_stride(self, stride: usize) -> Self

Live display thinning of the live diff stream: keep 1 of stride points by key hash (1 = keep all; default 6).

Source

pub fn stream_origin(self, lat: f64, lon: f64, alt: f64) -> Self

Geodetic origin [lat, lon, alt] written to the live diff stream manifest. Give the first GPS fix the node will see (with NodeBuilder::fixed_enu_origin it is the origin of every zone); without it the manifest frame is display.

Source

pub fn stream_only(self, on: bool) -> Self

With NodeBuilder::stable_display and NodeBuilder::output: write only run.log, the timeline and the live diff stream, not the zone PLYs, the display PLYs, the per-zone models or the post-processing snapshots (default off).

Source

pub fn dense(self, d: Dense) -> Self

Densification settings (enables it).

Source

pub fn no_dense(self) -> Self

No densification (default).

Source

pub fn seed(self, seed: u64) -> Self

RANSAC seed.

Source

pub fn reconcile(self, p: ReconcilePolicy) -> Self

Reconciliation policy (default ReconcilePolicy::AppendOnly).

Source

pub fn backpressure(self, b: Backpressure) -> Self

Producer queue policy for ReconNode::spawn (default Block { max_pending: 8 }).

Source

pub fn source(self, id: impl Into<String>) -> Self

Accept only this source id (default: the first declared source).

Source

pub fn spool(self, rel: impl Into<PathBuf>) -> Self

Spool folder for in-memory payloads, relative to the image folder (default .live).

Source

pub fn output(self, dir: impl Into<PathBuf>, opts: SinkOptions) -> Self

Writes the standard output files (timeline, run.log, zone PLYs, snapshots) to dir. With NodeBuilder::stable_display also the live diff stream (live/stream/).

Source

pub fn on<F>(self, kind: EventKind, f: F) -> Self
where F: FnMut(&Event) + Send + 'static,

Hook for one event kind (Pipeline::on). FrameDecoded turns frame decoding on.

Source

pub fn on_event<F>(self, f: F) -> Self
where F: FnMut(&Event) + Send + 'static,

Hook for every event (Pipeline::on_any).

Source

pub fn on_frame<F>(self, f: F) -> Self
where F: FnMut(&Arc<Frame>) + Send + 'static,

Decoded input frames (Pipeline::on_frame); turns frame decoding on.

Source

pub fn on_zone_preview<F>(self, f: F) -> Self
where F: FnMut(ZoneRange, &Arc<PointCloud>) + Send + 'static,

Zone preview clouds (Pipeline::on_zone_preview).

Source

pub fn on_zone_refined<F>(self, f: F) -> Self
where F: FnMut(ZoneRange, &Arc<PointCloud>) + Send + 'static,

Zone refined clouds (Pipeline::on_zone_refined).

Source

pub fn on_message<F>(self, f: F) -> Self
where F: FnMut(EventKind, &str) + Send + 'static,

Warnings and errors (Pipeline::on_message); includes reconciliation warnings.

Source

pub fn event_policy(self, kind: EventKind, p: QueuePolicy) -> Self

Per-kind hook queue policy (Pipeline::policy), e.g. LatestPerKey for ZonePreview.

Source

pub fn sync_hooks(self, on: bool) -> Self

Runs hooks synchronously on the composing thread (Pipeline::sync).

Source

pub fn intrinsics_prior(self, prior: IntrinsicsPrior) -> Self

Soft intrinsics prior (the CLI’s --intrinsics-prior): every camera starts from the given parameters (except the principal point) and the bundle adjustment is pulled towards them with the prior’s σ values. Cameras are keyed by camera name (one of NodeBuilder::cameras) or by id; a camera without an entry is left alone. Checked by build.

use cumulus3d_cli::compose::ReconNode;
use cumulus3d_cli::intrinsics::IntrinsicsPrior;
let prior = IntrinsicsPrior::new()
    .sigmas(0.005, 0.01) // focal: relative, distortion: absolute
    .opencv("camF", [1607.4, 1611.2, 1024.0, 576.0, 0.082, -0.084, 0.0013, 0.0014]);
let _builder = ReconNode::declare().images("live/images").cameras(["camF"]).intrinsics_prior(prior);
Source

pub fn intrinsics_prior_json(self, path: impl AsRef<Path>) -> Self

Reads the prior from a JSON file (same format as the CLI’s --intrinsics-prior; default σ values 0.005 / 0.01). A read or parse error is reported by build. For other σ values use IntrinsicsPrior::load and NodeBuilder::intrinsics_prior.

Source

pub fn build(self, host: &CompositionHost) -> Result<ReconNode, ComposeError>

Checks the configuration, creates the session and pipeline, and registers the node on host. Creates the image folder’s spool folder; nothing else is written until frames are declared.

Trait Implementations§

Source§

impl Debug for NodeBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V