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

2 visualizzazioni (ultimi 30 giorni)
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);

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by