Login  Register

Re: Two pixel values !!!

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:

> Hi,
>
> I have a problem with my image files from DeltaVision (Managed with SoftWork)
>
> Whan i open my file with ImageJ, pixel values appear like that : value=x (x+32768)
>
> Thus, I have two pixel values :
> - The normal pixel value
> - This same value plus 32768
>
> The problem is : for some operations (Threshold, B&C...) ImageJ takes in account the first value, for others (3D Object Counter plugin) it takes the second value.
>
> I would like to delete the second value in my image files but i don’t know how...
>
> I put an example at thes link :
>
> http://xfer.curie.fr/get/0DPxW0CsPv8/20110712_3T3PAF_miNEG_72h_01_22_R3D.dv
> http://xfer.curie.fr/get/uaonAwJffQV/20110712_3T3PAF_miNEG_72h_01_22_R3D.dv.log

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();