Displaying 1 result from an estimated 1 matches for "calculatekmedian".
2006 Aug 09
2
Speeding indexing and sub-sectioning of 3d array
...75 150
For each point in the array, I am trying to calculate the mean of the values
in its surrounding:
mean( arr[ (i - radius):(i + radius),
(j - radius):(j + radius),
(k - radius):(k + radius)] )
Putting that code in 3 for loops
calculateKMedian <- function( arr, radius){
for( i in (radius + 1):(dim(arr)[1] - radius - 1) ){
for( j in (radius + 1):(dim(arr)[2] - radius - 1) )
for( k in (radius + 1):(dim(arr)[3] - radius - 1) ){
mediansArr <- mean( arr[ (i - radius):(i + radius),
(...