/** * BeanShell05-3.bsh * IJ BAR: https://github.com/tferr/Scripts#scripts * ************************************************* * 5.3 Scripting using BAR libs III * ************************************************* */ // <> // OK! That will be easy. Here is what we have to do: // // 1. Create a method for the new functionality // 2. Place it in a lib // 3. Instruct Smoothed_Plot_Profile.bsh to use the new // method // STEP 1: // I propose using the built-in CurveFitter of ImageJ1 // (but go ahead and use one of Fiji's third-party // libraries if you prefer otherwise). Something like: /** This method returns a gaussian fit from X,Y data */ double[] getGaussian(double[]xvalues, double[] yvalues) { import ij.measure.CurveFitter; // http://javadoc.imagej.net/ImageJ1/index.html?ij/measure/CurveFitter.html cf = new CurveFitter(xvalues, yvalues); cf.doFit(CurveFitter.GAUSSIAN); fittedValues = new double[xvalues.length]; for (i=0; i> // and I'll open it for you: import bar.Utils; Utils.openScript(Utils.getLibDir(), "BARlib.bsh");