//choose a macro mode and a directory #@ String (label=" ", value="Rectangle Crop
Batch processing
", visibility=MESSAGE, persist=false) heading #@ File(label="Select a directory:", style="directory") dir #@ File (label="Select an image", style="file") file #@ String (label=" ", value="", visibility=MESSAGE, persist=false) logo #@ String (label=" ", value="Neuromolecular Biology Lab
ERI BIOTECMED - Universitat de València (Spain)
", visibility=MESSAGE, persist=false) message //create the selection open(file); setTool("rectangle"); waitForUser("Make a rectangular selection"); selection=selectionType(); // 0 = rectangle while (selection != 0) { setTool("rectangle"); run("Select None"); waitForUser("Make a rectangular selection"); selection=selectionType(); } roiManager("add"); run("Close All"); //crop images setBatchMode(true); print("Start batch process"); list=getFileList(dir); dirName=File.getName(dir); dirParent=File.getParent(dir); outputDir=dirParent+File.separator+dirName+"_Crop"; File.makeDirectory(outputDir); for (i=0; i