Obtaining 3D matrix /image from voxel array with co-ordinates X,Y and Z with the intensity ?
조회 수: 2 (최근 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]
댓글 수: 0
답변 (1개)
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!