Ticket #1422 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

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


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 7 years ago by bdezonia

  • Milestone set to imagej-2.0.0-beta4

comment:2 Changed 7 years ago 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 7 years ago by bdezonia (previous) (diff)
Note: See TracTickets for help on using tickets.