//(c) Neil M. Kad 2011 // If you publish using this please cite: // Kad N.M., Wang H., Kennedy G. G., Warshaw D. M., Van Houten B., Collaborative dynamic DNA scanning by nucleotide excision repair proteins investigated by single-molecule imaging of quantum dot labeled proteins. Molecular Cell. 2010. Vol 37 No. 5, 702-13. setPasteMode("Blend"); //x=4; y=-9; //xg=19; yg=-11; yes_no = newArray("yes", "no"); answer = "yes"; ex = 25 // run("Duplicate...", "title=[copy] duplicate"); w = getWidth(); h = getHeight(); w1 = w+(2*ex); h1 = h+(2*ex); rename("copy"); run("Canvas Size...", "width=w1 height=h1 position=Center zero"); makeRectangle(ex, ex, w, h/3); run("Duplicate...", "title=[red] duplicate"); selectWindow("red"); run("Red"); run("RGB Color"); function RedAmberAlign(alignwindow){ Dialog.create("image nudge"); Dialog.addSlider("Left-Right:", -ex, ex,4); Dialog.addSlider("Down-Up:", -ex, ex, -9); Dialog.show(); x= Dialog.getNumber(); y= Dialog.getNumber(); selectWindow("copy"); makeRectangle(ex-x , (h/3+y+ex), w , h/3); run("Duplicate...", "title=[amber] duplicate"); selectWindow("amber"); run("Blue"); run("RGB Color"); imageCalculator("Add create stack", "red","amber"); rename("first combination"); Dialog.create("image nudge"); Dialog.addChoice("Is this OK?", yes_no); Dialog.show(); answer = Dialog.getChoice(); if (answer=="no") { selectWindow("amber"); close(); selectWindow("first combination"); close(); RedAmberAlign("amber"); } else { selectWindow("amber"); close(); RedAmberAlign2("green"); print ("red to amber "+x+" , "+y); } } RedAmberAlign("amber"); function RedAmberAlign2(alignwindow){ Dialog.create("image nudge"); Dialog.addSlider("Left-Right:", -ex, ex,19); Dialog.addSlider("Down-Up:", -ex, ex, -11); Dialog.show(); xg= Dialog.getNumber(); yg= Dialog.getNumber(); selectWindow("copy"); makeRectangle(ex-xg , (2*h/3+yg+ex), w , h/3); run("Duplicate...", "title=[green] duplicate"); selectWindow("green"); run("Green"); run("RGB Color"); imageCalculator("Add create stack", "red","green"); rename("second combination"); Dialog.create("image nudge"); Dialog.addChoice("Is this OK?", yes_no); Dialog.show(); answer = Dialog.getChoice(); if (answer=="no") { selectWindow("green"); close(); selectWindow("second combination"); close(); RedAmberAlign2("green"); } else { selectWindow("second combination"); close(); print ("red to green "+xg+" , "+yg); } } imageCalculator("Add create stack", "first combination","green"); rename("final combination"); selectWindow("green"); close(); selectWindow("first combination"); close(); selectWindow("red"); close(); selectWindow("copy"); close();