| Title: | An R package-wrapper for Fast Bayesian Coherent Point Drift and BCPD++ Registration |
|---|---|
| Description: | Native R bindings to a bundled, pinned implementation of Bayesian Coherent Point Drift. The package implements the accelerated BCPD++ workflow in memory: representative-point downsampling, Nystrom low-rank deformation and probability approximations, k-d-tree probability search near convergence, and interpolation of the deformation back to every original moving point. |
| Authors: | Artür Manukyan [aut, cre] |
| Maintainer: | Artür Manukyan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-07-19 16:38:18 UTC |
| Source: | https://github.com/BIMSBbioinfo/rbcpd |
Apply a fitted BCPD transformation for new points from the moving coordinate system to fixed coordinate system
apply_bcpd(model, newdata)apply_bcpd(model, newdata)
model |
a list of parameters defining fitted BPCD model |
newdata |
Numeric matrix in the original moving coordinate system. |
Reports compile-time capabilities of the bundled native BCPD backend.
bcpd_backend_info()bcpd_backend_info()
A list containing backend identity, pinned commit, OpenMP status, maximum thread count, and OpenCV status.
Creates and validates controls for the native BCPD backend and the downsample-register-interpolate BCPD++ workflow.
bcpd_control( transformation = c("similarity_nonrigid", "nonrigid", "affine_nonrigid", "affine", "similarity", "rigid"), omega = 0, lambda = 2, beta = 2, gamma = 1, tolerance = 1e-4, max_iterations = 150L, min_iterations = 1L, normalization = c("each", "fixed", "moving", "none"), downsample = 1000L, downsample_fixed = NULL, downsample_moving = NULL, nystrom_deformation = 100L, nystrom_probability = 300L, kd_tree = TRUE, kd_scale = 7, kd_radius = 0.15, kd_switch = 0.2, seed = 1L, verbose = FALSE )bcpd_control( transformation = c("similarity_nonrigid", "nonrigid", "affine_nonrigid", "affine", "similarity", "rigid"), omega = 0, lambda = 2, beta = 2, gamma = 1, tolerance = 1e-4, max_iterations = 150L, min_iterations = 1L, normalization = c("each", "fixed", "moving", "none"), downsample = 1000L, downsample_fixed = NULL, downsample_moving = NULL, nystrom_deformation = 100L, nystrom_probability = 300L, kd_tree = TRUE, kd_scale = 7, kd_radius = 0.15, kd_switch = 0.2, seed = 1L, verbose = FALSE )
transformation |
Transformation model. |
omega |
Outlier probability in |
lambda |
Positive deformation regularization. |
beta |
Positive deformation-kernel width. |
gamma |
Positive initial residual multiplier. |
tolerance |
Positive convergence threshold. |
max_iterations |
Maximum number of iterations. |
min_iterations |
Minimum iteration index before convergence testing. |
normalization |
Normalization strategy. |
downsample |
Representative-point count for both clouds. Zero uses all points. |
downsample_fixed |
Optional fixed-cloud override. |
downsample_moving |
Optional moving-cloud override. |
nystrom_deformation |
Nyström rank for the deformation kernel. |
nystrom_probability |
Nyström rank for probability calculations. |
kd_tree |
Use local k-d-tree probabilities near convergence. |
kd_scale |
Search radius in residual-standard-deviation units. |
kd_radius |
Maximum normalized search radius. |
kd_switch |
Residual standard deviation at which k-d-tree search starts. |
seed |
Non-negative random seed. |
verbose |
Print compact iteration progress. |
An object of class bcpd_control.
Deforms moving onto fixed. When representative-point downsampling is active, the deformation is interpolated back to all original moving points.
bcpd_register(fixed, moving, control = bcpd_control()) bcpd_pp( fixed, moving, downsample = 1000L, nystrom_deformation = 100L, nystrom_probability = 300L, tolerance = 1e-4, max_iterations = 150L, omega = 0, lambda = 2, beta = 2, seed = 1L, verbose = FALSE )bcpd_register(fixed, moving, control = bcpd_control()) bcpd_pp( fixed, moving, downsample = 1000L, nystrom_deformation = 100L, nystrom_probability = 300L, tolerance = 1e-4, max_iterations = 150L, omega = 0, lambda = 2, beta = 2, seed = 1L, verbose = FALSE )
fixed |
Numeric fixed or target point matrix. Rows are points. |
moving |
Numeric moving or source point matrix. Rows are points. |
control |
A |
downsample |
Representative points selected from each cloud. |
nystrom_deformation |
Deformation-kernel Nyström rank. |
nystrom_probability |
Probability Nyström rank. |
tolerance |
Convergence tolerance. |
max_iterations |
Maximum iterations. |
omega |
Outlier probability. |
lambda |
Deformation regularization. |
beta |
Deformation-kernel width. |
seed |
Random seed. |
verbose |
Print iteration progress. |
A bcpd_registration list. Its transformed component has the same dimensions as moving.
theta <- seq(0, 2 * pi, length.out = 101)[-101] moving <- cbind(cos(theta), sin(theta)) fixed <- sweep(moving, 2, c(0.2, -0.1), "+") ## Not run: fit <- bcpd_pp(fixed, moving, downsample = 60L) plot(fixed, asp = 1) points(fit$transformed, col = 2) ## End(Not run)theta <- seq(0, 2 * pi, length.out = 101)[-101] moving <- cbind(cos(theta), sin(theta)) fixed <- sweep(moving, 2, c(0.2, -0.1), "+") ## Not run: fit <- bcpd_pp(fixed, moving, downsample = 60L) plot(fixed, asp = 1) points(fit$transformed, col = 2) ## End(Not run)
Displays the most important settings or registration diagnostics.
## S3 method for class 'bcpd_control' print(x, ...) ## S3 method for class 'bcpd_registration' print(x, ...)## S3 method for class 'bcpd_control' print(x, ...) ## S3 method for class 'bcpd_registration' print(x, ...)
x |
A BCPD control or registration object. |
... |
Unused. |
The input object, invisibly.
Rows are points and columns are coordinate dimensions. moving is deformed
onto fixed. When the moving cloud is downsampled, the native backend
interpolates the estimated deformation back to every original moving point.
run_bcpd(fixed, moving, control = bcpd_control())run_bcpd(fixed, moving, control = bcpd_control())
fixed |
Numeric fixed/target point matrix. |
moving |
Numeric moving/source point matrix. |
transformation |
transformation |
downsample |
Representative points selected from each cloud. |
nystrom_deformation |
Deformation-kernel Nyström rank. |
nystrom_probability |
Probability Nyström rank. |
tolerance |
Convergence tolerance. |
max_iterations |
Maximum iterations. |
omega |
Outlier probability. |
lambda |
Deformation regularization. |
beta |
Deformation-kernel width. |
seed |
Random seed. |
verbose |
Print iteration progress. |
A list of results of the BCPD run. The most important component is
transformed, which has the same dimensions as moving.