Calculate the mean of 4D image using a 3D mask

4 ビュー (過去 30 日間)
Gina Carts
Gina Carts 2019 年 10 月 24 日
コメント済み: Cyrus Tirband 2019 年 10 月 24 日
Hi there,
I have 4D data with dimensions [308,384,26,31]=[x,y,z,time]. I also have a binary 3D mask with dimensions [308, 384, 26].
I would like to calculate the mean of my 4D data using the mask. I want basically to calculate the mean only of the regions where the mask is 1. I need to loop over the time points to calculate the mean of all the nonzero areas.
Can anyone help with that?
  1 件のコメント
Cyrus Tirband
Cyrus Tirband 2019 年 10 月 24 日
I tried to comment on your other question, but the website crashes when I try to. I'll respond to what you asked here in this question instead.
Guillaume's answer will give a lower mean value if 'volume' is zero in locations where the mask is not. If you want to take these points into account, I suggest using Guillaume's answer.

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by