heurisko bug no. 6096
This applies to heurisko 4 and higher.
a) Data of an integer object written by heurisko into a TIFF file is always detected as signed data by other TIFF readers regardless of the object being signed or unsigned.
b) Integer data read by heurisko from a TIFF file is always stored in an unsigend object regardless of the data being signed or unsigned.
a) An integer object saved by heurisko in a TIFF file is always marked as signed by setting TIFFTAG_SAMPLEFORMAT to SAMPLEFORMAT_INT regardless of the object being signed or unsigned.
b) Integer data read by heurisko from a TIFF file is always considered unsigned regardless of the TIFF tag TIFFTAG_SAMPLEFORMAT in the file. Note that heurisko automatically changes the signedness of the target object to unsigend if this is not already the case.
a) This is correct for signed data. But it is also no problem for unsigend data as long as the numbers in the data are smaller than 2x-1 where x is the number of bits for each number. If the numbers are larger, the data is still correctly written into the file. Merely the TIFF tag TIFFTAG_SAMPLEFORMAT is set to a false value. This causes a problem when reading the data with a TIFF reader other than heurisko. For reading with heurisko see b).
b) This is correct for unsigned data. It is also no problem as long as signed data is positive. Negative numbers are misinterpreted although the data on a bit basis is still correct. If you need to read back signed data with negative numbers you can use an alias object to interpret the data correctly:
ushort image[ny][nx]; # Object of unsigned type but with signed data
short alias_image = image; # Object that interprets the data in image correctly.
This bug has been fixed in heurisko 6.3.1.