3D image stack; determine mean of individual arrays; error code
Mostra commenti meno recenti
Hi,I have a 1000x1000x1952 uint8 3D image array (Array), and would like to get the mean value of each individual array "image" and subsequently put these in a 1952x1 array (meanArray).
The code I use is:
meanArray= mean(Array,[1 2])
the error code I get is: Error using sum "Dimension argument must be a positive integer scalar within indexing range. Error in mean (line 87) y = sum(x,dim,flag);"
What am I missing here? Thanks! Barry
Risposta accettata
Più risposte (2)
Stephen23
il 5 Ott 2018
squeeze(mean(mean(Array,1),2))
2 Commenti
B Janssen
il 8 Ott 2018
@B Janssen: so you actually used my faster answer, but accepted Matt J's answer that you did not use? Confusing.
Note that you can also vote for answers, which is any easy way to show thanks to the volunteers who helped you. It is nice to get a vote as a small sign of appreciation.
This method would probably be most optimal, since it involves only one call to mean(), and therefore allocates a smaller chunk of memory for the output.
meanArray = mean( reshape(Array,[], size(Array,3)) );
Categorie
Scopri di più su Images in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!