Skip to content

refactor WCS usage

cec m requested to merge wcs_refactoring into master

Addresses point 1 of #1154 Fixes #1233 (closed)

This MR updates WCSLIB version to 8.2 in the subproject as fallback for some builds (see at the bottom).
It also removes redundant keywords bewteen fits structures:

  • wcsdata now holds only ra, dec and platesolved flag and string
  • wcslib contains all the platesolve solution terms (CRPIX, CRVAL, CDELT, PC etc....)

The function load_wcs_from_memory has been removed as it was used mainly to keep redundant terms synced.
Function load_wcs_from_file has been renamed to load_wcs_from_fits and the header parsing part with wcslib::wcspih has been extracted to a new function wcsprm_t *load_WCS_from_hdr which returns a wcsprm structure (or NULL if none if found).
For astrotiff and XSIF, direct header parsing is made with same load_WCS_from_hdr (after making the header string compliant with the required 80-char block spec from CFITSIO).

For the time-being, headers with distorsion terms can be read but cannot be written. This will be addressed in part 3 of #1154.

TODO:

  • update wcslib subproject and build from there for windows and appimage
  • make wcslib a mandatory dep
  • remove all wcs terms from fit->wcsdata. Keep only ra, dec terms, which will reflect was was written by imaging software. Use fit->wcslib instead

Last point in more details:

  • no longer need load_wcs_from_memory to keep the 2 structs synced. load_wcs_from_file is still valid as it already loads dist info from picture solved from astrometry.net (outside Siril which discards distortion terms)
  • add filling wcslib struct from platesolver
  • add updating wcslib struct from reframe_astrometry_data
  • update save_wcs_keywords (use wcslib instead of wcsdata)
  • check all occurences of has_wcsdata
  • check loading xisf (needed to remove PV keywords)
  • check loading astro-tiff
  • check loading astap
  • check loading asnet with SIP
  • check behavior with undo/redo
  • check asnet solve
  • check platesolve downsampling
  • check merge_fits_headers_to_result2
  • check wcslib is present after stack

WCSLIB
version must be >= 7.12 (to handle bug corrected in wcsp2s() used by wcs2pix_array and fixed in 7.12)

  • debian-testing: 8.1+ds-2
  • debian-oldstable (appimage):7.4+ds-2 => built by fallback (8.2)
  • windows: built by fallback (8.2)
  • macos: 8.1
  • flatpak: updated to 8.2
    Building with meson should use fallback if installed version is lower than required
Edited by cec m

Merge request reports