Created
December 9, 2016 19:48
-
-
Save PMLLancao/47ab20b75ef1a2964e0630a14098d8e0 to your computer and use it in GitHub Desktop.
Calculation for FRET Maps.
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
macro "Ratiometric FRET" { | |
path = getDirectory("Choose a Directory"); | |
list = getFileList(path); | |
length = list.length; | |
File.makeDirectory(path + "Imaging/"); | |
//FRET map creation | |
for (i=0; i<length; i++) { | |
n=i+1; | |
open(path+list[i]); | |
img = File.nameWithoutExtension(); | |
selectWindow(img+".lsm"); | |
run("Subtract Background...", "rolling=300 stack"); | |
run("StackReg", "transformation=Translation"); | |
run("Median...", "radius=1.3 stack"); | |
run("Stack to Images"); | |
run("Duplicate...", "title=mask"); | |
run("Threshold..."); | |
setAutoThreshold("Default dark"); | |
waitForUser("Imagen "+n+" de "+length,"Apply Threshold y click OK"); | |
run("16-bit"); | |
run("Divide...", "value=255"); | |
saveAs("Tiff", path + "Imaging/mask 000" + i); | |
imageCalculator("Divide create 32-bit", "1-0002","1-0001"); | |
imageCalculator("Multiply create","Result of 1-0002","mask 000"+i+".tif"); | |
selectWindow("Result of Result of 1-0002"); | |
saveAs("Tiff", path + "Imaging/fret map " + i); | |
run("Close All"); | |
} | |
Thank you very much, Kota
the .lsm is because my images are from Zeiss microscope, but I would like to do that generic too
Follow your suggestion, I will use run("Split Channels");
So I wrote again the lines 28-30 , now after Split Channels.
28 imageCalculator("Divide create 32-bit", "C2-" + list[ i ], "C1-" + list[ i ]");
29 imageCalculator("Multiply create","C2-" + list[ i ]","mask 000"+i+".tif");
30 selectWindow("Result of Result of "C2-" + list[ i ]");
However, I am getting this error
How can I fix it? I try to change the " " but nothing works.
Thanks for any help.
So the problem is this line
selectWindow("Result of Result of "C2-" + list[ i ]");
Too many double quoting! It should be enough with
selectWindow("Result of Result of C2-" + list[ i ]);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 20
If you want to split channels (step 5), it's much better to use the command [Image > Color Split Chanells], which is
In this way, images after splitting will have suffix "C1-" for the first channel, "C-2" for the second channel... and so on. For this reason, the name of these windows for each single channel becomes
"C1-" + list[ i ]
For the first channel,
"C2" +list[i]
Or. this might be what you want to do?
By the way,
line 14-16
If the original file name is with
.lsm
, I just wonder if there is any specific reason for this.Just to be tidy and better organization, indent lines within a macro. See here