rbcpd is a self-contained R/Rcpp package for Bayesian Coherent Point Drift
and the accelerated BCPD++ workflow. It compiles a pinned copy of the official
BCPD C core directly into the R package.
The default workflow is:
- normalize the complete fixed and moving clouds,
- randomly select representative points,
- register those representatives with Nyström and k-d-tree acceleration,
- interpolate the non-rigid deformation back to every original moving point.
if(!requireNamespace("pak", quietly = TRUE))
install.packages("pak")
pak::pak("BIMSBbioinfo/rbcpd")A working C/C++ R toolchain is required. BLAS and LAPACK are supplied through R.
fit <- bcpd_pp(
fixed,
moving,
downsample = 1000L,
nystrom_deformation = 100L,
nystrom_probability = 300L,
tolerance = 1e-4,
max_iterations = 100L,
verbose = TRUE
)
fit
registered <- fit$transformedregistered has the same number of rows as moving, even though registration
was performed on 1,000 representative points.
# Faster and coarser
fit500 <- bcpd_pp(fixed, moving, downsample = 500L)
# More local detail, more computation
fit1500 <- bcpd_pp(fixed, moving, downsample = 1500L)For 4,000 points, begin with 800-1,200 representatives. Increasing the representative count preserves smaller local deformations but increases runtime.
fit$transformed # full registered moving cloud
fit$displacement # total transformed - original displacement
fit$nonrigid_deformation # non-rigid deformation before global transform
fit$rotation
fit$scale
fit$translation
fit$iterations
fit$runtime_seconds
fit$profile