Author Topic: Deleting of Previews or Astrometric solutions really necessary?  (Read 6240 times)

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
1. Previews and geometrical transformations
When trying to apply a geometric transformation (one of the processes Crop, DynamicCrop, FastRotation, IntegerResample, Resample, and Rotation) to an image containing a preview, the following Warning is displayed:
Code: [Select]
"The following items will be deleted as a result of the geometric transformation:   Previews
Some of these side effects could be irreversible. Proceed?"
This is correct for the processes DynamicCrop, Rotation, Resample and IntegerResample. However, for rotations by multiple of 90 degrees, and for Horizontal and Vertical Mirroring, the coordinates of the preview could be easily transformed as well, thus making possible the preservation of the preview in the resulting image.


2. Astrometric solution and geometric transformations
The like holds for images containing an astrometric solution. When trying to apply a geometric transformation to an image containing an astrometric solution, the following Warning is displayed:
Code: [Select]
"The following items will be deleted as a result of the geometric transformation:   Astrometric solution
Some of these side effects could be irreversible. Proceed?"
This is correct for the processes Crop, DynamicCrop, Horizontal and Vertical Mirror, Rotation, Resample and Integer Resample. However, for rotations by multiple of 90 degrees, it doesn't seem to be necessary. In these special cases it should be possible to adjust the astrometric solution accordingly.

Bernd

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Deleting of Previews or Astrometric solutions really necessary?
« Reply #1 on: 2020 January 21 11:30:20 »
Hi Bernd,

Quote
However, for rotations by multiple of 90 degrees, and for Horizontal and Vertical Mirroring, the coordinates of the preview could be easily transformed as well, thus making possible the preservation of the preview in the resulting image.

The task is not as simple as mirroring or rotating the preview rectangles. Stored preview states, which may include swap images and other temporary structures, should be either destroyed or transformed to remain coherent. Even more complicated and potentially dangerous is the fact that process instances (in the same preview's processing history, and/or in the histories of other views) may depend on preview coordinates, and neither the core application nor the Geometry module have any way to know them, let alone how to apply the required mutations. So the only safe action here, on a general basis, is to destroy the previews, along with all of their associated instances and data structures.

Quote
However, for rotations by multiple of 90 degrees, it doesn't seem to be necessary. In these special cases it should be possible to adjust the astrometric solution accordingly.

That should be relatively easy for linear WCS solutions, but would be quite complicated for nonlinear solutions based on thin plate splines, especially taking into account that our astrometry routines are subject to strong research and development work, so they will evolve considerably in the medium-long term. Although this is doable, I'm not sure if the required increment in complexity to implement this feature would be worth the benefits.
« Last Edit: 2020 January 21 11:51:02 by Juan Conejero »
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Re: Deleting of Previews or Astrometric solutions really necessary?
« Reply #2 on: 2020 January 22 05:58:20 »
Hi Juan,

OK, things are not as simple as I imagined, and the removal of certain information probably is necessary.

However, the extent of information that is removed by geometric transformations is definitely overkill. I will give you an example: the 180-degree rotation also removes the following 8 FITS keywords:

XPIXSZ
YPIXSZ
FOCALLEN
RA
OBJCTRA    (compatibility)
DEC
OBJCTDEC   (compatibility)
EQUINOX


which can be seen in the appended screen sections. Since the coordinates RA, OBJECTRA, DEC and OBJECTDEC refer to the image center, neither of these values are changed by a rotation by multiple of 90 degrees or Horizontal and Vertical Mirroring. So there is no need for removing one of the above listed FITS keywords.

Also removed are the corresponding 6 properties:

Instrument:Sensor:XPixelSize
Instrument:Sensor:YPixelSize
Instrument:Telescope:FocalLength
Observation:Center:Dec
Observation:Center:RA
Observation:Equinox


However, for a crop process it would be necessary to remove 4 FITS keywords (RA, OBJCTRA, DEC, OBJCTDEC) and 2 properties (RA, DEC).

Bernd

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Deleting of Previews or Astrometric solutions really necessary?
« Reply #3 on: 2020 January 29 03:43:25 »
Hi Bernd,

OK, agreed. I'll try to implement the required changes to these processes to preserve most of the existing metadata when possible, as you have described. Thank you for pointing out these issues.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/