-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQUIRREL_thunderSTORM_splitter.ijm
51 lines (41 loc) · 1.45 KB
/
SQUIRREL_thunderSTORM_splitter.ijm
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
// make dialog
makeDialog();
// grab values from dialog
start = Dialog.getNumber();
end = Dialog.getNumber();
increment = Dialog.getNumber();
topLeftX = Dialog.getNumber();
topLeftY = Dialog.getNumber();
originalWidth = Dialog.getNumber();
originalHeight = Dialog.getNumber();
magnification = Dialog.getNumber();
// set up output stack
width = originalWidth*magnification;
height = originalHeight*magnification;
nFrames = floor((end-start)/increment);
newImage("SR stack", "32-bit black", width, height, nFrames);
// populate stack
for(n=1; n<=nFrames; n++){
thisEnd = start + (n*increment);
run("Show results table", "action=filter formula=[frame>"+(start-1)+" & frame<"+thisEnd+"]");
run("Visualization", "imleft="+topLeftX+" imtop="+topLeftY+" imwidth="+originalWidth+" imheight="+originalHeight+" renderer=[Averaged shifted histograms] magnification="+magnification+" colorize=false threed=false shifts=2");
run("Select All");
run("Copy");
close();
selectWindow("SR stack");
setSlice(n);
setMetadata("Label", "Frames "+start+"-"+(thisEnd-1));
run("Paste");
}
function makeDialog(){
Dialog.create("Split up particles table");
Dialog.addNumber("Start frame", 1);
Dialog.addNumber("End frame", 10000);
Dialog.addNumber("Increment", 50);
Dialog.addNumber("Top left x", 0);
Dialog.addNumber("Top left y", 0);
Dialog.addNumber("Original image width", 128);
Dialog.addNumber("Original image height", 128);
Dialog.addNumber("Magnification", 5);
Dialog.show();
}