我有一个与仿射变换有关的问题(在<affine>标记之间)。我使用full xml file here函数从使用Java创建的BigDataViewer Fiji插件创建的xml文件(AffineTransform3D)中提取以下两个仿射转换:

<ViewRegistrations>
<ViewRegistration timepoint="0" setup="0">
  <ViewTransform type="affine">
    <Name>Fast 3d geometric hashing (rotation invariant), AffineModel3D on [beads (c=0)]</Name>
    <affine>1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0</affine>
  </ViewTransform>
  <ViewTransform type="affine">
    <Name>calibration</Name>
    <affine>1.9998662296836334 0.0 0.0 0.0 0.0 1.9998662296836334 0.0 0.0 0.0 0.0 1.9998662296836334 0.0</affine>
  </ViewTransform>
</ViewRegistration>


我想使用R包{RNiftyReg}中的buildAffine()函数在R中导入两个仿射变换,然后使用{RNiftyReg}中的composeTransforms()计算它们的成分。

buildAffine(translation = c(0, 0, 0), scales = c(1, 1, 1), skews = c(0, 0,0),
  angles = c(0, 0, 0), source = NULL, target = NULL,
  anchor = c("none", "origin", "centre", "center"))


我的问题:
上面的仿射变换存储在12个索引的向量中。 buildAffine()需要平移,比例,偏斜和角度的值作为输入参数。
我想知道哪个值对应什么。

最佳答案

我主要是R用户,但这里有:Java调用中的变量名称为:

 dat <- scan (text="double xx, double yx, double zx, double tx, double xy, double yy, double zy, double ty, double xz, double yz, double zz, double tz", what="")
dat <- dat[dat != "double"]
matrix(dat,4)
      [,1]  [,2]  [,3]
[1,] "xx," "xy," "xz,"
[2,] "yx," "yy," "yz,"
[3,] "zx," "zy," "zz,"
[4,] "tx," "ty," "tz"


本页记录了仿射变换的编码方式,唯一的区别是可以对4x3矩阵进行转置:https://o7planning.org/en/11157/javafx-transformations-tutorial

 t( matrix(dat,4) )
     [,1]  [,2]  [,3]  [,4]
[1,] "xx," "yx," "zx," "tx,"
[2,] "xy," "yy," "zy," "ty,"
[3,] "xz," "yz," "zz," "tz"


因此,将矩阵应用于c(x,y,z,1)的向量,以得到以下输出:

java - 将Java中的3D仿射变换构建导入R-LMLPHP

10-08 13:35