Effacer les filtres
Effacer les filtres

Counting Voxels in a Binary Mask

5 vues (au cours des 30 derniers jours)
Jamuna Jayashri Mahalingam
Jamuna Jayashri Mahalingam le 7 Août 2013
I have a mask, which is binary and 3-D. I want to count the number of white voxels. How can I do it?

Réponse acceptée

Iain
Iain le 7 Août 2013
if white is true:
count_of_white_voxels = sum(mask(:)) ;
  2 commentaires
Jamuna Jayashri Mahalingam
Jamuna Jayashri Mahalingam le 8 Août 2013
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
Jamuna Jayashri Mahalingam le 8 Août 2013
I think i figured what the error is..
I used
count_of_white_voxels = sum(nii.img(:)) ;
Now there is no error

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by