from ij import IJ, ImageStack, ImagePlus
from ij.plugin.frame import RoiManager

# pull the active image
imp = IJ.getImage()
stack = imp.getImageStack()

# display Z-projection (max intensity) if stack
if stack.getSize() > 1:
    IJ.run("Z Project...", "projection=[Max Intensity]")

# open ROI manager and make sure ROIs appear with labels
RM = RoiManager()
rm = RM.getRoiManager()
rm.runCommand("Show All with labels")

# activate rectangle selection tool
IJ.setTool("rectangle")

from ij import IJ, ImageStack, ImagePlus
from ij.plugin.frame import RoiManager

# pull the active image
imp = IJ.getImage()
stack = imp.getImageStack()

# display Z-projection (max intensity) if stack
if stack.getSize() > 1:
    IJ.run("Z Project...", "projection=[Max Intensity]")

# open ROI manager and make sure ROIs appear with labels
RM = RoiManager()
rm = RM.getRoiManager()
rm.runCommand("Show All with labels")

# activate rectangle selection tool
IJ.setTool("rectangle")

# pull the active image # display Z-projection (max intensity) if stack # open ROI manager and make sure ROIs appear with labels # activate rectangle selection tool