Skip to content

Instantly share code, notes, and snippets.

View cwood1967's full-sized avatar

Chris Wood cwood1967

  • Stowers Institute
  • Kansas City, MO
View GitHub Profile
@cwood1967
cwood1967 / fastexp.java
Created January 9, 2017 03:14 — forked from Alrecenk/fastexp.java
Very fast accurate approximation to Math.exp in java using floating point bit hacks.
/* fast floating point exp function
* must initialize table with buildexptable before using
Based on
A Fast, Compact Approximation of the Exponential Function
Nicol N. Schraudolph 1999
Adapted to single precision to improve speed and added adjustment table to improve accuracy.
Alrecenk 2014
@cwood1967
cwood1967 / ClickForRoi.java
Created October 21, 2016 15:19
How to draw an ROI
private void drawRoi(double x, double y) {
int x0 = (int)x - roiSize/2;
int y0 = (int)y - roiSize/2;
Roi roi = new Roi(x0, y0, roiSize, roiSize);
manager.add(imp, roi, 1);
manager.runCommand(imp, "Show All");
}