Skip to content

Repository files navigation

rbcpd

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:

  1. normalize the complete fixed and moving clouds,
  2. randomly select representative points,
  3. register those representatives with Nyström and k-d-tree acceleration,
  4. interpolate the non-rigid deformation back to every original moving point.

Install

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.

Register 4,000-point clouds

fit <- bcpd_pp(
    fixed,
    moving,
    downsample = 1000L,
    nystrom_deformation = 100L,
    nystrom_probability = 300L,
    tolerance = 1e-4,
    max_iterations = 100L,
    verbose = TRUE
)

fit
registered <- fit$transformed

registered has the same number of rows as moving, even though registration was performed on 1,000 representative points.

Speed versus local detail

# 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.

Result fields

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

About

An R package wrapper for Bayesian Coherent Point Drift / Domain Elastic Transform

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages