How can I count the number of voxels in a region
古いコメントを表示
Hi,
I have a 3D mask with 0 background (NIfTI format). The mask has some regions marked with number 1,other egions with number 2, others with number 3 and others with number 4.
I was wondering how to count the number of voxels involved in each region. If I have 20 regions in my mask: let's say 10 regions have number 1, 5 regions have number 2, 4 regions have number 3 and 1 region have number 4.
I want to know how many voxels correspond to each of my 10 regions with number 1. I want the individual number of voxels in each region not the overall number.
Any help is highly appreciated.
5 件のコメント
Alex Sune
2020 年 3 月 2 日
Gina Carts
2020 年 3 月 2 日
Alex Sune
2020 年 3 月 2 日
For example, for the label 1, being A your mask:
label1 = A==1;
CC = bwconncomp(label1);
numVoxels = = cellfun(@numel,CC.PixelIdxList); %Here you have the number of voxels for each region with label == 1
Gina Carts
2020 年 3 月 2 日
Alex Sune
2020 年 3 月 2 日
Hve you read the documentation of bwconncomp? There are some examples to see what this function does.
numVoxels is an array with the number of voxels for each region found
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!