using voxelized model, how to measured volume of an object?

3 ビュー (過去 30 日間)
M.S. Khan
M.S. Khan 2020 年 8 月 30 日
編集済み: M.S. Khan 2020 年 8 月 30 日
Hi Community members,
using the below code, i have voxelized the layer of an object. Please guide me how to measure its volume using bins. Thanks in advance for your coopeeration. Regards!!!
clc; clear ;
data = load('Slice_0_to_9.txt') ;
data = round(data) ;
x = data(:,1) ; y = data(:,2) ; z = data(:,3) ;
% x-values
dx = 0.1;
minx = min(x);
maxx = max(x);
first_x = floor(minx / dx) * dx;
last_x = ceil(maxx / dx) * dx;
x_edges_go_here = first_x : dx : last_x
% for y-values
dy = 0.1
miny = min(y);
maxy = max(y);
first_y = floor(miny / dy) * dy;
last_y = ceil(maxy / dy) * dy;
y_edges_go_here = first_y : dy : last_y
% z-values
dz = 0.1
minz = min(z);
maxz = max(z);
first_z = floor(minz / dz) * dz;
last_z = ceil(maxz / dz) * dz;
z_edges_go_here = first_z : dz : last_z
xbin = discretize(x, x_edges_go_here);
ybin = discretize(y, y_edges_go_here);
zbin = discretize(z, z_edges_go_here);
voxelized = accumarray([xbin(:), ybin(:), zbin(:)], 1);

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by