mirror of https://github.com/GNOME/gimp.git
plug-ins: completely reformat fits-io.*
This commit is contained in:
parent
1f22d11256
commit
24f2a24b99
File diff suppressed because it is too large
Load Diff
|
@ -19,9 +19,8 @@
|
||||||
/* #END-HDR */
|
/* #END-HDR */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifndef FITS_MAX_AXIS
|
#ifndef __FITS_IO_H__
|
||||||
|
#define __FITS_IO_H__
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define FITS_CARD_SIZE 80
|
#define FITS_CARD_SIZE 80
|
||||||
#define FITS_RECORD_SIZE 2880
|
#define FITS_RECORD_SIZE 2880
|
||||||
|
@ -41,116 +40,144 @@ typedef long FITS_LONG;
|
||||||
typedef double FITS_DOUBLE;
|
typedef double FITS_DOUBLE;
|
||||||
typedef char FITS_STRING[FITS_CARD_SIZE];
|
typedef char FITS_STRING[FITS_CARD_SIZE];
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
typ_bitpix8, typ_bitpix16, typ_bitpix32, typ_bitpixm32, typ_bitpixm64,
|
{
|
||||||
typ_fbool, typ_flong, typ_fdouble, typ_fstring
|
typ_bitpix8,
|
||||||
|
typ_bitpix16,
|
||||||
|
typ_bitpix32,
|
||||||
|
typ_bitpixm32,
|
||||||
|
typ_bitpixm64,
|
||||||
|
typ_fbool,
|
||||||
|
typ_flong,
|
||||||
|
typ_fdouble,
|
||||||
|
typ_fstring
|
||||||
} FITS_DATA_TYPES;
|
} FITS_DATA_TYPES;
|
||||||
|
|
||||||
/* How to transform FITS pixel values */
|
/* How to transform FITS pixel values */
|
||||||
typedef struct {
|
typedef struct
|
||||||
double pixmin, pixmax; /* Pixel values [pixmin,pixmax] should be mapped */
|
{
|
||||||
double datamin, datamax; /* to [datamin,datamax] */
|
gdouble pixmin, pixmax; /* Pixel values [pixmin,pixmax] should be mapped */
|
||||||
double replacement; /* datavalue to use for blank or NaN pixels */
|
gdouble datamin, datamax; /* to [datamin,datamax] */
|
||||||
char dsttyp; /* Destination typ ('c' = char) */
|
gdouble replacement; /* datavalue to use for blank or NaN pixels */
|
||||||
|
gchar dsttyp; /* Destination typ ('c' = char) */
|
||||||
} FITS_PIX_TRANSFORM;
|
} FITS_PIX_TRANSFORM;
|
||||||
|
|
||||||
typedef union {
|
typedef union
|
||||||
FITS_BITPIX8 bitpix8;
|
{
|
||||||
FITS_BITPIX16 bitpix16;
|
FITS_BITPIX8 bitpix8;
|
||||||
FITS_BITPIX32 bitpix32;
|
FITS_BITPIX16 bitpix16;
|
||||||
FITS_BITPIXM32 bitpixm32;
|
FITS_BITPIX32 bitpix32;
|
||||||
FITS_BITPIXM64 bitpixm64;
|
FITS_BITPIXM32 bitpixm32;
|
||||||
|
FITS_BITPIXM64 bitpixm64;
|
||||||
|
|
||||||
FITS_BOOL fbool;
|
FITS_BOOL fbool;
|
||||||
FITS_LONG flong;
|
FITS_LONG flong;
|
||||||
FITS_DOUBLE fdouble;
|
FITS_DOUBLE fdouble;
|
||||||
FITS_STRING fstring;
|
FITS_STRING fstring;
|
||||||
} FITS_DATA;
|
} FITS_DATA;
|
||||||
|
|
||||||
typedef struct fits_record_list { /* Record list */
|
typedef struct fits_record_list /* Record list */
|
||||||
char data[FITS_RECORD_SIZE];
|
{
|
||||||
struct fits_record_list *next_record;
|
gchar data[FITS_RECORD_SIZE];
|
||||||
|
struct fits_record_list *next_record;
|
||||||
} FITS_RECORD_LIST;
|
} FITS_RECORD_LIST;
|
||||||
|
|
||||||
|
|
||||||
typedef struct fits_hdu_list { /* Header and Data Unit List */
|
typedef struct fits_hdu_list /* Header and Data Unit List */
|
||||||
long header_offset; /* Offset of header in the file */
|
{
|
||||||
long data_offset; /* Offset of data in the file */
|
glong header_offset; /* Offset of header in the file */
|
||||||
long data_size; /* Size of data in the HDU (including pad)*/
|
glong data_offset; /* Offset of data in the file */
|
||||||
long udata_size; /* Size of used data in the HDU (excl. pad) */
|
glong data_size; /* Size of data in the HDU (including pad)*/
|
||||||
int bpp; /* Bytes per pixel */
|
glong udata_size; /* Size of used data in the HDU (excl. pad) */
|
||||||
int numpic; /* Number of interpretable images in HDU */
|
gint bpp; /* Bytes per pixel */
|
||||||
int naddcards; /* Number of additional cards */
|
gint numpic; /* Number of interpretable images in HDU */
|
||||||
char addcards[FITS_NADD_CARDS][FITS_CARD_SIZE];
|
gint naddcards; /* Number of additional cards */
|
||||||
struct {
|
gchar addcards[FITS_NADD_CARDS][FITS_CARD_SIZE];
|
||||||
char nan_value; /* NaN's found in data ? */
|
struct
|
||||||
char blank_value; /* Blanks found in data ? */
|
{
|
||||||
/* Flags specifying if some cards are used */
|
gboolean nan_value; /* NaN's found in data ? */
|
||||||
char blank; /* The corresponding data below is only */
|
gboolean blank_value; /* Blanks found in data ? */
|
||||||
char datamin; /* valid, if the flag is set. */
|
/* Flags specifying if some cards are used */
|
||||||
char datamax;
|
gchar blank; /* The corresponding data below is only */
|
||||||
char simple; /* This indicates a simple HDU */
|
gchar datamin; /* valid, if the flag is set. */
|
||||||
char xtension; /* This indicates an extension */
|
gchar datamax;
|
||||||
char gcount;
|
gchar simple; /* This indicates a simple HDU */
|
||||||
char pcount;
|
gchar xtension; /* This indicates an extension */
|
||||||
char bzero;
|
gchar gcount;
|
||||||
char bscale;
|
gchar pcount;
|
||||||
char groups;
|
gchar bzero;
|
||||||
char extend;
|
gchar bscale;
|
||||||
} used;
|
gchar groups;
|
||||||
double pixmin, pixmax; /* Minimum/Maximum pixel values */
|
gchar extend;
|
||||||
/* Some decoded data of the HDU: */
|
} used;
|
||||||
int naxis; /* Number of axes */
|
gdouble pixmin, pixmax; /* Minimum/Maximum pixel values */
|
||||||
int naxisn[FITS_MAX_AXIS]; /* Sizes of axes (NAXIS1 --> naxisn[0]) */
|
/* Some decoded data of the HDU: */
|
||||||
int bitpix; /* Data representation (8,16,32,-16,-32) */
|
gint naxis; /* Number of axes */
|
||||||
/* When using the following data, */
|
gint naxisn[FITS_MAX_AXIS]; /* Sizes of axes (NAXIS1 --> naxisn[0]) */
|
||||||
/* the used-flags must be checked before. */
|
gint bitpix; /* Data representation (8,16,32,-16,-32) */
|
||||||
long blank; /* Blank value */
|
/* When using the following data, */
|
||||||
double datamin, datamax; /* Minimum/Maximum physical data values */
|
/* the used-flags must be checked before. */
|
||||||
char xtension[FITS_CARD_SIZE]; /* Type of extension */
|
glong blank; /* Blank value */
|
||||||
long gcount, pcount; /* Used by XTENSION */
|
gdouble datamin, datamax; /* Minimum/Maximum physical data values */
|
||||||
double bzero, bscale; /* Transformation values */
|
gchar xtension[FITS_CARD_SIZE];/* Type of extension */
|
||||||
int groups; /* Random groups indicator */
|
glong gcount, pcount; /* Used by XTENSION */
|
||||||
int extend; /* Extend flag */
|
gdouble bzero, bscale; /* Transformation values */
|
||||||
|
gint groups; /* Random groups indicator */
|
||||||
|
gint extend; /* Extend flag */
|
||||||
|
|
||||||
FITS_RECORD_LIST *header_record_list; /* Header records read in */
|
FITS_RECORD_LIST *header_record_list; /* Header records read in */
|
||||||
struct fits_hdu_list *next_hdu;
|
|
||||||
|
struct fits_hdu_list *next_hdu;
|
||||||
} FITS_HDU_LIST;
|
} FITS_HDU_LIST;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
FILE *fp; /* File pointer to fits file */
|
{
|
||||||
char openmode; /* Mode the file was opened (0, 'r', 'w') */
|
FILE *fp; /* File pointer to fits file */
|
||||||
|
gchar openmode; /* Mode the file was opened (0, 'r', 'w') */
|
||||||
|
|
||||||
int n_hdu; /* Number of HDUs in file */
|
gint n_hdu; /* Number of HDUs in file */
|
||||||
int n_pic; /* Total number of interpretable pictures */
|
gint n_pic; /* Total number of interpretable pictures */
|
||||||
int nan_used; /* NaN's used in the file ? */
|
gboolean nan_used; /* NaN's used in the file ? */
|
||||||
int blank_used; /* Blank's used in the file ? */
|
gboolean blank_used; /* Blank's used in the file ? */
|
||||||
|
|
||||||
FITS_HDU_LIST *hdu_list; /* Header and Data Unit List */
|
FITS_HDU_LIST *hdu_list; /* Header and Data Unit List */
|
||||||
} FITS_FILE;
|
} FITS_FILE;
|
||||||
|
|
||||||
|
|
||||||
/* User callable functions of the FITS-library */
|
/* User callable functions of the FITS-library */
|
||||||
|
|
||||||
FITS_FILE *fits_open (const char *filename, const char *openmode);
|
FITS_FILE * fits_open (const gchar *filename,
|
||||||
void fits_close (FITS_FILE *ff);
|
const gchar *openmode);
|
||||||
FITS_HDU_LIST *fits_add_hdu (FITS_FILE *ff);
|
void fits_close (FITS_FILE *ff);
|
||||||
int fits_add_card (FITS_HDU_LIST *hdulist, const char *card);
|
FITS_HDU_LIST * fits_add_hdu (FITS_FILE *ff);
|
||||||
int fits_write_header (FITS_FILE *ff, FITS_HDU_LIST *hdulist);
|
gint fits_add_card (FITS_HDU_LIST *hdulist,
|
||||||
FITS_HDU_LIST *fits_image_info (FITS_FILE *ff, int picind, int *hdupicind);
|
const gchar *card);
|
||||||
FITS_HDU_LIST *fits_seek_image (FITS_FILE *ff, int picind);
|
gint fits_write_header (FITS_FILE *ff,
|
||||||
void fits_print_header (FITS_HDU_LIST *hdr);
|
FITS_HDU_LIST *hdulist);
|
||||||
FITS_DATA *fits_decode_card (const char *card, FITS_DATA_TYPES data_type);
|
FITS_HDU_LIST * fits_image_info (FITS_FILE *ff,
|
||||||
char *fits_search_card (FITS_RECORD_LIST *rl, char *keyword);
|
gint picind,
|
||||||
int fits_read_pixel (FITS_FILE *ff, FITS_HDU_LIST *hdulist,
|
gint *hdupicind);
|
||||||
int npix, FITS_PIX_TRANSFORM *trans, void *buf);
|
FITS_HDU_LIST * fits_seek_image (FITS_FILE *ff,
|
||||||
|
gint picind);
|
||||||
|
void fits_print_header (FITS_HDU_LIST *hdr);
|
||||||
|
FITS_DATA * fits_decode_card (const gchar *card,
|
||||||
|
FITS_DATA_TYPES data_type);
|
||||||
|
gchar * fits_search_card (FITS_RECORD_LIST *rl,
|
||||||
|
gchar *keyword);
|
||||||
|
gint fits_read_pixel (FITS_FILE *ff,
|
||||||
|
FITS_HDU_LIST *hdulist,
|
||||||
|
gint npix,
|
||||||
|
FITS_PIX_TRANSFORM *trans,
|
||||||
|
void *buf);
|
||||||
|
|
||||||
char *fits_get_error (void);
|
gchar * fits_get_error (void);
|
||||||
|
|
||||||
/* Demo functions */
|
/* Demo functions */
|
||||||
#define FITS_NO_DEMO
|
#define FITS_NO_DEMO
|
||||||
int fits_to_pgmraw (char *fitsfile, char *pgmfile);
|
gint fits_to_pgmraw (gchar *fitsfile,
|
||||||
int pgmraw_to_fits (char *pgmfile, char *fitsfile);
|
gchar *pgmfile);
|
||||||
|
gint pgmraw_to_fits (gchar *pgmfile,
|
||||||
|
gchar *fitsfile);
|
||||||
|
|
||||||
#endif
|
#endif /* __FITS_IO_H__ */
|
||||||
|
|
Loading…
Reference in New Issue