Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Jul 20, 2011; 4:32am
URL: http://imagej.273.s1.nabble.com/Two-pixel-values-tp3683840p3683841.html
On Jul 18, 2011, at 8:14 AM, Sylvain Cantaloube wrote:
Use the Plugins>Tools>Signed 16-bit to Unsigned script to make the images unsigned. This script, shown below, is included with ImageJ 1.44.
-wayne
imp = IJ.getImage();
stack = imp.getStack();
if (stack.isVirtual())
IJ.error("Non-virtual stack required");
cal = imp.getCalibration();
if (!cal.isSigned16Bit())
IJ.error("Signed 16-bit image required");
cal.disableDensityCalibration();
ip = imp.getProcessor();
min = ip.getMin();
max = ip.getMax();
stats = new StackStatistics(imp);
minv = stats.min;
for (i=1; i<=stack.getSize(); i++) {
ip = stack.getProcessor(i);
ip.add(-minv);
}
imp.setStack(stack);
ip = imp.getProcessor();
ip.setMinAndMax(min-minv, max-minv);
imp.updateAndDraw();