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

조회 수: 9 (최근 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개)

Community Treasure Hunt

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

Start Hunting!

Translated by