1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
m = 0
//Select folder containing stacks to process.
input = getDirectory("Choose substack Directory");
//Create output folder.
File.makeDirectory(input+ File.separator()+"Overlay");
output = input+ File.separator()+"Overlay";
Dialog.create("File type");
Dialog.addString("File suffix: ", ".tif", 5);
Dialog.show();
suffix = Dialog.getString();
setBatchMode(true);
list = getFileList(input);
for (i=0; i<list.length; i++)
{
if (endsWith(list[i], suffix))
{
m++;
open(input+list[i]);
if(indexOf(list[i], "T1")>-1){
setSlice(4);
processFile(output, list[i]);
close();
} else {
if(indexOf(list[i], "T2")>-1)
{
setSlice(4);
processFile2(output, list[i]);
close();
} else {
if(indexOf(list[i], "T3")>-1)
{
setSlice(4);
processFile3(output, list[i]);
close();
}
}
}
}
}
function processFile(output, file)
{
run("Duplicate...", " ");
name = list[i];
dotIndex = indexOf(name, ".");
title = substring(name, 0, dotIndex);
saveAs("tiff", output+File.separator()+" T1");
close();
}
function processFile2(output, file)
{
run("Duplicate...", " ");
name = list[i];
dotIndex = indexOf(name, ".");
title = substring(name, 0, dotIndex);
saveAs("tiff", output+File.separator()+" T2");
close();
}
function processFile3(output, file)
{
run("Duplicate...", " ");
name = list[i];
dotIndex = indexOf(name, ".");
title = substring(name, 0, dotIndex);
saveAs("tiff", output+File.separator()+" T3");
close();
}
list = getFileList(input);
for (i=0; i<list.length; i++)
{
if (endsWith(list[i], suffix))
{
m++;
open(input+list[i]);
if(indexOf(list[i], "T7")>-1){
Stack.setFrame(1);
processFile7(output, list[i]);
close();
} else {
if(indexOf(list[i], "T8")>-1)
{
Stack.setFrame(1);
processFile8(output, list[i]);
close();
}
}
}
}
}
function processFile7(output, file)
{
run("Duplicate...", " ");
name = list[i];
dotIndex = indexOf(name, ".");
title = substring(name, 0, dotIndex);
saveAs("tiff", output+File.separator()+" T7");
close();
}
function processFile8(output, file)
{
run("Duplicate...", " ");
name = list[i];
dotIndex = indexOf(name, ".");
title = substring(name, 0, dotIndex);
saveAs("tiff", output+File.separator()+" T8");
close();
}
setBatchMode(false);
showMessage("Macro is finished"); |
Partager