adapted imagej macro