-
Notifications
You must be signed in to change notification settings - Fork 2
/
_DKR_Batch_Split_DV_Channel.txt
80 lines (55 loc) · 1.95 KB
/
_DKR_Batch_Split_DV_Channel.txt
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
// created by Dan Rozelle 20091005
//used to quickly open each DV movie, and wait to do some simple manual function or paste another macro as a function
macro "_DKR_Batch_Split_DV_Channel"{
//list filetypes to include
filter="";
//which channel do you want to save (start with 0)
channel="1";
//list auto functions here, adjust mode as necessary
function batchfunction();
mode="AUTO"; //use "MANUAL" or "AUTO" or "BOTH"
if(nImages>0) exit ("close all images before proceeding");
dir1 = getDirectory("Choose source directory");
if (dir1=="")
exit("No directory available");
dir2 = getDirectory("Choose output directory");
if (dir2=="")
exit("No directory available");
//get a list of all the files in this folder
preList = getFileList(dir1);
size=0;
//count each '*filter*' files
for(place=0;place<preList.length;place++){
if(endsWith(preList[place],filter)){
size++;
}
}
//create a new array and populate with filtered images
list=newArray(size);
position=0;
for(place=0;place<preList.length;place++){
if(endsWith(preList[place],filter)){
list[position]=preList[place];
position++;
}
}
//starting with the first image, we increment through each image until we have done 6, or finish our list, whichever comes first
for(i=0; i<list.length; i++) {
//open a two color image in separate channel stacks
run("Bio-Formats Importer", "open="+dir1+list[i]+" view=Hyperstack stack_order=XYCZT split_channels autoscale");
if(mode=="MANUAL"){
wait(100);
run("Install...", "install=C:\\ImageJ\\macros\\_DKR_AutoScaleBrightestSlice.txt");
waitForUser("click OK \nto proceed");
}
else if(mode=="AUTO"){
new=list[i]+" - C="+channel;
selectWindow(new);
print("output: "+dir2+new+".tif");
saveAs("Tiff", dir2+new+".tif");
// batchfunction(dir1, list[i]);
}
//close all windows after dialog box is closed
while (nImages >0) close();
}
}