You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MaRC blindly accepts the map data type specified by the user without checking to see if it is large enough to hold photo image data without loss of precision (e.g. photo data is a 4 byte integer, but the map data type is a 2 byte integer). At the very least, MaRC should warn the user about the potential loss of precision.
A more sophisticated check would involve checking the photo image data to determine if it would fit into a map with a smaller data type. This can be achieved by either of the following, or a combination of them:
Retrieve the DATAMIN and DATAMAX values, if available, from the photo image FITS file. Convert them to image array values by reversing the physical data = image data * BSCALE + BZERO transformation (BSCALE = 1 and BZERO = 0, if not available). Alternatively, BSCALE and BZERO could be applied to the map data type minimum and maximum. The photo image data minimum and maximum values could then be compared to the map data type minimum and maximum to determine if they will fit. New scale and offset values could be calculated through the MaRC::scale_and_offset() function, if choosing new values is an option.
Search for the minimum and maximum values in the source image array, and repeat the above source image / map data type comparison, as well as potential calculation of scale and offset values.
MaRC blindly accepts the map data type specified by the user without checking to see if it is large enough to hold photo image data without loss of precision (e.g. photo data is a 4 byte integer, but the map data type is a 2 byte integer). At the very least, MaRC should warn the user about the potential loss of precision.
See #62 for a related issue.
The text was updated successfully, but these errors were encountered: