DOI-USGS / ISIS3

Integrated Software for Imagers and Spectrometers v3. ISIS3 is a digital image processing software package to manipulate imagery collected by current and past NASA and International planetary missions.
https://isis.astrogeology.usgs.gov
Other
198 stars 168 forks source link

Potential noproj error when undistorting CaSSIS images #5126

Closed AustinSanders closed 1 year ago

AustinSanders commented 1 year ago

ISIS version(s) affected: 7.x

Description
When noproj is run on a single filter band for CaSSIS, it puts the filter in the very top left of the 2048x2048 detector plane. However, when tgocassisstitch is run, the filter band is placed in the correct location of the detector plane. In this case, running noproj on the stitched cube appears to perform distortion correction as expected.

It appears that noproj is not performing correctly in this scenario, but it is somewhat unclear.

On the left is the noproj cube. On the right is the same after running tgocassisstitch followed by noproj. download

How to reproduce Running noproj on a single framelet produces different results than running noproj on a stitched .cub

Possible Solution

Additional context

chkim-usgs commented 1 year ago

Slight paraphrasing, credit to @AustinSanders:

It looks like tgocassis2isis throws away the context of where the framelet is oriented on the CCD and crops out all the null space so that every pixel in the cube has data. Currently, noproj has no way of orienting the framelet within the CCD therefore starting the image at (line,sample) = (0,0), meaning that noproj seems to be working as intended.

tgocassisstitch resets the dimensions to the full context of the CCD using the information stored in the AlphaCube group, effectively resetting the changes made by tgocassis2isis. Since the framelet is now contextualized within the broader CCD, noproj can produce an image with a mixture of data and nodata values like the user desired in this case.

We could potentially add an option to tgocassis2isis that retains the framelet orientation within the CCD and populates null values. Maybe something like "crop=<TRUE|FALSE>" where the default is true. False would create a .cub that preserves the full range of the CCD and sets nodata=NULL.

chkim-usgs commented 1 year ago

Response from Sarah (CaSSIS team):

I think I understand what is expected better now. I am still a little puzzled as to why noproj puts the image data in the upper left corner of the detector; I was thinking that noproj should put the image data in place on the detector (similar to what tgocassisstitch does, except for just the one filter), because that is how it works for HiRISE CCDs by placing them in their position relative to the focal plane. So far, running tgocassisstitch followed by noproj seems to work. Mainly I need noproj to remove distortions, which is seems to be doing the same way in either case. I don’t think a modification to tgocassis2isis is necessary.