Matlab中的3D体素显示 [英] 3D voxel Display in matlab

查看:721
本文介绍了Matlab中的3D体素显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格,它是3D并存储一个数字.

I have a grid, it is 3D and it stores a number.

如果是2 * 2 * 2,这是我的网格的一个示例:

Here is an example of my grid if it is 2*2*2:

(:, :, 1) -> [0, 0;
              0, 0]
(:, :, 2) -> [0, 0;
              0, 0]

数字0通常是我想用color或nan表示的数字,如果那里不存在体素.我想做的是使用matlab显示体素网格,如下图所示:

The number 0 would usually be a number that I would like to represent with colour or nan if no voxel exists there. What i would like to do is display a voxel grid with matlab like in the following picture:

除了以单元格中的数字为基色加上颜色以外.

Except that the vocels should be coloured with the number in the cell.

如果有一个库或自己编写它的某种方法,有人知道怎么做吗?

Does anyone know how to do this, if there is a library or some way to write it myself?

推荐答案

所以我发现您可以这样做:

So I found out you can do it like this:

for x = 1:GridSize(1)
    for y = 1:GridSize(2)
        for z = 1:GridSize(3)

            if (~isnan(VoxelGrid(x, y, z)))

                cubeLength = VoxelGrid.resolution;

                plotcube(   [cubeLength cubeLength cubeLength], ...
                            [x, y, z], ...
                            0.9, ...
                            [colour, colour, colour])
             end
         end
     end
 end

这将打印出这样的灰度体素表示:

This will print out a grey scale voxel representation like this:

现在我只需要一些帮助就可以使用颜色.

Now i just need some help getting the colour working.

这篇关于Matlab中的3D体素显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆