mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
plug-ins: Port FITS plug-in to cfitsio library
Switch to NASA-maintained cfitsio library for loading/exporting FITS images. This allows us to import compressed FITS files (GZIP, HCOMP, PLIO, RICE) in 8/16/32 bit and float/double precision. It also simplifies export code using the built-in cfitsio APIs.
This commit is contained in:
parent
4a67ee4035
commit
d4f420769c
11 changed files with 507 additions and 3361 deletions
|
@ -73,7 +73,7 @@ build-image:
|
||||||
- echo "FROM debian:testing" > Dockerfile
|
- echo "FROM debian:testing" > Dockerfile
|
||||||
- echo "RUN apt-get update" >> Dockerfile
|
- echo "RUN apt-get update" >> Dockerfile
|
||||||
- echo "RUN apt-get install -y --no-install-recommends \\" >> Dockerfile
|
- echo "RUN apt-get install -y --no-install-recommends \\" >> Dockerfile
|
||||||
- echo "appstream at-spi2-core automake autopoint build-essential desktop-file-utils ffmpeg gettext ghostscript gi-docgen git glib-networking gobject-introspection graphviz graphviz-dev hicolor-icon-theme iso-codes libaa1-dev libappstream-glib-dev libbz2-dev libdbus-glib-1-dev libexif-dev libgexiv2-dev libgirepository1.0-dev libgs-dev libgtk-3-bin libgtk-3-dev libgudev-1.0-dev libheif-dev libjson-glib-dev libjxl-dev liblcms2-dev liblzma-dev libmng-dev libmypaint-dev libopenexr-dev libpoppler-glib-dev libraw-dev libraw20 librsvg2-dev libspiro-dev libsuitesparse-dev libtiff-dev libtiff5-dev libtool libumfpack5 libwebp-dev libwmf-dev libxmu-dev libxpm-dev luajit meson mypaint-brushes poppler-data python3 python3-pip valac xauth xsltproc xvfb xz-utils yelp-tools" >> Dockerfile
|
- echo "appstream at-spi2-core automake autopoint build-essential desktop-file-utils ffmpeg gettext ghostscript gi-docgen git glib-networking gobject-introspection graphviz graphviz-dev hicolor-icon-theme iso-codes libaa1-dev libappstream-glib-dev libbz2-dev libcfitsio-dev libdbus-glib-1-dev libexif-dev libgexiv2-dev libgirepository1.0-dev libgs-dev libgtk-3-bin libgtk-3-dev libgudev-1.0-dev libheif-dev libjson-glib-dev libjxl-dev liblcms2-dev liblzma-dev libmng-dev libmypaint-dev libopenexr-dev libpoppler-glib-dev libraw-dev libraw20 librsvg2-dev libspiro-dev libsuitesparse-dev libtiff-dev libtiff5-dev libtool libumfpack5 libwebp-dev libwmf-dev libxmu-dev libxpm-dev luajit meson mypaint-brushes poppler-data python3 python3-pip valac xauth xsltproc xvfb xz-utils yelp-tools" >> Dockerfile
|
||||||
|
|
||||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:build-debian-latest --cache=true --cache-ttl=120h
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:build-debian-latest --cache=true --cache-ttl=120h
|
||||||
|
|
||||||
|
|
|
@ -790,6 +790,26 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "cfitsio",
|
||||||
|
"config-opts": [
|
||||||
|
"--enable-reentrant"
|
||||||
|
],
|
||||||
|
"make-args": ["shared"],
|
||||||
|
"cleanup": [
|
||||||
|
"/include",
|
||||||
|
"/lib/*.a",
|
||||||
|
"/lib/*.la",
|
||||||
|
"/lib/pkgconfig"
|
||||||
|
],
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"type": "archive",
|
||||||
|
"url": "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.2.0.tar.gz",
|
||||||
|
"sha256": "eba53d1b3f6e345632bb09a7b752ec7ced3d63ec5153a848380f3880c5d61889"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "babl",
|
"name": "babl",
|
||||||
"buildsystem": "meson",
|
"buildsystem": "meson",
|
||||||
|
|
|
@ -28,6 +28,7 @@ fi
|
||||||
|
|
||||||
crossroad install appstream-glib \
|
crossroad install appstream-glib \
|
||||||
atk \
|
atk \
|
||||||
|
cfitsio \
|
||||||
drmingw \
|
drmingw \
|
||||||
gexiv2 \
|
gexiv2 \
|
||||||
glib2 \
|
glib2 \
|
||||||
|
|
|
@ -33,6 +33,7 @@ pacman --noconfirm -S --needed \
|
||||||
mingw-w64-$MSYS2_ARCH-atk \
|
mingw-w64-$MSYS2_ARCH-atk \
|
||||||
mingw-w64-$MSYS2_ARCH-brotli \
|
mingw-w64-$MSYS2_ARCH-brotli \
|
||||||
mingw-w64-$MSYS2_ARCH-cairo \
|
mingw-w64-$MSYS2_ARCH-cairo \
|
||||||
|
mingw-w64-$MSYS2_ARCH-cfitsio \
|
||||||
mingw-w64-$MSYS2_ARCH-drmingw \
|
mingw-w64-$MSYS2_ARCH-drmingw \
|
||||||
mingw-w64-$MSYS2_ARCH-gexiv2 \
|
mingw-w64-$MSYS2_ARCH-gexiv2 \
|
||||||
mingw-w64-$MSYS2_ARCH-ghostscript \
|
mingw-w64-$MSYS2_ARCH-ghostscript \
|
||||||
|
|
|
@ -2206,6 +2206,13 @@ fi
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_DX_DINPUT, test "x$have_dx_dinput" = xyes)
|
AM_CONDITIONAL(HAVE_DX_DINPUT, test "x$have_dx_dinput" = xyes)
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Check for cfitsio
|
||||||
|
###################
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(CFITSIO, [cfitsio],, [add_deps_error([cfitsio])])
|
||||||
|
MIME_TYPES="$MIME_TYPES;image/fits"
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Check for libgudev
|
# Check for libgudev
|
||||||
|
|
|
@ -1000,6 +1000,11 @@ if directx_sdk_path != '' and platform_windows
|
||||||
endif
|
endif
|
||||||
conf.set('HAVE_DX_DINPUT', directx.found())
|
conf.set('HAVE_DX_DINPUT', directx.found())
|
||||||
|
|
||||||
|
cfitsio_dep = dependency('cfitsio', required: true)
|
||||||
|
if cfitsio_dep.found()
|
||||||
|
MIMEtypes += 'image/fits'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Email sending
|
# Email sending
|
||||||
|
|
|
@ -25,9 +25,7 @@ libexecdir = $(gimpplugindir)/plug-ins/file-fits
|
||||||
libexec_PROGRAMS = file-fits
|
libexec_PROGRAMS = file-fits
|
||||||
|
|
||||||
file_fits_SOURCES = \
|
file_fits_SOURCES = \
|
||||||
fits.c \
|
fits.c
|
||||||
fits-io.c \
|
|
||||||
fits-io.h
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
|
@ -47,4 +45,5 @@ LDADD = \
|
||||||
$(GEGL_LIBS) \
|
$(GEGL_LIBS) \
|
||||||
$(RT_LIBS) \
|
$(RT_LIBS) \
|
||||||
$(INTLLIBS) \
|
$(INTLLIBS) \
|
||||||
|
$(CFITSIO_LIBS) \
|
||||||
$(file_fits_RC)
|
$(file_fits_RC)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,199 +0,0 @@
|
||||||
/******************************************************************************/
|
|
||||||
/* Peter Kirchgessner */
|
|
||||||
/* e-mail: pkirchg@aol.com */
|
|
||||||
/* WWW : http://members.aol.com/pkirchg */
|
|
||||||
/******************************************************************************/
|
|
||||||
/* #BEG-HDR */
|
|
||||||
/* */
|
|
||||||
/* Package : FITS reading/writing library */
|
|
||||||
/* Modul-Name : fitsrw.h */
|
|
||||||
/* Description : Include file for FITS-r/w-library */
|
|
||||||
/* Function(s) : */
|
|
||||||
/* Author : P. Kirchgessner */
|
|
||||||
/* Date of Gen. : 12-Apr-97 */
|
|
||||||
/* Last modified : 17-May-97 */
|
|
||||||
/* Version : 0.10 */
|
|
||||||
/* Compiler Opt. : */
|
|
||||||
/* Changes : */
|
|
||||||
/* */
|
|
||||||
/* #END-HDR */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __FITS_IO_H__
|
|
||||||
#define __FITS_IO_H__
|
|
||||||
|
|
||||||
#define FITS_CARD_SIZE 80
|
|
||||||
#define FITS_RECORD_SIZE 2880
|
|
||||||
#define FITS_MAX_AXIS 999
|
|
||||||
|
|
||||||
#define FITS_NADD_CARDS 128
|
|
||||||
|
|
||||||
/* Data representations */
|
|
||||||
|
|
||||||
typedef guchar FitsBitpix8;
|
|
||||||
typedef gint16 FitsBitpix16;
|
|
||||||
typedef gint32 FitsBitpix32;
|
|
||||||
typedef float FitsBitpixM32;
|
|
||||||
typedef double FitsBitpixM64;
|
|
||||||
typedef gint32 FitsBool;
|
|
||||||
typedef gint32 FitsLong;
|
|
||||||
typedef double FitsDouble;
|
|
||||||
typedef char FitsString[FITS_CARD_SIZE];
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
FITS_DATA_TYPE_BITPIX_8,
|
|
||||||
FITS_DATA_TYPE_BITPIX_16,
|
|
||||||
FITS_DATA_TYPE_BITPIX_32,
|
|
||||||
FITS_DATA_TYPE_BITPIX_M32,
|
|
||||||
FITS_DATA_TYPE_BITPIX_M64,
|
|
||||||
FITS_DATA_TYPE_FBOOL,
|
|
||||||
FITS_DATA_TYPE_FLONG,
|
|
||||||
FITS_DATA_TYPE_FDOUBLE,
|
|
||||||
FITS_DATA_TYPE_FSTRING
|
|
||||||
} FitsDataType;
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
FitsBitpix8 bitpix8;
|
|
||||||
FitsBitpix16 bitpix16;
|
|
||||||
FitsBitpix32 bitpix32;
|
|
||||||
FitsBitpixM32 bitpixm32;
|
|
||||||
FitsBitpixM64 bitpixm64;
|
|
||||||
FitsBool fbool;
|
|
||||||
FitsLong flong;
|
|
||||||
FitsDouble fdouble;
|
|
||||||
FitsString fstring;
|
|
||||||
} FitsData;
|
|
||||||
|
|
||||||
|
|
||||||
/* How to transform FITS pixel values */
|
|
||||||
|
|
||||||
typedef struct _FitsPixTransform FitsPixTransform;
|
|
||||||
|
|
||||||
struct _FitsPixTransform
|
|
||||||
{
|
|
||||||
gdouble pixmin, pixmax; /* Pixel values [pixmin,pixmax] should be mapped */
|
|
||||||
gdouble datamin, datamax; /* to [datamin,datamax] */
|
|
||||||
gdouble replacement; /* datavalue to use for blank or NaN pixels */
|
|
||||||
gchar dsttyp; /* Destination typ ('c' = char) */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Record list */
|
|
||||||
|
|
||||||
typedef struct _FitsRecordList FitsRecordList;
|
|
||||||
|
|
||||||
struct _FitsRecordList
|
|
||||||
{
|
|
||||||
gchar data[FITS_RECORD_SIZE];
|
|
||||||
FitsRecordList *next_record;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Header and Data Unit List */
|
|
||||||
|
|
||||||
typedef struct _FitsHduList FitsHduList;
|
|
||||||
|
|
||||||
struct _FitsHduList
|
|
||||||
{
|
|
||||||
glong header_offset; /* Offset of header in the file */
|
|
||||||
glong data_offset; /* Offset of data in the file */
|
|
||||||
glong data_size; /* Size of data in the HDU (including pad)*/
|
|
||||||
glong udata_size; /* Size of used data in the HDU (excl. pad) */
|
|
||||||
gint bpp; /* Bytes per pixel */
|
|
||||||
gint numpic; /* Number of interpretable images in HDU */
|
|
||||||
gint naddcards; /* Number of additional cards */
|
|
||||||
gchar addcards[FITS_NADD_CARDS][FITS_CARD_SIZE];
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
gboolean nan_value; /* NaN's found in data ? */
|
|
||||||
gboolean blank_value; /* Blanks found in data ? */
|
|
||||||
/* Flags specifying if some cards are used */
|
|
||||||
gchar blank; /* The corresponding data below is only */
|
|
||||||
gchar datamin; /* valid, if the flag is set. */
|
|
||||||
gchar datamax;
|
|
||||||
gchar simple; /* This indicates a simple HDU */
|
|
||||||
gchar xtension; /* This indicates an extension */
|
|
||||||
gchar gcount;
|
|
||||||
gchar pcount;
|
|
||||||
gchar bzero;
|
|
||||||
gchar bscale;
|
|
||||||
gchar groups;
|
|
||||||
gchar extend;
|
|
||||||
} used;
|
|
||||||
gdouble pixmin, pixmax; /* Minimum/Maximum pixel values */
|
|
||||||
/* Some decoded data of the HDU: */
|
|
||||||
gint naxis; /* Number of axes */
|
|
||||||
gint naxisn[FITS_MAX_AXIS]; /* Sizes of axes (NAXIS1 --> naxisn[0]) */
|
|
||||||
gint bitpix; /* Data representation (8,16,32,-16,-32) */
|
|
||||||
/* When using the following data, */
|
|
||||||
/* the used-flags must be checked before. */
|
|
||||||
glong blank; /* Blank value */
|
|
||||||
gdouble datamin, datamax; /* Minimum/Maximum physical data values */
|
|
||||||
gchar xtension[FITS_CARD_SIZE];/* Type of extension */
|
|
||||||
glong gcount, pcount; /* Used by XTENSION */
|
|
||||||
gdouble bzero, bscale; /* Transformation values */
|
|
||||||
gint groups; /* Random groups indicator */
|
|
||||||
gint extend; /* Extend flag */
|
|
||||||
|
|
||||||
FitsRecordList *header_record_list; /* Header records read in */
|
|
||||||
|
|
||||||
FitsHduList *next_hdu;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _FitsFile FitsFile;
|
|
||||||
|
|
||||||
struct _FitsFile
|
|
||||||
{
|
|
||||||
FILE *fp; /* File pointer to fits file */
|
|
||||||
gchar openmode; /* Mode the file was opened (0, 'r', 'w') */
|
|
||||||
|
|
||||||
gint n_hdu; /* Number of HDUs in file */
|
|
||||||
gint n_pic; /* Total number of interpretable pictures */
|
|
||||||
gboolean nan_used; /* NaN's used in the file ? */
|
|
||||||
gboolean blank_used; /* Blank's used in the file ? */
|
|
||||||
|
|
||||||
FitsHduList *hdu_list; /* Header and Data Unit List */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* User callable functions of the FITS-library */
|
|
||||||
|
|
||||||
FitsFile * fits_open (const gchar *filename,
|
|
||||||
const gchar *openmode);
|
|
||||||
void fits_close (FitsFile *ff);
|
|
||||||
FitsHduList * fits_add_hdu (FitsFile *ff);
|
|
||||||
gint fits_add_card (FitsHduList *hdulist,
|
|
||||||
const gchar *card);
|
|
||||||
gint fits_write_header (FitsFile *ff,
|
|
||||||
FitsHduList *hdulist);
|
|
||||||
FitsHduList * fits_image_info (FitsFile *ff,
|
|
||||||
gint picind,
|
|
||||||
gint *hdupicind);
|
|
||||||
FitsHduList * fits_seek_image (FitsFile *ff,
|
|
||||||
gint picind);
|
|
||||||
void fits_print_header (FitsHduList *hdr);
|
|
||||||
FitsData * fits_decode_card (const gchar *card,
|
|
||||||
FitsDataType data_type);
|
|
||||||
gchar * fits_search_card (FitsRecordList *rl,
|
|
||||||
gchar *keyword);
|
|
||||||
gint fits_read_pixel (FitsFile *ff,
|
|
||||||
FitsHduList *hdulist,
|
|
||||||
gint npix,
|
|
||||||
FitsPixTransform *trans,
|
|
||||||
void *buf);
|
|
||||||
|
|
||||||
gchar * fits_get_error (void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Demo functions */
|
|
||||||
|
|
||||||
#define FITS_NO_DEMO
|
|
||||||
gint fits_to_pgmraw (gchar *fitsfile,
|
|
||||||
gchar *pgmfile);
|
|
||||||
gint pgmraw_to_fits (gchar *pgmfile,
|
|
||||||
gchar *fitsfile);
|
|
||||||
|
|
||||||
#endif /* __FITS_IO_H__ */
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,6 @@
|
||||||
plugin_name = 'file-fits'
|
plugin_name = 'file-fits'
|
||||||
|
|
||||||
plugin_sources = [
|
plugin_sources = [
|
||||||
'fits-io.c',
|
|
||||||
'fits.c',
|
'fits.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -21,7 +20,10 @@ endif
|
||||||
|
|
||||||
executable(plugin_name,
|
executable(plugin_name,
|
||||||
plugin_sources,
|
plugin_sources,
|
||||||
dependencies: libgimpui_dep,
|
dependencies: [
|
||||||
|
libgimpui_dep,
|
||||||
|
cfitsio_dep,
|
||||||
|
],
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: gimpplugindir / 'plug-ins' / plugin_name,
|
install_dir: gimpplugindir / 'plug-ins' / plugin_name,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue