multidimensional maximum

Hey,

I'm new to Igor and trying to create a function to mass process a series of images. Essentially what I need to do is find the maximum column and row number where z equals 0. I've used the image processing features in Igor to generate a gray scale image and used edge detection so that the image only has two z values, 0 and 255.

Any help is greatly appreciated.

Hopper

make/n=(100,100, 100) test
edit test
test = p*q*r

duplicate/o test, temp
temp = test[p][q][r] == 0 ? p : NaN
print "max row where there was a zero entry", wavemax(temp)

duplicate/o test, temp
temp = test[p][q][r] == 0 ? q : NaN
print "max column where there was a zero entry", wavemax(temp)

duplicate/o test, temp
temp = test[p][q][r] == 0 ? r : NaN
print "max layer where there was a zero entry", wavemax(temp)