【问题标题】:3d Voxel coordinates as list in Matlab3d体素坐标作为Matlab中的列表
【发布时间】:2023-03-06 08:56:01
【问题描述】:

我有一个 20*20*20 cm^3 的立方体和 1cm^3 的体素,我如何将所有 20*20*20=8000 体素中心的坐标作为 [x,y, z](尺寸 8000*3)?最好是矢量化的形式!非常感谢!

【问题讨论】:

  • “坐标”是什么意思?你能举个小例子吗,比如 2x2x2?
  • 对于 2*2*2 我需要 [ (0.5,0.5,0.5), (0.5,0.5,1.5), (0.5,1.5,0.5), (0.5,1.5,1.5), ( 1.5,0.5,0.5), (1.5,0.5,1.5), (1.5,1.5,0.5), (1.5,1.5,1.5)]

标签: matlab 3d vectorization voxel


【解决方案1】:

ndgrid 完成这项工作:

N = 20;
[z, y, x] = ndgrid(.5:N); %// note reverse order to get desired order of result
xyz = [x(:) y(:) z(:)]; %// desired result

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-22
    • 2012-07-23
    • 1970-01-01
    • 2011-12-04
    • 1970-01-01
    • 2014-09-15
    相关资源
    最近更新 更多