;------------------------------------------------------------------ ; MBOX.PRO ; 12.10.1999 by Andreas Reigber ;------------------------------------------------------------------ ; Generates the one-dimensional relative index values of a ; rectangular box in a two-dimensional array. Used for fast ; addressing of pixel neighbourhoods. ; ; Usage: ; res = mbox(size,xdim) ; size = box size (for example 5 for a 5x5 box) ; xdim = Size in X of the 2D array to be addressed ------------------------------------------------------------------ ; This software has been released under the terms of the GNU Public ; license. See http://www.gnu.org/copyleft/gpl.html for details. ;------------------------------------------------------------------ function mbox,n,anz box = intarr(n*n) for i=0,n-1 do box[n*i] = (findgen(n)-n/2)+anz*(i-n/2) return,box end