# Displays the coordinates and values of
# the pixels within a non-rectangular ROI.
#
imp = IJ.getImage()
roi = imp.getRoi()
mask = None
if roi!=None:
   mask = roi.getMask()
if mask==None:
   IJ.error("Non-rectangular ROI required")
ip = imp.getProcessor()
r = roi.getBounds()
z = imp.getCurrentSlice()-1
for y in range(r.height):
   for x in range(r.width):
      if mask.get(x,y)!=0:
         print r.x+x, r.y+y, ip.getf(r.x+x,r.y+y)


