Re: macro: convert calibrated value to raw pixel value?

Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/macro-convert-calibrated-value-to-raw-pixel-value-tp5022651p5022687.html

On Thursday, 14 November 2019 23:31:26 GMT [hidden email] wrote:

> For 2D, getPixel(x,y) works okay, it only takes a few seconds per
> image.

Plugins run in general much quicker.  Have a look at the IJ source code in
ImageProcessor.java, line 1759:
/** This is a faster version of getPixel() that does not do bounds checking.
*/
public abstract int get(int x, int y);

When processing a single image it might not make a big difference, but it may
do when using iterative loops or intensive access to image data.

I seem to remember (but I have not done any benchmarking) that 1D arrays work
faster than 2D arrays, so  this might bring some further advantage:

public abstract int get(int index);

There are also floating versions of these.

Regards

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html