how to calculate voxel image volume ?
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Moussa DIEDHIOU
el 31 de Ag. de 2022
Movida: Image Analyst
el 1 de Sept. de 2022
Hi,
I am nex in matlab coding.
I am using voxel image function to drow voxels on a point cloud.
the code is runing and it gives a good plot. But the problem is that i do not know how to estimate the volume of my voxelized object ?
anyone can help ?
I already use volume function or [C,V] like alphashape or convexhull, but it doesn't work.
Thank's
2 comentarios
Walter Roberson
el 31 de Ag. de 2022
is it https://www.mathworks.com/help/vision/ref/pcmapndt.html that you are using?
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 31 de Ag. de 2022
discretize() each coordinate axis separately, getting an index number for each point. Use accumarray() with the combined indices, and count 1. Afterwards the volume is nnz() of the count times the volume of each voxel.
3 comentarios
Walter Roberson
el 31 de Ag. de 2022
N = 500;
data = randn(N,3) .* [20 10 15];
ptc = pointCloud(data);
%pcshow does not work in MATLAB Answers
xyz = ptc.Location;
scatter3(xyz(:,1), xyz(:,2), xyz(:,3)); %instead of pcshow for Answers
minxyz = floor(min(xyz,[],1));
maxxyz = ceil(max(xyz,[],1));
dx = .5; dy = .25; dz = .5;
xidx = 1 + floor((xyz(:,1) - minxyz(1))/dx);
yidx = 1 + floor((xyz(:,2) - minxyz(2))/dy);
zidx = 1 + floor((xyz(:,3) - minxyz(3))/dz);
counts = accumarray([xidx, yidx, zidx], 1);
volume = nnz(counts) .* (dx .* dy .* dz)
volshow(counts, 'BackgroundColor', [0.8 0.8 0.8]);
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!