How to calculate volume fraction in small blocks in the stack of 2D binary images?

2 次查看(过去 30 天)
I have a 2D stack of binary images. I want to divide 3D volume in small blocks and calculate volume fraction in each block. Does anyone have suggetions how can this be done?

采纳的回答

Raunak Gupta
Raunak Gupta 2020-7-18
Hi,
As mentioned in this Answer, you can calculate the volume fraction as fraction of count of non-zero pixel values to the total number of pixels in the volume Image. Let's say a small block of 2D images is a 3D matrix Image then volume fraction can be calculated as
volumeFraction = nnz(Image)/numel(Image);
You can divide the stack into small blocks using array indexing.
  3 个评论
Walter Roberson
Walter Roberson 2020-7-18
In some cases, it makes sense to fit a surface around a series of connected blocks in order to obtain a better estimate of the volume fraction.
Consider, for example, the case of a discretized sphere in a box that extends the same distance further in X, Y, Z. If you were able to figure out that it was a sphere and its size, then you could find the theoretical volume and compare that to the volume of the containing area to get the fraction. Now take the same structure but use a coarser and coarser discretization. The limiting case is that you would end up with a single cubic block at the center of a 3 x 3 grid, for a volume fraction of 1/27, about 0.037 -- but if you knew it was a sphere then you would get the volume fraction 4/3*pi*(1/2)^3 / 27, about 0.019. Actual volume of the sphere is about 0.524 of the fully-coarse representation of it.
See for example the difference between the area calculation of bwarea() https://www.mathworks.com/help/images/ref/bwarea.html compared to just plain number of pixels that are "on".
Raunak Gupta
Raunak Gupta 2020-7-19
编辑:Raunak Gupta 2020-7-19
Hi Walter,
It's a Nice idea to use bwarea here as it will give much more accurate solution. But again since any image will have a limited resolution, so there will always be a uncertainity around what is the actual ratio and it depends on the image quality in which the data is stored.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by