sorting of a multi-dimensional array in only one "direction"/dimension [message #41908] |
Thu, 02 December 2004 06:19 |
Benjamin Luethi
Messages: 22 Registered: December 2004
|
Junior Member |
|
|
Hi,
I'm looking for an efficient way of sorting a multi-dimensional array in
only one "direction"/dimension?
I have (let's say) 5 images in an array imgs=uintarr(1024,1024,5).
I'd like to average pixel values over the 5 images, but only use the
central three values of each position while discarding the minimum and
maximum value.
So far, I'm looping through all image positions (1024x1024!) and sorting
the five elements in each position. (something like
imgs[x,y,*]=sort(imgs[x,y,*]))
Quote from JD Smith: "A typical rule of thumb: if you're looping over each
data element individually, there's (probably) a faster way to do it."
So, in this case that would be...? (something with histograms maybe?)
thanks for your thoughts on this,
Benjamin
|
|
|