-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIterativePIVOverlay.ijm
40 lines (32 loc) · 1016 Bytes
/
IterativePIVOverlay.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
// Overlay IterativePIV vectors on stack
// 1. IterativePIVAdvancedBatch.ijm
// 2. IterativePIVPlot.ijm
// 3. IterativePIVOverlay.ijm
// Get stack name and dimensions
stack = getTitle();
Stack.getDimensions(width, height, channels, slices, frames);
// Swap slices with frames, if needed
if (slices > frames) {
Stack.setDimensions(channels, frames, slices);
Stack.getDimensions(width, height, channels, slices, frames);
}
// Duplicate stack without first frame
run("Duplicate...", "title=stack duplicate range=2-" + frames);
Stack.getDimensions(width, height, channels, slices, frames);
// Loop over frames to overlay PIV
for (i=1; i<frames+1; i++){
selectWindow("piv");
setSlice(i);
selectWindow("stack");
setSlice(i);
run("Add Image...", "image=piv x=0 y=0 opacity=100 zero");
}
// Set name for PIV overlay
pivovername = "PIV_Overlay_" + stack;
rename(pivovername);
// Flatten overlay
run("Flatten", "stack");
// Set name for PIV stack
selectWindow("piv");
pivname = "PIV_" + stack;
rename(pivname);