sourcePath=getInfo("image.directory"); nameStore=getTitle(); expName=getString("Exp Name", "Test"); run("Images to Stack", "name=Stack title=[] use"); selectWindow("Stack"); setTool("Rectangle"); waitForUser("Draw Around First Lane"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Unstim-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Unstim-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Unstim-Ch3"); selectWindow("Stack"); Stack.setSlice(1); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Copy"); selectWindow("Unstim-Ch1"); run("Add Slice"); run("Paste"); selectWindow("Stack"); Stack.setSlice(2); run("Copy"); selectWindow("Unstim-Ch2"); run("Add Slice"); run("Paste"); selectWindow("Stack"); Stack.setSlice(3); run("Copy"); selectWindow("Unstim-Ch3"); run("Add Slice"); run("Paste"); selectWindow("Stack"); Stack.setSlice(1); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Copy"); selectWindow("Unstim-Ch1"); run("Add Slice"); run("Paste"); selectWindow("Stack"); Stack.setSlice(2); run("Copy"); selectWindow("Unstim-Ch2"); run("Add Slice"); run("Paste"); selectWindow("Stack"); Stack.setSlice(3); run("Copy"); selectWindow("Unstim-Ch3"); run("Add Slice"); run("Paste"); selectWindow("Stack"); Stack.setSlice(1); selectWindow("Unstim-Ch1"); run("Z Project...", "projection=[Average Intensity]"); selectWindow("Unstim-Ch1"); close(); selectWindow("Unstim-Ch2"); run("Z Project...", "projection=[Average Intensity]"); selectWindow("Unstim-Ch2"); close(); selectWindow("Unstim-Ch3"); run("Z Project...", "projection=[Average Intensity]"); selectWindow("Unstim-Ch3"); close(); selectWindow("Stack"); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Lane1-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Lane1-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Lane1-Ch3"); selectWindow("Stack"); Stack.setSlice(1); imageCalculator("Subtract create", "Lane1-Ch1","AVG_Unstim-Ch1"); selectWindow("Result of Lane1-Ch1"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane1-Ch1.xls"); run("Close"); selectWindow("Plot of Result of Lane1-Ch1"); saveAs("Tiff", sourcePath+expName+" Lane1-Ch1.tif"); close(); selectWindow("Result of Lane1-Ch1"); close(); selectWindow("Lane1-Ch1"); close(); imageCalculator("Subtract create", "Lane1-Ch2","AVG_Unstim-Ch2"); selectWindow("Result of Lane1-Ch2"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane1-Ch2.xls"); run("Close"); selectWindow("Plot of Result of Lane1-Ch2"); saveAs("Tiff", sourcePath+expName+" Lane1-Ch2.tif"); close(); selectWindow("Result of Lane1-Ch2"); close(); selectWindow("Lane1-Ch2"); close(); imageCalculator("Subtract create", "Lane1-Ch3","AVG_Unstim-Ch3"); selectWindow("Result of Lane1-Ch3"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane1-Ch3.xls"); run("Close"); selectWindow("Plot of Result of Lane1-Ch3"); saveAs("Tiff", sourcePath+expName+" Lane1-Ch3.tif"); close(); selectWindow("Result of Lane1-Ch3"); close(); selectWindow("Lane1-Ch3"); close(); selectWindow("Stack"); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Lane2-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Lane2-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Lane2-Ch3"); selectWindow("Stack"); Stack.setSlice(1); imageCalculator("Subtract create", "Lane2-Ch1","AVG_Unstim-Ch1"); selectWindow("Result of Lane2-Ch1"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane2-Ch1.xls"); run("Close"); selectWindow("Plot of Result of Lane2-Ch1"); saveAs("Tiff", sourcePath+expName+" Lane2-Ch1.tif"); close(); selectWindow("Result of Lane2-Ch1"); close(); selectWindow("Lane2-Ch1"); close(); imageCalculator("Subtract create", "Lane2-Ch2","AVG_Unstim-Ch2"); selectWindow("Result of Lane2-Ch2"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane2-Ch2.xls"); run("Close"); selectWindow("Plot of Result of Lane2-Ch2"); saveAs("Tiff", sourcePath+expName+" Lane2-Ch2.tif"); close(); selectWindow("Result of Lane2-Ch2"); close(); selectWindow("Lane2-Ch2"); close(); imageCalculator("Subtract create", "Lane2-Ch3","AVG_Unstim-Ch3"); selectWindow("Result of Lane2-Ch3"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane2-Ch3.xls"); run("Close"); selectWindow("Plot of Result of Lane2-Ch3"); saveAs("Tiff", sourcePath+expName+" Lane2-Ch3.tif"); close(); selectWindow("Result of Lane2-Ch3"); close(); selectWindow("Lane2-Ch3"); close(); selectWindow("Stack"); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Lane3-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Lane3-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Lane3-Ch3"); selectWindow("Stack"); Stack.setSlice(1); imageCalculator("Subtract create", "Lane3-Ch1","AVG_Unstim-Ch1"); selectWindow("Result of Lane3-Ch1"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane3-Ch1.xls"); run("Close"); selectWindow("Plot of Result of Lane3-Ch1"); saveAs("Tiff", sourcePath+expName+" Lane3-Ch1.tif"); close(); selectWindow("Result of Lane3-Ch1"); close(); selectWindow("Lane3-Ch1"); close(); imageCalculator("Subtract create", "Lane3-Ch2","AVG_Unstim-Ch2"); selectWindow("Result of Lane3-Ch2"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane3-Ch2.xls"); run("Close"); selectWindow("Plot of Result of Lane3-Ch2"); saveAs("Tiff", sourcePath+expName+" Lane3-Ch2.tif"); close(); selectWindow("Result of Lane3-Ch2"); close(); selectWindow("Lane3-Ch2"); close(); imageCalculator("Subtract create", "Lane3-Ch3","AVG_Unstim-Ch3"); selectWindow("Result of Lane3-Ch3"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane3-Ch3.xls"); run("Close"); selectWindow("Plot of Result of Lane3-Ch3"); saveAs("Tiff", sourcePath+expName+" Lane3-Ch3.tif"); close(); selectWindow("Result of Lane3-Ch3"); close(); selectWindow("Lane3-Ch3"); close(); selectWindow("Stack"); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Lane4-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Lane4-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Lane4-Ch3"); selectWindow("Stack"); Stack.setSlice(1); imageCalculator("Subtract create", "Lane4-Ch1","AVG_Unstim-Ch1"); selectWindow("Result of Lane4-Ch1"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane4-Ch1.xls"); run("Close"); selectWindow("Plot of Result of Lane4-Ch1"); saveAs("Tiff", sourcePath+expName+" Lane4-Ch1.tif"); close(); selectWindow("Result of Lane4-Ch1"); close(); selectWindow("Lane4-Ch1"); close(); imageCalculator("Subtract create", "Lane4-Ch2","AVG_Unstim-Ch2"); selectWindow("Result of Lane4-Ch2"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane4-Ch2.xls"); run("Close"); selectWindow("Plot of Result of Lane4-Ch2"); saveAs("Tiff", sourcePath+expName+" Lane4-Ch2.tif"); close(); selectWindow("Result of Lane4-Ch2"); close(); selectWindow("Lane4-Ch2"); close(); imageCalculator("Subtract create", "Lane4-Ch3","AVG_Unstim-Ch3"); selectWindow("Result of Lane4-Ch3"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane4-Ch3.xls"); run("Close"); selectWindow("Plot of Result of Lane4-Ch3"); saveAs("Tiff", sourcePath+expName+" Lane4-Ch3.tif"); close(); selectWindow("Result of Lane4-Ch3"); close(); selectWindow("Lane4-Ch3"); close(); selectWindow("Stack"); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Lane5-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Lane5-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Lane5-Ch3"); selectWindow("Stack"); Stack.setSlice(1); imageCalculator("Subtract create", "Lane5-Ch1","AVG_Unstim-Ch1"); selectWindow("Result of Lane5-Ch1"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane5-Ch1.xls"); run("Close"); selectWindow("Plot of Result of Lane5-Ch1"); saveAs("Tiff", sourcePath+expName+" Lane5-Ch1.tif"); close(); selectWindow("Result of Lane5-Ch1"); close(); selectWindow("Lane5-Ch1"); close(); imageCalculator("Subtract create", "Lane5-Ch2","AVG_Unstim-Ch2"); selectWindow("Result of Lane5-Ch2"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane5-Ch2.xls"); run("Close"); selectWindow("Plot of Result of Lane5-Ch2"); saveAs("Tiff", sourcePath+expName+" Lane5-Ch2.tif"); close(); selectWindow("Result of Lane5-Ch2"); close(); selectWindow("Lane5-Ch2"); close(); imageCalculator("Subtract create", "Lane5-Ch3","AVG_Unstim-Ch3"); selectWindow("Result of Lane5-Ch3"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane5-Ch3.xls"); run("Close"); selectWindow("Plot of Result of Lane5-Ch3"); saveAs("Tiff", sourcePath+expName+" Lane5-Ch3.tif"); close(); selectWindow("Result of Lane5-Ch3"); close(); selectWindow("Lane5-Ch3"); close(); selectWindow("Stack"); makeRectangle((x+50), y, width, height); selectWindow("Stack"); waitForUser("Move if Required - Use left and Right Arrow Keys Only"); getSelectionBounds(x, y, width, height); run("Duplicate...", "title=Lane6-Ch1"); selectWindow("Stack"); Stack.setSlice(2); run("Duplicate...", "title=Lane6-Ch2"); selectWindow("Stack"); Stack.setSlice(3); run("Duplicate...", "title=Lane6-Ch3"); selectWindow("Stack"); Stack.setSlice(1); imageCalculator("Subtract create", "Lane6-Ch1","AVG_Unstim-Ch1"); selectWindow("Result of Lane6-Ch1"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane6-Ch1.xls"); run("Close"); selectWindow("Plot of Result of Lane6-Ch1"); saveAs("Tiff", sourcePath+expName+" Lane6-Ch1.tif"); close(); selectWindow("Result of Lane6-Ch1"); close(); selectWindow("Lane6-Ch1"); close(); imageCalculator("Subtract create", "Lane6-Ch2","AVG_Unstim-Ch2"); selectWindow("Result of Lane6-Ch2"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane6-Ch2.xls"); run("Close"); selectWindow("Plot of Result of Lane6-Ch2"); saveAs("Tiff", sourcePath+expName+" Lane6-Ch2.tif"); close(); selectWindow("Result of Lane6-Ch2"); close(); selectWindow("Lane6-Ch2"); close(); imageCalculator("Subtract create", "Lane6-Ch3","AVG_Unstim-Ch3"); selectWindow("Result of Lane6-Ch3"); makeLine((width/2), 0, (width/2), height, width); run("Plot Profile"); selectWindow("Plot Values"); saveAs("Results", sourcePath+expName+" Lane6-Ch3.xls"); run("Close"); selectWindow("Plot of Result of Lane6-Ch3"); saveAs("Tiff", sourcePath+expName+" Lane6-Ch3.tif"); close(); selectWindow("Result of Lane6-Ch3"); close(); selectWindow("Lane6-Ch3"); close(); run("Close All");