Last active
August 29, 2015 14:21
-
-
Save npyoung/131c37520811bc1de83f to your computer and use it in GitHub Desktop.
ImageJ macros for processing ratiometric imaging movies with a static marker channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dialog.create("Process interleaved ratiometric movie"); | |
Dialog.addString("Experiment name:", "expt"); | |
Dialog.addNumber("Background", 1600) | |
Dialog.show() | |
expt_name = Dialog.getString(); | |
background = Dialog.getNumber(); | |
expt_dir = getDirectory("Choose a save directory"); | |
id = getImageID(); | |
rename(expt_name + "_interleaved.tif"); | |
Stack.getDimensions(w, h, c, s, f); | |
saveAs("Tiff", expt_dir + File.separator + expt_name + "_interleaved.tif"); | |
odd_str = "1-"+(f-1)+"-2"; | |
even_str = "2-"+f+"-2"; | |
run("Make Substack...", " slices="+odd_str); | |
rename(expt_name + "_odd.tif"); | |
selectImage(id); | |
run("Make Substack...", " slices="+even_str); | |
rename(expt_name + "_even.tif"); | |
run("Ratio Plus", "image1=["+expt_name+"_odd.tif] image2=["+expt_name+"_even.tif] background1="+background+" clipping_value1=0 background2="+background+" clipping_value2=0 multiplication=1"); | |
rename(expt_name + "_ratio.tif"); | |
saveAs("Tiff", expt_dir + File.separator + expt_name + "_ratio.tif"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dialog.create("Process interleaved ratiometric movie"); | |
Dialog.addString("Experiment name:", "expt"); | |
Dialog.addNumber("Background filter radius", 150) | |
Dialog.show() | |
expt_name = Dialog.getString(); | |
bg_radius = Dialog.getNumber(); | |
expt_dir = getDirectory("Choose a save directory"); | |
id = getImageID(); | |
rename(expt_name + "_interleaved.tif"); | |
Stack.getDimensions(w, h, c, s, f); | |
saveAs("Tiff", expt_dir + File.separator + expt_name + "_interleaved.tif"); | |
run("Subtract Background...", "rolling="+bg_radius+" stack"); | |
odd_str = "1-"+(f-1)+"-2"; | |
even_str = "2-"+f+"-2"; | |
run("Make Substack...", " slices="+odd_str); | |
rename(expt_name + "_odd.tif"); | |
selectImage(id); | |
run("Make Substack...", " slices="+even_str); | |
rename(expt_name + "_even.tif"); | |
run("Ratio Plus", "image1=["+expt_name+"_odd.tif] image2=["+expt_name+"_even.tif] background1=0 clipping_value1=0 background2=0 clipping_value2=0 multiplication=1"); | |
rename(expt_name + "_ratio.tif"); | |
saveAs("Tiff", expt_dir + File.separator + expt_name + "_ratio.tif"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Split into individual channels | |
selectWindow("example.tif"); | |
run("Deinterleave", "how=2 keep"); | |
// Segment all cells in a single frame | |
selectWindow("example.tif #2"); | |
run("Make Substack...", " slices=1"); | |
run("Subtract Background...", "rolling=100"); | |
setAutoThreshold("Otsu dark"); | |
run("Convert to Mask"); | |
cell_mask = getImageID(); | |
// Segment the YFP image | |
selectWindow("ypf_example.tif"); | |
run("Subtract Background...", "rolling=100"); | |
setAutoThreshold("Otsu dark"); | |
run("Convert to Mask"); | |
yfp_mask = getImageID(); | |
// Make the YFP+ mask | |
imageCalculator("AND create", cell_mask, yfp_mask); | |
// Make the YFP- mask | |
selectWindow(yfp_mask); | |
run("Invert"); | |
yfp_inv_mask = getImageID(); | |
imageCalculator("AND create"), cell_mask, yfp_inv_mask); | |
// TODO ratio image | |
// WIP: apply ROIs to ratio | |
run("Create Selection"); | |
selectWindow("exaple.tif #1"); | |
run("Restore Selection"); | |
run("ROI Manager..."); | |
roiManager("Add"); | |
roiManager("Split") | |
roiManager("Show All"); | |
roiManager("Multi Measure"); | |
//For FURA-YFP cells | |
run("Invert"); | |
imageCalculator("AND create", "Substack (1)","Mask"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment