Medical Imaging Question- Mean inside a masked image

4 ビュー (過去 30 日間)
Med_Imager
Med_Imager 2012 年 3 月 15 日
コメント済み: Gulfam Saju 2022 年 4 月 20 日
Hi,
I Am trying to compute the mean values within the brain. I created a binary Mask of the brain. And I am computing my mean as follows. m = the signal. Masked_M = Signals within the brain(Masked to exclude values outside the brain). I suspect the mean ignores the 0 values within the brain. How can I compute a mean of a defined area within a mask and not exclude any 0 intensities within the mask.
masked_m=m.*Mask;
temp=masked_m(masked_m~=0);
mean_dm=mean(temp);
Thanks!
  1 件のコメント
Gulfam Saju
Gulfam Saju 2022 年 4 月 20 日
Can you share the code of creating binary mask?

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 3 月 15 日
mean() does not exclude 0's. Your design removes the 0s before the calculations.
mean_dm = mean(m(logical(Mask)));
If your Mask variable is already of class logical (true, false) then you can use
mean_dm = mean(m(Mask));

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by