Skip to main content

Module io

Module io 

Source
Expand description

Backend-independent composite transform serialization.

§Design

The Transform<B, D> trait is generic over a Coeus tensor backend B, which makes direct serialization of live transform objects backend-dependent. This module provides a parameter-only representation (TransformDescription) that captures each supported transform type as plain f64 vectors, and a composite container (CompositeTransform) that holds an ordered sequence of such descriptions.

Both types derive serde::Serialize and serde::Deserialize, enabling round-trip JSON persistence that is independent of any particular Coeus backend.

§Supported transform types

VariantParameters
Translationoffset vector [D]
Rigidrotation matrix D×D (row-major) + translation [D]
Affinehomogeneous matrix (D+1)×(D+1) (row-major)
DisplacementFieldgrid dims, origin, spacing, per-component displacement
BSplinegrid dims, origin, spacing, per-component ctrl-pt displ.

§Composition order

Transforms are applied left-to-right (first-to-last): a point p is mapped through T[0], then T[1], … , then T[n-1]. Mathematically this corresponds to T_{n-1} ∘ … ∘ T_1 ∘ T_0.

§Dependencies

This module requires serde_json = "1.0" in [dependencies] of crates/ritk-core/Cargo.toml. The crate already depends on serde.

Structs§

CompositeTransform
Ordered composite transform: applied first-to-last.

Enums§

TransformDescription
Backend-independent description of a single transform’s parameters.