NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #1422 (closed defect: fixed)

Opened 2012-08-17T15:18:04-05:00

Last modified 2012-08-20T15:09:05-05:00

Signed 16-bit images don't survive IJ2->IJ1->IJ2 round trip

Reported by: aivar Owned by: bdezonia
Priority: minor Milestone: imagej2-b4-plugins
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1420

Description

Create a test ramp image (File\New\Image) with signed 16-bit, the image looks fine with a grayscale ramp, but if you apply a LUT (Image/Lookup Tables/Fire) the LUT range is distorted.

(This is the second screen capture in luts.png, attached to parent ticket 1420.)

The range of values for the ramp image remains -32768 to 32767. (Unlike the other bugs associated with 1420 these values do not change from the roundtrip.)

I tracked the bug as far as ColorTableHarmonizer.assignChannelMinMax(). The line 'mn = imp.getDisplayRangeMin();' sets minimum to 0.0 and 'mx = imp.getDisplayRangeMax();' sets maximum to 32767.0. Next assignChannelMinMax subtracts 32768 from each (I think to convert unsigned to signed?), winding up with a range of -32768.0...-1.0. This range is used to apply the LUT, since it's about half what it should be the LUT ramp only goes halfway. It seems ImagePlus is reporting min/max wrong.

Change History

comment:1 Changed 2012-08-18T13:06:06-05:00 by bdezonia

  • Milestone set to imagej-2.0.0-beta4

comment:2 Changed 2012-08-20T15:09:05-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

IJ2 was setting min max in ImagePlus to -32768,32767. But IJ1 truncs all negative display range values to 0 when dealing with 16-bit data. Make sure that when we set display range on 16-bit data we take into account the preencoded signedness of the data. Fixed with commit 2784318b663641c147c20ffcfe0fff187d1efe92

Last edited 2012-08-20T15:09:51-05:00 by bdezonia