📄 fitsio.h
字号:
/* Version Info: This file is distributed with version 2.510 of CFITSIO */
/* The FITSIO software was written by William Pence at the High Energy */
/* Astrophysic Science Archive Research Center (HEASARC) at the NASA */
/* Goddard Space Flight Center. */
/*
Copyright (Unpublished--all rights reserved under the copyright laws of
the United States), U.S. Government as represented by the Administrator
of the National Aeronautics and Space Administration. No copyright is
claimed in the United States under Title 17, U.S. Code.
Permission to freely use, copy, modify, and distribute this software
and its documentation without fee is hereby granted, provided that this
copyright notice and disclaimer of warranty appears in all copies.
DISCLAIMER:
THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,
EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE
DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE
SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY
DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY
CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY
PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED
FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR
SERVICES PROVIDED HEREUNDER."
*/
#ifndef _FITSIO_H
#define _FITSIO_H
#include <stdio.h>
#if defined(linux) || defined(__APPLE__)
# include <sys/types.h> /* apparently needed on debian linux systems */
#endif /* to define off_t */
#include <stdlib.h> /* apparently needed to define size_t with gcc 2.8.1 */
#include <limits.h> /* needed for LLONG_MAX and INT64_MAX definitions */
/* Define the datatype for variables which store file offset values. */
/* The new 'off_t' datatype should be used for this purpose, but some */
/* older compilers do not recognize this type, in which case we use 'long' */
/* instead. Note that _OFF_T is defined (or not) in stdio.h depending */
/* on whether _LARGEFILE_SOURCE is defined in sys/feature_tests.h */
/* (at least on Solaris platforms using cc) */
/* Debian systems require the 2nd test, below, */
/* i.e, "(defined(linux) && defined(__off_t_defined))" */
#if defined(_OFF_T) || (defined(linux) && defined(__off_t_defined)) || defined(_MIPS_SZLONG) || defined(__APPLE__) || defined(_AIX)
# define OFF_T off_t
#else
# define OFF_T long
#endif
/* typedef the 'LONGLONG' data type to the intrinsice 8-byte integer type */
#if defined(HAVE_LONGLONG) || defined(__APPLE__)
typedef long long LONGLONG;
# ifndef HAVE_LONGLONG
# define HAVE_LONGLONG 1
# endif
#elif defined(_MSC_VER) /* Windows PCs; Visual C++, but not Borland C++ */
typedef __int64 LONGLONG;
# ifndef HAVE_LONGLONG
# define HAVE_LONGLONG 1
# endif
#else
typedef long LONGLONG; /* intrinsic 8-byte integer not supported */
#endif
/* The following exclusion if __CINT__ is defined is needed for ROOT */
#ifndef __CINT__
#include "longnam.h"
#endif
/* global variables */
#define FLEN_FILENAME 1025 /* max length of a filename */
#define FLEN_KEYWORD 72 /* max length of a keyword (HIERARCH convention) */
#define FLEN_CARD 81 /* length of a FITS header card */
#define FLEN_VALUE 71 /* max length of a keyword value string */
#define FLEN_COMMENT 73 /* max length of a keyword comment string */
#define FLEN_ERRMSG 81 /* max length of a FITSIO error message */
#define FLEN_STATUS 31 /* max length of a FITSIO status text string */
#define TBIT 1 /* codes for FITS table data types */
#define TBYTE 11
#define TSBYTE 12
#define TLOGICAL 14
#define TSTRING 16
#define TUSHORT 20
#define TSHORT 21
#define TUINT 30
#define TINT 31
#define TULONG 40
#define TLONG 41
#define TINT32BIT 41 /* used when returning datatype of a column */
#define TFLOAT 42
#define TLONGLONG 81
#define TDOUBLE 82
#define TCOMPLEX 83
#define TDBLCOMPLEX 163
#define TYP_STRUC_KEY 10
#define TYP_CMPRS_KEY 20
#define TYP_SCAL_KEY 30
#define TYP_NULL_KEY 40
#define TYP_DIM_KEY 50
#define TYP_RANG_KEY 60
#define TYP_UNIT_KEY 70
#define TYP_DISP_KEY 80
#define TYP_HDUID_KEY 90
#define TYP_CKSUM_KEY 100
#define TYP_WCS_KEY 110
#define TYP_REFSYS_KEY 120
#define TYP_COMM_KEY 130
#define TYP_CONT_KEY 140
#define TYP_USER_KEY 150
#define INT32BIT int /* 32-bit integer datatype. Currently this */
/* datatype is an 'int' on all useful platforms */
/* however, it is possible that that are cases */
/* where 'int' is a 2-byte integer, in which case */
/* INT32BIT would need to be defined as 'long'. */
#define BYTE_IMG 8 /* BITPIX code values for FITS image types */
#define SHORT_IMG 16
#define LONG_IMG 32
#define LONGLONG_IMG 64
#define FLOAT_IMG -32
#define DOUBLE_IMG -64
/* The following 2 codes are not true FITS */
/* datatypes; these codes are only used internally */
/* within cfitsio to make it easier for users */
/* to deal with unsigned integers. */
#define SBYTE_IMG 10
#define USHORT_IMG 20
#define ULONG_IMG 40
#define IMAGE_HDU 0 /* Primary Array or IMAGE HDU */
#define ASCII_TBL 1 /* ASCII table HDU */
#define BINARY_TBL 2 /* Binary table HDU */
#define ANY_HDU -1 /* matches any HDU type */
#define READONLY 0 /* options when opening a file */
#define READWRITE 1
/* adopt a hopefully obscure number to use as a null value flag */
/* could be problems if the FITS files contain data with these values */
#define FLOATNULLVALUE -9.11912E-36F
#define DOUBLENULLVALUE -9.1191291391491E-36
/* Image compression algorithm types */
#define MAX_COMPRESS_DIM 6
#define RICE_1 11
#define GZIP_1 21
#define PLIO_1 31
#define HCOMPRESS_1 41
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define CASESEN 1 /* do case-sensitive string match */
#define CASEINSEN 0 /* do case-insensitive string match */
#define GT_ID_ALL_URI 0 /* hierarchical grouping parameters */
#define GT_ID_REF 1
#define GT_ID_POS 2
#define GT_ID_ALL 3
#define GT_ID_REF_URI 11
#define GT_ID_POS_URI 12
#define OPT_RM_GPT 0
#define OPT_RM_ENTRY 1
#define OPT_RM_MBR 2
#define OPT_RM_ALL 3
#define OPT_GCP_GPT 0
#define OPT_GCP_MBR 1
#define OPT_GCP_ALL 2
#define OPT_MCP_ADD 0
#define OPT_MCP_NADD 1
#define OPT_MCP_REPL 2
#define OPT_MCP_MOV 3
#define OPT_MRG_COPY 0
#define OPT_MRG_MOV 1
#define OPT_CMT_MBR 1
#define OPT_CMT_MBR_DEL 11
typedef struct /* structure used to store table column information */
{
char ttype[70]; /* column name = FITS TTYPEn keyword; */
long tbcol; /* offset in row to first byte of each column */
int tdatatype; /* datatype code of each column */
OFF_T trepeat; /* repeat count of column; number of elements */
double tscale; /* FITS TSCALn linear scaling factor */
double tzero; /* FITS TZEROn linear scaling zero point */
long tnull; /* FITS null value for int image or binary table cols */
char strnull[20]; /* FITS null value string for ASCII table columns */
char tform[10]; /* FITS tform keyword value */
long twidth; /* width of each ASCII table column */
}tcolumn;
#define VALIDSTRUC 555 /* magic value used to identify if structure is valid */
typedef struct /* structure used to store basic FITS file information */
{
int filehandle; /* handle returned by the file open function */
int driver; /* defines which set of I/O drivers should be used */
int open_count; /* number of opened 'fitsfiles' using this structure */
char *filename; /* file name */
int validcode; /* magic value used to verify that structure is valid */
OFF_T filesize; /* current size of the physical disk file in bytes */
OFF_T logfilesize; /* logical size of file, including unflushed buffers */
int lasthdu; /* is this the last HDU in the file? 0 = no, else yes */
OFF_T bytepos; /* current logical I/O pointer position in file */
OFF_T io_pos; /* current I/O pointer position in the physical file */
int curbuf; /* number of I/O buffer currently in use */
int curhdu; /* current HDU number; 0 = primary array */
int hdutype; /* 0 = primary array, 1 = ASCII table, 2 = binary table */
int writemode; /* 0 = readonly, 1 = readwrite */
int maxhdu; /* highest numbered HDU known to exist in the file */
int MAXHDU; /* dynamically allocated dimension of headstart array */
OFF_T *headstart; /* byte offset in file to start of each HDU */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -