Obtaining 3D matrix /image from voxel array with co-ordinates X,Y and Z with the intensity ?

1 回表示 (過去 30 日間)
I have a voxel array of size 4089906 X 4 and I want to change it to 3D image/matrix and its size should be based on the co-ordinates X,Y and Z of the voxel array. In the diagram 1=X co-ordinate 2=Y co-ordinate 3=Z- co-ordinate and 4= Intensity. The ranges for the co-ordinates are X=[-550:1:300] Y= [-1350:1:-550] and Z= [2080:8:2120]

回答 (1 件)

Image Analyst
Image Analyst 2021 年 7 月 28 日
I know it's kind of obvious, but did you try a nested for loop?
x = squeeze(n(:, 1));
y = squeeze(n(:, 2));
z = squeeze(n(:, 3));
gl = squeeze(n(:, 4));
xMin = min(x);
xMax = max(x);
yMin = min(y);
yMax = max(y);
zMin = min(z);
zMax = max(z);
[rows, columns] = size(n)
outputRows = yMax - yMin;
outputCols = xMax - xMin;
outputSlices = zMax - zMin;
outputImage = zeros(outputRows, outputCols, outputSlices);
for k = 1 : rows
col = x(k) + xMin;
row = y(k) + yMin;
slice = z(k) + zMin;
outputImage(row, col, slice) = gl(k);
end
  1 件のコメント
Jabir Mohamed Abdi
Jabir Mohamed Abdi 2021 年 7 月 28 日
I tried my version of nested loop but didnt work. Your way of the nested loop works and thank you for your assistance!.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by