【发布时间】:2016-09-27 01:13:52
【问题描述】:
我有这些系列的 2D CT 图像,我已经能够使用“imread”将它们读入 Matlab。然而,问题是我需要将图像作为单个 3D 矩阵读入,而不是几个 2D 矩阵的堆栈。我已经意识到可以将 2D 层的数量存储为第 3 维,但我不知道如何做到这一点,因为我仍然是一个学习者。 我在二维堆栈中读取的代码如下:
a = dir('*.tif');
for i = 1: numel(a)
b = imread(a(i).name); %read in the image
b_threshold = graythresh(b); %apply threshold
b_binary = im2bw(b, b_threshold); %binarize image
[m, n] = size(b); %compute the size of the matrix
phi(i) = ((m*n) - sum((b_binary(:))))/(m*n); %compute the fraction of pore pixels in the image
phi(:,i) = phi(i); %store each of the above result
end
我只添加了一张图片,尽管需要其中几张。然而,人们可以轻松地复制图像以创建一堆 2D 图像。但是,要使代码正常工作,以数字顺序重命名它们很重要。pore_image 欢迎任何帮助/建议/想法。谢谢!
【问题讨论】:
-
我想记住(因为您是新手)您可以接受其中一个答案。所以请这样做,如果你欣赏他们中的一个
标签: arrays matlab image-processing matrix 3d