/** * 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!)