-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Description
Proposal Details
Context / Use Case
There is a good global Bathymetric data set called GEBCO that provides the data as downloadable GeoTIFF tiles. These tiles cannot be opened by x/image/tiff today, as the tiff reader only supports the unsigned integer sample format, and the GEBCO tiles are in signed int16 sample format (elevations in the ocean encoded as negative integers in units of feet).
For my own use today, it is simple to fork /x/image and modify tiff to read signed int16 as if it were uint16, and then on accessing pixels in my program just re-interpret, e.g. int16(pixValue.Y). This does require prior knowledge that the file is signed format to do this, and I don't recommend implementing this solution into the tiff reader since it effectively treats unsigned and signed sample format the same, which is incorrect. Additionally, this issue likely applies to more bathymetric data sets, partial and global, in tiff or other image formats, since almost all absolute depth/elevation in feet fits very nicely into the int16 data type. It is possible that there are other medical imaging use cases for signed gray values as well, though I am not familiar with these.
Proposed Changes
I proposing adding 'gray signed 16' color models to see if this is motivating for the standard library or its extensions, with the target of using this addition in the /x/image/tiff package.
- Add a new
color.Colorimplementation:color.GrayS16 - Add a new
color.Modelimplementation:color.GrayS16Model- The conversion to RGBA here could be largely use the logic in
color.Gray16Model
- The conversion to RGBA here could be largely use the logic in
- Add a new
image.Imageimplementation:image.GrayS16- Largely similar to
image.Gray16, except: image.GrayS16.Atwould returncolor.GrayS16- Use
GrayS16At(x, y int) color.GrayS16method
- Largely similar to
I am willing to submit Pull Requests with this solution if it seems acceptable, and also acknowledge that making additions to the standard library is not to be taken lightly.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status