Skip to contents

Convert XYZ locations between FANC4 (autoseg) and FANC3 (CATMAID)

Usage

fanc4to3(
  xyz,
  rawcoords = FALSE,
  swap = FALSE,
  chunksize = 40000,
  method = c("mapmany", "map1"),
  ...
)

Arguments

xyz

An Nx3 matrix of coordinates

rawcoords

whether the input values are raw voxel indices or in nm

swap

When TRUE applies the deformation field in the opposite direction e.g. to give a coarse mapping of points FAFB->FlyWire. This is wrong but may be useful.

chunksize

The number of points to send to the server when mapping many points at once.

method

Whether to map many points at once (default) or just one

...

additional arguments for pbapply::pblapply (used to chunk requests for many points) and eventually the POST command against the transform services server.

Value

a Nx3 matrix of coordinates.

Examples

fanc3=xyzmatrix(cbind(194569.2, 470101.3, 117630))
fanc4=cbind(45224, 109317, 2614)*c(4.3,4.3,45)
fanc4to3(fanc4)-fanc3
#>          X    Y Z
#> [1,] 2.575 2.65 0
# can also pass in raw coordinates e.g. from neuroglancer
fanc4to3(c(45224, 109317, 2614), rawcoords = TRUE)
#>             X      Y      Z
#> [1,] 194571.8 470104 117630

# rather small error for the approx inverse in this case
fanc4to3(fanc3, swap=TRUE)-fanc4
#> Warning: Please note the FANC3->FANC4 transform is wrong but useful!
#>         X      Y Z
#> [1,] -5.8 -1.575 0
# \donttest{
# ... so reverse mapping works in this case, but not always
fanc_xyz2id(fanc4to3(fanc3, swap = TRUE))
#> [1] "648518346486614449"
# }