Counting Voxels in a Binary Mask

11 次查看(过去 30 天)
I have a mask, which is binary and 3-D. I want to count the number of white voxels. How can I do it?

采纳的回答

Iain
Iain 2013-8-7
if white is true:
count_of_white_voxels = sum(mask(:)) ;
  2 个评论
Jamuna Jayashri Mahalingam
I am using masks in NIFTI format. Here is my code:
clc; nii= load_nii('Seg.nii');%% loading NIFTI files view_nii(nii); %Count voxels count_of_white_voxels = sum(mask(:));
I keep getting this error: Undefined function 'sum' for input arguments of type 'struct'
Jamuna Jayashri Mahalingam
I think i figured what the error is..
I used
count_of_white_voxels = sum(nii.img(:)) ;
Now there is no error

请先登录,再进行评论。

更多回答(0 个)

产品

Community Treasure Hunt

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

Start Hunting!

Translated by