-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathBeanShell05-2.bsh
32 lines (29 loc) · 1.2 KB
/
BeanShell05-2.bsh
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
/**
* BeanShell05-2.bsh
* IJ BAR: https://github.com/tferr/Scripts#scripts
* *************************************************
* 5.2 Scripting using BAR libs II
* *************************************************
*/
// A good example of "lib usage" is Smoothed_Plot_Profile.bsh
// ('BAR>Analysis>Smoothed Plot Profile'). This script extends
// the built-in command 'Analyze> Plot Profile' by plotting a
// simple moving average (SMA) of profiled data.
// Because SMA methods are broadly useful, it was defined in
// BARlib.bsh, so it can be access by _any_ script. If it was
// defined within Smoothed_Plot_Profile.bsh, we'd have to copy
// it every time we'd need it. Wouldn't that be combursume?
//
// Questions for you:
// Q1. Can you find the SMA method in BARlib.bsh?
// (Perhaps around line 64?)
//
// Q2. Where is it called in 'Smoothed Plot Profile'?
// What? Forgot the Shif-click trick? Then press run, and
// I'll open it for you:
import ij.IJ;
IJ.setKeyDown(java.awt.event.KeyEvent.VK_SHIFT);
IJ.run("Smoothed Plot Profile");
// Q3: Can you find an equivalent function in BARlib.py?
// (You just found other neat feature of libs: Comparisons
// between scripting languages!)