00001 /*============================================================================ 00002 00003 WCSLIB 4.4 - an implementation of the FITS WCS standard. 00004 Copyright (C) 1995-2009, Mark Calabretta 00005 00006 This file is part of WCSLIB. 00007 00008 WCSLIB is free software: you can redistribute it and/or modify it under the 00009 terms of the GNU Lesser General Public License as published by the Free 00010 Software Foundation, either version 3 of the License, or (at your option) 00011 any later version. 00012 00013 WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY 00014 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00016 more details. 00017 00018 You should have received a copy of the GNU Lesser General Public License 00019 along with WCSLIB. If not, see <http://www.gnu.org/licenses/>. 00020 00021 Correspondence concerning WCSLIB may be directed to: 00022 Internet email: mcalabre@atnf.csiro.au 00023 Postal address: Dr. Mark Calabretta 00024 Australia Telescope National Facility, CSIRO 00025 PO Box 76 00026 Epping NSW 1710 00027 AUSTRALIA 00028 00029 Author: Mark Calabretta, Australia Telescope National Facility 00030 http://www.atnf.csiro.au/~mcalabre/index.html 00031 $Id: wcshdr_8h-source.html,v 1.1 2009/09/14 20:25:25 irby Exp $ 00032 *============================================================================= 00033 * 00034 * WCSLIB 4.4 - C routines that implement the FITS World Coordinate System 00035 * (WCS) standard. Refer to 00036 * 00037 * "Representations of world coordinates in FITS", 00038 * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) 00039 * 00040 * "Representations of celestial coordinates in FITS", 00041 * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) 00042 * 00043 * "Representations of spectral coordinates in FITS", 00044 * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. 00045 * 2006, A&A, 446, 747 (Paper III) 00046 * 00047 * Refer to the README file provided with WCSLIB for an overview of the 00048 * library. 00049 * 00050 * 00051 * Summary of the wcshdr routines 00052 * ------------------------------ 00053 * Routines in this suite are aimed at extracting WCS information from a FITS 00054 * file. They provide the high-level interface between the FITS file and the 00055 * WCS coordinate transformation routines. 00056 * 00057 * Additionally, function wcshdo() is provided to write out the contents of a 00058 * wcsprm struct as a FITS header. 00059 * 00060 * Briefly, the anticipated sequence of operations is as follows: 00061 * 00062 * - 1: Open the FITS file and read the image or binary table header, e.g. 00063 * using CFITSIO routine fits_hdr2str(). 00064 * 00065 * - 2: Parse the header using wcspih() or wcsbth(); they will automatically 00066 * interpret 'TAB' header keywords using wcstab(). 00067 * 00068 * - 3: Allocate memory for, and read 'TAB' arrays from the binary table 00069 * extension, e.g. using CFITSIO routine fits_read_wcstab() - refer to 00070 * the prologue of getwcstab.h. wcsset() will automatically take 00071 * control of this allocated memory, in particular causing it to be 00072 * free'd by wcsfree(). 00073 * 00074 * - 4: Translate non-standard WCS usage using wcsfix(), see wcsfix.h. 00075 * 00076 * - 5: Initialize wcsprm struct(s) using wcsset() and calculate coordinates 00077 * using wcsp2s() and/or wcss2p(). Refer to the prologue of wcs.h for a 00078 * description of these and other high-level WCS coordinate 00079 * transformation routines. 00080 * 00081 * - 6: Clean up by freeing memory with wcsvfree(). 00082 * 00083 * In detail: 00084 * 00085 * - wcspih() is a high-level FITS WCS routine that parses an image header. It 00086 * returns an array of up to 27 wcsprm structs on each of which it invokes 00087 * wcstab(). 00088 * 00089 * - wcsbth() is the analogue of wcspih() for use with binary tables; it 00090 * handles image array and pixel list keywords. As an extension of the FITS 00091 * WCS standard, it also recognizes image header keywords which may be used 00092 * to provide default values via an inheritance mechanism. 00093 * 00094 * - wcstab() assists in filling in members of the wcsprm struct associated 00095 * with coordinate lookup tables ('TAB'). These are based on arrays stored 00096 * in a FITS binary table extension (BINTABLE) that are located by PVi_ma 00097 * keywords in the image header. 00098 * 00099 * - wcsidx() and wcsbdx() are utility routines that return the index for a 00100 * specified alternate coordinate descriptor in the array of wcsprm structs 00101 * returned by wcspih() or wcsbth(). 00102 * 00103 * - wcsvfree() deallocates memory for an array of wcsprm structs, such as 00104 * returned by wcspih() or wcsbth(). 00105 * 00106 * - wcshdo() writes out a wcsprm struct as a FITS header. 00107 * 00108 * 00109 * wcspih() - FITS WCS parser routine for image headers 00110 * ---------------------------------------------------- 00111 * wcspih() is a high-level FITS WCS routine that parses an image header, 00112 * either that of a primary HDU or of an image extension. All WCS keywords 00113 * defined in Papers I, II, and III are recognized, and also those used by the 00114 * AIPS convention and certain other keywords that existed in early drafts of 00115 * the WCS papers as explained in wcsbth() note 5. 00116 * 00117 * Given a character array containing a FITS image header, wcspih() identifies 00118 * and reads all WCS keywords for the primary coordinate representation and up 00119 * to 26 alternate representations. It returns this information as an array of 00120 * wcsprm structs. 00121 * 00122 * wcspih() invokes wcstab() on each of the wcsprm structs that it returns. 00123 * 00124 * Use wcsbth() in preference to wcspih() for FITS headers of unknown type; 00125 * wcsbth() can parse image headers as well as binary table and pixel list 00126 * headers. 00127 * 00128 * Given and returned: 00129 * header char[] Character array containing the (entire) FITS image 00130 * header from which to identify and construct the 00131 * coordinate representations, for example, as might be 00132 * obtained conveniently via the CFITSIO routine 00133 * fits_hdr2str(). 00134 * 00135 * Each header "keyrecord" (formerly "card image") 00136 * consists of exactly 80 7-bit ASCII printing characters 00137 * in the range 0x20 to 0x7e (which excludes NUL, BS, 00138 * TAB, LF, FF and CR) especially noting that the 00139 * keyrecords are NOT null-terminated. 00140 * 00141 * For negative values of ctrl (see below), header[] is 00142 * modified so that WCS keyrecords processed by wcspih() 00143 * are removed from it. 00144 * 00145 * Given: 00146 * nkeyrec int Number of keyrecords in header[]. 00147 * relax int Degree of permissiveness: 00148 * 0: Recognize only FITS keywords defined by the 00149 * published WCS standard. 00150 * WCSHDR_all: Admit all recognized informal 00151 * extensions of the WCS standard. 00152 * Fine-grained control of the degree of permissiveness 00153 * is also possible as explained in wcsbth() note 5. 00154 * ctrl int Error reporting and other control options for invalid 00155 * WCS and other header keyrecords: 00156 * 0: Do not report any rejected header keyrecords. 00157 * 1: Produce a one-line message stating the number 00158 * of WCS keyrecords rejected (nreject). 00159 * 2: Report each rejected keyrecord and the reason 00160 * why it was rejected. 00161 * 3: As above, but also report all non-WCS 00162 * keyrecords that were discarded, and the number 00163 * of coordinate representations (nwcs) found. 00164 * The report is written to stderr. 00165 * 00166 * For ctrl < 0, WCS keyrecords processed by wcspih() 00167 * are removed from header[]: 00168 * -1: Remove only valid WCS keyrecords whose values 00169 * were successfully extracted, nothing is 00170 * reported. 00171 * -2: Also remove WCS keyrecords that were rejected, 00172 * reporting each one and the reason that it was 00173 * rejected. 00174 * -3: As above, and also report the number of 00175 * coordinate representations (nwcs) found. 00176 * -11: Same as -1 but preserving the basic keywords 00177 * '{DATE,MJD}-{OBS,AVG}' and 'OBSGEO-{X,Y,Z}'. 00178 * If any keyrecords are removed from header[] it will 00179 * be null-terminated (NUL not being a legal FITS header 00180 * character), otherwise it will contain its original 00181 * complement of nkeyrec keyrecords and possibly not be 00182 * null-terminated. 00183 * 00184 * Returned: 00185 * nreject int* Number of WCS keywords rejected for syntax errors, 00186 * illegal values, etc. Keywords not recognized as WCS 00187 * keywords are simply ignored. Refer also to wcsbth() 00188 * note 5. 00189 * nwcs int* Number of coordinate representations found. 00190 * wcs struct wcsprm** 00191 * Pointer to an array of wcsprm structs containing up to 00192 * 27 coordinate representations. 00193 * 00194 * Memory for the array is allocated by wcspih() which 00195 * also invokes wcsini() for each struct to allocate 00196 * memory for internal arrays and initialize their 00197 * members to default values. Refer also to wcsbth() 00198 * note 8. Note that wcsset() is not invoked on these 00199 * structs. 00200 * 00201 * This allocated memory must be freed by the user, first 00202 * by invoking wcsfree() for each struct, and then by 00203 * freeing the array itself. A routine, wcsvfree(), is 00204 * provided to do this (see below). 00205 * 00206 * Function return value: 00207 * int Status return value: 00208 * 0: Success. 00209 * 1: Null wcsprm pointer passed. 00210 * 2: Memory allocation failed. 00211 * 4: Fatal error returned by Flex parser. 00212 * 00213 * Notes: 00214 * Refer to wcsbth() notes 1, 2, 3, 5, 7, and 8. 00215 * 00216 * 00217 * wcsbth() - FITS WCS parser routine for binary table and image headers 00218 * --------------------------------------------------------------------- 00219 * wcsbth() is a high-level FITS WCS routine that parses a binary table header. 00220 * It handles image array and pixel list WCS keywords which may be present 00221 * together in one header. 00222 * 00223 * As an extension of the FITS WCS standard, wcsbth() also recognizes image 00224 * header keywords in a binary table header. These may be used to provide 00225 * default values via an inheritance mechanism discussed in note 5 (c.f. 00226 * WCSHDR_AUXIMG and WCSHDR_ALLIMG), or may instead result in wcsprm structs 00227 * that are not associated with any particular column. Thus wcsbth() can 00228 * handle primary image and image extension headers in addition to binary table 00229 * headers (it ignores NAXIS and does not rely on the presence of the TFIELDS 00230 * keyword). 00231 * 00232 * All WCS keywords defined in Papers I, II, and III are recognized, and also 00233 * those used by the AIPS convention and certain other keywords that existed in 00234 * early drafts of the WCS papers as explained in note 5 below. 00235 * 00236 * wcsbth() sets the colnum or colax[] members of the wcsprm structs that it 00237 * returns with the column number of an image array or the column numbers 00238 * associated with each pixel coordinate element in a pixel list. wcsprm 00239 * structs that are not associated with any particular column, as may be 00240 * derived from image header keywords, have colnum == 0. 00241 * 00242 * Note 6 below discusses the number of wcsprm structs returned by wcsbth(), 00243 * and the circumstances in which image header keywords cause a struct to be 00244 * created. See also note 9 concerning the number of separate images that may 00245 * be stored in a pixel list. 00246 * 00247 * The API to wcsbth() is similar to that of wcspih() except for the addition 00248 * of extra arguments that may be used to restrict its operation. Like 00249 * wcspih(), wcsbth() invokes wcstab() on each of the wcsprm structs that it 00250 * returns. 00251 * 00252 * Given and returned: 00253 * header char[] Character array containing the (entire) FITS binary 00254 * table, primary image, or image extension header from 00255 * which to identify and construct the coordinate 00256 * representations, for example, as might be obtained 00257 * conveniently via the CFITSIO routine fits_hdr2str(). 00258 * 00259 * Each header "keyrecord" (formerly "card image") 00260 * consists of exactly 80 7-bit ASCII printing 00261 * characters in the range 0x20 to 0x7e (which excludes 00262 * NUL, BS, TAB, LF, FF and CR) especially noting that 00263 * the keyrecords are NOT null-terminated. 00264 * 00265 * For negative values of ctrl (see below), header[] is 00266 * modified so that WCS keyrecords processed by wcsbth() 00267 * are removed from it. 00268 * 00269 * Given: 00270 * nkeyrec int Number of keyrecords in header[]. 00271 * relax int Degree of permissiveness: 00272 * 0: Recognize only FITS keywords defined by the 00273 * published WCS standard. 00274 * WCSHDR_all: Admit all recognized informal 00275 * extensions of the WCS standard. 00276 * Fine-grained control of the degree of permissiveness 00277 * is also possible, as explained in note 5 below. 00278 * ctrl int Error reporting and other control options for invalid 00279 * WCS and other header keyrecords: 00280 * 0: Do not report any rejected header keyrecords. 00281 * 1: Produce a one-line message stating the number 00282 * of WCS keyrecords rejected (nreject). 00283 * 2: Report each rejected keyrecord and the reason 00284 * why it was rejected. 00285 * 3: As above, but also report all non-WCS 00286 * keyrecords that were discarded, and the number 00287 * of coordinate representations (nwcs) found. 00288 * The report is written to stderr. 00289 * 00290 * For ctrl < 0, WCS keyrecords processed by wcsbth() 00291 * are removed from header[]: 00292 * -1: Remove only valid WCS keyrecords whose values 00293 * were successfully extracted, nothing is 00294 * reported. 00295 * -2: Also remove WCS keyrecords that were rejected, 00296 * reporting each one and the reason that it was 00297 * rejected. 00298 * -3: As above, and also report the number of 00299 * coordinate representations (nwcs) found. 00300 * -11: Same as -1 but preserving the basic keywords 00301 * '{DATE,MJD}-{OBS,AVG}' and 'OBSGEO-{X,Y,Z}'. 00302 * If any keyrecords are removed from header[] it will 00303 * be null-terminated (NUL not being a legal FITS header 00304 * character), otherwise it will contain its original 00305 * complement of nkeyrec keyrecords and possibly not be 00306 * null-terminated. 00307 * keysel int Vector of flag bits that may be used to restrict the 00308 * keyword types considered: 00309 * WCSHDR_IMGHEAD: Image header keywords. 00310 * WCSHDR_BIMGARR: Binary table image array. 00311 * WCSHDR_PIXLIST: Pixel list keywords. 00312 * If zero, there is no restriction. 00313 * 00314 * Keywords such as EQUIna or RFRQna that are common to 00315 * binary table image arrays and pixel lists (including 00316 * WCSNna and TWCSna, as explained in note 4 below) are 00317 * selected by both WCSHDR_BIMGARR and WCSHDR_PIXLIST. 00318 * Thus if inheritance via WCSHDR_ALLIMG is enabled as 00319 * discussed in note 5 and one of these shared keywords 00320 * is present, then WCSHDR_IMGHEAD and WCSHDR_PIXLIST 00321 * alone may be sufficient to cause the construction of 00322 * coordinate descriptions for binary table image arrays. 00323 * colsel int* Pointer to an array of table column numbers used to 00324 * restrict the keywords considered by wcsbth(). 00325 * 00326 * A null pointer may be specified to indicate that there 00327 * is no restriction. Otherwise, the magnitude of 00328 * cols[0] specifies the length of the array: 00329 * cols[0] > 0: the columns are included, 00330 * cols[0] < 0: the columns are excluded. 00331 * 00332 * For the pixel list keywords TPn_ka and TCn_ka (and 00333 * TPCn_ka and TCDn_ka if WCSHDR_LONGKEY is enabled), it 00334 * is an error for one column to be selected but not the 00335 * other. This is unlike the situation with invalid 00336 * keyrecords, which are simply rejected, because the 00337 * error is not intrinsic to the header itself but 00338 * arises in the way that it is processed. 00339 * 00340 * Returned: 00341 * nreject int* Number of WCS keywords rejected for syntax errors, 00342 * illegal values, etc. Keywords not recognized as WCS 00343 * keywords are simply ignored, refer also to note 5 00344 * below. 00345 * nwcs int* Number of coordinate representations found. 00346 * wcs struct wcsprm** 00347 * Pointer to an array of wcsprm structs containing up 00348 * to 27027 coordinate representations, refer to note 6 00349 * below. 00350 * 00351 * Memory for the array is allocated by wcsbth() which 00352 * also invokes wcsini() for each struct to allocate 00353 * memory for internal arrays and initialize their 00354 * members to default values. Refer also to note 8 00355 * below. Note that wcsset() is not invoked on these 00356 * structs. 00357 * 00358 * This allocated memory must be freed by the user, first 00359 * by invoking wcsfree() for each struct, and then by 00360 * freeing the array itself. A routine, wcsvfree(), is 00361 * provided to do this (see below). 00362 * 00363 * Function return value: 00364 * int Status return value: 00365 * 0: Success. 00366 * 1: Null wcsprm pointer passed. 00367 * 2: Memory allocation failed. 00368 * 3: Invalid column selection. 00369 * 4: Fatal error returned by Flex parser. 00370 * 00371 * Notes: 00372 * 1: wcspih() determines the number of coordinate axes independently for 00373 * each alternate coordinate representation (denoted by the "a" value in 00374 * keywords like CTYPEia) from the higher of 00375 * 00376 * a: NAXIS, 00377 * b: WCSAXESa, 00378 * c: The highest axis number in any parameterized WCS keyword. The 00379 * keyvalue, as well as the keyword, must be syntactically valid 00380 * otherwise it will not be considered. 00381 * 00382 * If none of these keyword types is present, i.e. if the header only 00383 * contains auxiliary WCS keywords for a particular coordinate 00384 * representation, then no coordinate description is constructed for it. 00385 * 00386 * wcsbth() is similar except that it ignores the NAXIS keyword if given 00387 * an image header to process. 00388 * 00389 * The number of axes, which is returned as a member of the wcsprm 00390 * struct, may differ for different coordinate representations of the 00391 * same image. 00392 * 00393 * 2: wcspih() and wcsbth() enforce correct FITS "keyword = value" syntax 00394 * with regard to "= " occurring in columns 9 and 10. 00395 * 00396 * However, they do recognize free-format character (NOST 100-2.0, 00397 * Sect. 5.2.1), integer (Sect. 5.2.3), and floating-point values 00398 * (Sect. 5.2.4) for all keywords. 00399 * 00400 * 3: Where CROTAn, CDi_ja, and PCi_ja occur together in one header wcspih() 00401 * and wcsbth() treat them as described in the prologue to wcs.h. 00402 * 00403 * 4: WCS Paper I mistakenly defined the pixel list form of WCSNAMEa as 00404 * TWCSna instead of WCSNna; the 'T' is meant to substitute for the axis 00405 * number in the binary table form of the keyword - note that keywords 00406 * defined in WCS Papers II and III that are not parameterised by axis 00407 * number have identical forms for binary tables and pixel lists. 00408 * Consequently wcsbth() always treats WCSNna and TWCSna as equivalent. 00409 * 00410 * 5: wcspih() and wcsbth() interpret the "relax" argument as a vector of 00411 * flag bits to provide fine-grained control over what non-standard WCS 00412 * keywords to accept. The flag bits are subject to change in future and 00413 * should be set by using the preprocessor macros (see below) for the 00414 * purpose. 00415 * 00416 * - WCSHDR_none: Don't accept any extensions (not even those in the 00417 * errata). Treat non-conformant keywords in the same way as 00418 * non-WCS keywords in the header, i.e. simply ignore them. 00419 * 00420 * - WCSHDR_all: Accept all extensions recognized by the parser. 00421 * 00422 * - WCSHDR_reject: Reject non-standard keywords (that are not otherwise 00423 * accepted). A message will optionally be printed on stderr, as 00424 * determined by the ctrl argument, and nreject will be 00425 * incremented. 00426 * 00427 * This flag may be used to signal the presence of non-standard 00428 * keywords, otherwise they are simply passed over as though they 00429 * did not exist in the header. 00430 * 00431 * Useful for testing conformance of a FITS header to the WCS 00432 * standard. 00433 * 00434 * - WCSHDR_CROTAia: Accept CROTAia (wcspih()), 00435 * iCROTna (wcsbth()), 00436 * TCROTna (wcsbth()). 00437 * - WCSHDR_EPOCHa: Accept EPOCHa. 00438 * - WCSHDR_VELREFa: Accept VELREFa. 00439 * wcspih() always recognizes the AIPS-convention keywords, 00440 * CROTAn, EPOCH, and VELREF for the primary representation 00441 * (a = ' ') but alternates are non-standard. 00442 * 00443 * wcsbth() accepts EPOCHa and VELREFa only if WCSHDR_AUXIMG is 00444 * also enabled. 00445 * 00446 * - WCSHDR_CD00i00j: Accept CD00i00j (wcspih()). 00447 * - WCSHDR_PC00i00j: Accept PC00i00j (wcspih()). 00448 * - WCSHDR_PROJPn: Accept PROJPn (wcspih()). 00449 * These appeared in early drafts of WCS Paper I+II (before they 00450 * were split) and are equivalent to CDi_ja, PCi_ja, and PVi_ma 00451 * for the primary representation (a = ' '). PROJPn is 00452 * equivalent to PVi_ma with m = n <= 9, and is associated 00453 * exclusively with the latitude axis. 00454 * 00455 * - WCSHDR_RADECSYS: Accept RADECSYS. This appeared in early drafts of 00456 * WCS Paper I+II and was subsequently replaced by RADESYSa. 00457 * 00458 * wcsbth() accepts RADECSYS only if WCSHDR_AUXIMG is also 00459 * enabled. 00460 * 00461 * - WCSHDR_VSOURCE: Accept VSOURCEa or VSOUna (wcsbth()). This appeared 00462 * in early drafts of WCS Paper III and was subsequently dropped 00463 * in favour of ZSOURCEa and ZSOUna. 00464 * 00465 * wcsbth() accepts VSOURCEa only if WCSHDR_AUXIMG is also 00466 * enabled. 00467 * 00468 * - WCSHDR_DOBSn (wcsbth() only): Allow DOBSn, the column-specific analogue 00469 * of DATE-OBS. By an oversight this was never formally defined 00470 * in the standard. 00471 * 00472 * - WCSHDR_LONGKEY (wcsbth() only): Accept long forms of the alternate 00473 * binary table and pixel list WCS keywords, i.e. with "a" non- 00474 * blank. Specifically 00475 * 00476 # jCRPXna TCRPXna : jCRPXn jCRPna TCRPXn TCRPna CRPIXja 00477 # - TPCn_ka : - ijPCna - TPn_ka PCi_ja 00478 # - TCDn_ka : - ijCDna - TCn_ka CDi_ja 00479 # iCDLTna TCDLTna : iCDLTn iCDEna TCDLTn TCDEna CDELTia 00480 # iCUNIna TCUNIna : iCUNIn iCUNna TCUNIn TCUNna CUNITia 00481 # iCTYPna TCTYPna : iCTYPn iCTYna TCTYPn TCTYna CTYPEia 00482 # iCRVLna TCRVLna : iCRVLn iCRVna TCRVLn TCRVna CRVALia 00483 # iPVn_ma TPVn_ma : - iVn_ma - TVn_ma PVi_ma 00484 # iPSn_ma TPSn_ma : - iSn_ma - TSn_ma PSi_ma 00485 * 00486 * where the primary and standard alternate forms together with 00487 * the image-header equivalent are shown rightwards of the colon. 00488 * 00489 * The long form of these keywords could be described as quasi- 00490 * standard. TPCn_ka, iPVn_ma, and TPVn_ma appeared by mistake 00491 * in the examples in WCS Paper II and subsequently these and 00492 * also TCDn_ka, iPSn_ma and TPSn_ma were legitimized by the 00493 * errata to the WCS papers. 00494 * 00495 * Strictly speaking, the other long forms are non-standard and 00496 * in fact have never appeared in any draft of the WCS papers nor 00497 * in the errata. However, as natural extensions of the primary 00498 * form they are unlikely to be written with any other intention. 00499 * Thus it should be safe to accept them provided, of course, 00500 * that the resulting keyword does not exceed the 8-character 00501 * limit. 00502 * 00503 * If WCSHDR_CNAMn is enabled then also accept 00504 * 00505 # iCNAMna TCNAMna : --- iCNAna --- TCNAna CNAMEia 00506 # iCRDEna TCRDEna : --- iCRDna --- TCRDna CRDERia 00507 # iCSYEna TCSYEna : --- iCSYna --- TCSYna CSYERia 00508 * 00509 * Note that CNAMEia, CRDERia, CSYERia, and their variants are 00510 * not used by WCSLIB but are stored in the wcsprm struct as 00511 * auxiliary information. 00512 * 00513 * - WCSHDR_CNAMn (wcsbth() only): Accept iCNAMn, iCRDEn, iCSYEn, TCNAMn, 00514 * TCRDEn, and TCSYEn, i.e. with "a" blank. While non-standard, 00515 * these are the obvious analogues of iCTYPn, TCTYPn, etc. 00516 * 00517 * - WCSHDR_AUXIMG (wcsbth() only): Allow the image-header form of an 00518 * auxiliary WCS keyword with representation-wide scope to 00519 * provide a default value for all images. This default may be 00520 * overridden by the column-specific form of the keyword. 00521 * 00522 * For example, a keyword like EQUINOXa would apply to all image 00523 * arrays in a binary table, or all pixel list columns with 00524 * alternate representation "a" unless overridden by EQUIna. 00525 * 00526 * Specifically the keywords are: 00527 * 00528 # LATPOLEa for LATPna 00529 # LONPOLEa for LONPna 00530 # RESTFREQ for RFRQna 00531 # RESTFRQa for RFRQna 00532 # RESTWAVa for RWAVna 00533 * 00534 * whose keyvalues are actually used by WCSLIB, and also keywords 00535 * that provide auxiliary information that is simply stored in 00536 * the wcsprm struct: 00537 * 00538 # EPOCH - ... (No column-specific form.) 00539 # EPOCHa - ... Only if WCSHDR_EPOCHa is set. 00540 # EQUINOXa for EQUIna 00541 # RADESYSa for RADEna 00542 # RADECSYS for RADEna ... Only if WCSHDR_RADECSYS is set. 00543 # SPECSYSa for SPECna 00544 # SSYSOBSa for SOBSna 00545 # SSYSSRCa for SSRCna 00546 # VELOSYSa for VSYSna 00547 # VELANGLa for VANGna 00548 # VELREF - ... (No column-specific form.) 00549 # VELREFa - ... Only if WCSHDR_VELREFa is set. 00550 # VSOURCEa for VSOUna ... Only if WCSHDR_VSOURCE is set. 00551 # WCSNAMEa for WCSNna ... Or TWCSna (see below). 00552 # ZSOURCEa for ZSOUna 00553 * 00554 # DATE-AVG for DAVGn 00555 # DATE-OBS for DOBSn 00556 # MJD-AVG for MJDAn 00557 # MJD-OBS for MJDOBn 00558 # OBSGEO-X for OBSGXn 00559 # OBSGEO-Y for OBSGYn 00560 # OBSGEO-Z for OBSGZn 00561 * 00562 * where the image-header keywords on the left provide default 00563 * values for the column specific keywords on the right. 00564 * 00565 * Keywords in the last group, such as MJD-OBS, apply to all 00566 * alternate representations, so MJD-OBS would provide a default 00567 * value for all images in the header. 00568 * 00569 * This auxiliary inheritance mechanism applies to binary table 00570 * image arrays and pixel lists alike. Most of these keywords 00571 * have no default value, the exceptions being LONPOLEa and 00572 * LATPOLEa, and also RADESYSa and EQUINOXa which provide 00573 * defaults for each other. Thus the only potential difficulty 00574 * in using WCSHDR_AUXIMG is that of erroneously inheriting one 00575 * of these four keywords. 00576 * 00577 * Unlike WCSHDR_ALLIMG, the existence of one (or all) of these 00578 * auxiliary WCS image header keywords will not by itself cause a 00579 * wcsprm struct to be created for alternate representation "a". 00580 * This is because they do not provide sufficient information to 00581 * create a non-trivial coordinate representation when used in 00582 * conjunction with the default values of those keywords, such as 00583 * CTYPEia, that are parameterized by axis number. 00584 * 00585 * - WCSHDR_ALLIMG (wcsbth() only): Allow the image-header form of *all* 00586 * image header WCS keywords to provide a default value for all 00587 * image arrays in a binary table (n.b. not pixel list). This 00588 * default may be overridden by the column-specific form of the 00589 * keyword. 00590 * 00591 * For example, a keyword like CRPIXja would apply to all image 00592 * arrays in a binary table with alternate representation "a" 00593 * unless overridden by jCRPna. 00594 * 00595 * Specifically the keywords are those listed above for 00596 * WCSHDR_AUXIMG plus 00597 * 00598 # WCSAXESa for WCAXna 00599 * 00600 * which defines the coordinate dimensionality, and the following 00601 * keywords which are parameterized by axis number: 00602 * 00603 # CRPIXja for jCRPna 00604 # PCi_ja for ijPCna 00605 # CDi_ja for ijCDna 00606 # CDELTia for iCDEna 00607 # CROTAi for iCROTn 00608 # CROTAia - ... Only if WCSHDR_CROTAia is set. 00609 # CUNITia for iCUNna 00610 # CTYPEia for iCTYna 00611 # CRVALia for iCRVna 00612 # PVi_ma for iVn_ma 00613 # PSi_ma for iSn_ma 00614 * 00615 # CNAMEia for iCNAna 00616 # CRDERia for iCRDna 00617 # CSYERia for iCSYna 00618 * 00619 * where the image-header keywords on the left provide default 00620 * values for the column specific keywords on the right. 00621 * 00622 * This full inheritance mechanism only applies to binary table 00623 * image arrays, not pixel lists, because in the latter case 00624 * there is no well-defined association between coordinate axis 00625 * number and column number. 00626 * 00627 * Note that CNAMEia, CRDERia, CSYERia, and their variants are 00628 * not used by WCSLIB but are stored in the wcsprm struct as 00629 * auxiliary information. 00630 * 00631 * Note especially that at least one wcsprm struct will be 00632 * returned for each "a" found in one of the image header 00633 * keywords listed above: 00634 * 00635 * - If the image header keywords for "a" ARE NOT inherited by a 00636 * binary table, then the struct will not be associated with 00637 * any particular table column number and it is up to the user 00638 * to provide an association. 00639 * 00640 * - If the image header keywords for "a" ARE inherited by a 00641 * binary table image array, then those keywords are considered 00642 * to be "exhausted" and do not result in a separate wcsprm 00643 * struct. 00644 * 00645 * For example, to accept CD00i00j and PC00i00j and reject all other 00646 * extensions, use 00647 * 00648 = relax = WCSHDR_reject | WCSHDR_CD00i00j | WCSHDR_PC00i00j; 00649 * 00650 * The parser always treats EPOCH as subordinate to EQUINOXa if both are 00651 * present, and VSOURCEa is always subordinate to ZSOURCEa. 00652 * 00653 * Likewise, VELREF is subordinate to the formalism of WCS Paper III. In 00654 * the AIPS convention VELREF has the following integer values: 00655 * - 1: LSR kinematic, originally described simply as "LSR" without 00656 * distinction between the kinematic and dynamic 00657 * definitions. 00658 * - 2: Barycentric, originally described as "HEL" meaning heliocentric. 00659 * - 3: Topocentric, originally described as "OBS" meaning geocentric 00660 * but widely interpreted as topocentric. 00661 * AIPS++ extensions to VELREF are also recognized: 00662 * - 4: LSR dynamic. 00663 * - 5: Geocentric. 00664 * - 6: Source rest frame. 00665 * - 7: Galactocentric. 00666 * A radio convention velocity is denoted by adding 256 to these, 00667 * otherwise an optical velocity is indicated. 00668 * 00669 * Neither wcspih() nor wcsbth() currently recognize the AIPS-convention 00670 * keywords ALTRPIX or ALTRVAL which effectively define an alternative 00671 * representation for a spectral axis. 00672 * 00673 * 6: Depending on what flags have been set in its "relax" xargument, 00674 * wcsbth() could return as many as 27027 wcsprm structs: 00675 * 00676 * - Up to 27 unattached representations derived from image header 00677 * keywords. 00678 * 00679 * - Up to 27 structs for each of up to 999 columns containing an image 00680 * arrays. 00681 * 00682 * - Up to 27 structs for a pixel list. 00683 * 00684 * Note that it is considered legitimate for a column to contain an image 00685 * array and also form part of a pixel list, and in particular that 00686 * wcsbth() does not check the TFORM keyword for a pixel list column to 00687 * check that it is scalar. 00688 * 00689 * In practice, of course, a realistic binary table header is unlikely to 00690 * contain more than a handful of images. 00691 * 00692 * In order for wcsbth() to create a wcsprm struct for a particular 00693 * coordinate representation, at least one WCS keyword that defines an 00694 * axis number must be present, either directly or by inheritance if 00695 * WCSHDR_ALLIMG is set. 00696 * 00697 * When the image header keywords for an alternate representation are 00698 * inherited by a binary table image array via WCSHDR_ALLIMG, those 00699 * keywords are considered to be "exhausted" and do not result in a 00700 * separate wcsprm struct. Otherwise they do. 00701 * 00702 * 7: Neither wcspih() nor wcsbth() check for duplicated keywords, in most 00703 * cases they accept the last encountered. 00704 * 00705 * 8: wcspih() and wcsbth() use wcsnpv() and wcsnps() (refer to the prologue 00706 * of wcs.h) to match the size of the pv[] and ps[] arrays in the wcsprm 00707 * structs to the number in the header. Consequently there are no unused 00708 * elements in the pv[] and ps[] arrays, indeed they will often be of 00709 * zero length. 00710 * 00711 * 9: The FITS WCS standard for pixel lists assumes that a pixel list 00712 * defines one and only one image, i.e. that each row of the binary table 00713 * refers to just one event, e.g. the detection of a single photon or 00714 * neutrino. 00715 * 00716 * In the absence of a formal mechanism for identifying the columns 00717 * containing pixel coordinates (as opposed to pixel values or ancillary 00718 * data recorded at the time the photon or neutrino was detected), 00719 * Paper I discusses how the WCS keywords themselves may be used to 00720 * identify them. 00721 * 00722 * In practice, however, pixel lists have been used to store multiple 00723 * images. Besides not specifying how to identify columns, the pixel 00724 * list convention is also silent on the method to be used to associate 00725 * table columns with image axes. 00726 * 00727 * wcsbth() simply collects all WCS keywords for a particular coordinate 00728 * representation (i.e. the "a" value in TCTYna) into one wcsprm struct. 00729 * However, these alternates need not be associated with the same table 00730 * columns and this allows a pixel list to contain up to 27 separate 00731 * images. As usual, if one of these representations happened to contain 00732 * more than two celestial axes, for example, then an error would result 00733 * when wcsset() is invoked on it. In this case the "colsel" argument 00734 * could be used to restrict the columns used to construct the 00735 * representation so that it only contained one pair of celestial axes. 00736 * 00737 * 00738 * wcstab() - Tabular construction routine 00739 * --------------------------------------- 00740 * wcstab() assists in filling in the information in the wcsprm struct relating 00741 * to coordinate lookup tables. 00742 * 00743 * Tabular coordinates ('TAB') present certain difficulties in that the main 00744 * components of the lookup table - the multidimensional coordinate array plus 00745 * an index vector for each dimension - are stored in a FITS binary table 00746 * extension (BINTABLE). Information required to locate these arrays is stored 00747 * in PVi_ma and PSi_ma keywords in the image header. 00748 * 00749 * wcstab() parses the PVi_ma and PSi_ma keywords associated with each 'TAB' 00750 * axis and allocates memory in the wcsprm struct for the required number of 00751 * tabprm structs. It sets as much of the tabprm struct as can be gleaned from 00752 * the image header, and also sets up an array of wtbarr structs (described in 00753 * the prologue of wcs.h) to assist in extracting the required arrays from the 00754 * BINTABLE extension(s). 00755 * 00756 * It is then up to the user to allocate memory for, and copy arrays from the 00757 * BINTABLE extension(s) into the tabprm structs. A CFITSIO routine, 00758 * fits_read_wcstab(), has been provided for this purpose, see getwcstab.h. 00759 * wcsset() will automatically take control of this allocated memory, in 00760 * particular causing it to be free'd by wcsfree(); the user must not attempt 00761 * to free it after wcsset() has been called. 00762 * 00763 * Note that wcspih() and wcsbth() automatically invoke wcstab() on each of the 00764 * wcsprm structs that they return. 00765 * 00766 * Given and returned: 00767 * wcs struct wcsprm* 00768 * Coordinate transformation parameters (see below). 00769 * 00770 * wcstab() sets ntab, tab, nwtb and wtb, allocating 00771 * memory for the tab and wtb arrays. This allocated 00772 * memory will be free'd automatically by wcsfree(). 00773 * 00774 * Function return value: 00775 * int Status return value: 00776 * 0: Success. 00777 * 1: Null wcsprm pointer passed. 00778 * 00779 * 00780 * wcsidx() - Index alternate coordinate representations 00781 * ----------------------------------------------------- 00782 * wcsidx() returns an array of 27 indices for the alternate coordinate 00783 * representations in the array of wcsprm structs returned by wcspih(). For 00784 * the array returned by wcsbth() it returns indices for the unattached 00785 * (colnum == 0) representations derived from image header keywords - use 00786 * wcsbdx() for those derived from binary table image arrays or pixel lists 00787 * keywords. 00788 * 00789 * Given: 00790 * nwcs int Number of coordinate representations in the array. 00791 * wcs const struct wcsprm** 00792 * Pointer to an array of wcsprm structs returned by 00793 * wcspih() or wcsbth(). 00794 * 00795 * Returned: 00796 * alts int[27] Index of each alternate coordinate representation in 00797 * the array: alts[0] for the primary, alts[1] for 'A', 00798 * etc., set to -1 if not present. 00799 * 00800 * For example, if there was no 'P' representation then 00801 * 00802 = alts['P'-'A'+1] == -1; 00803 * 00804 * Otherwise, the address of its wcsprm struct would be 00805 * 00806 = wcs + alts['P'-'A'+1]; 00807 * 00808 * Function return value: 00809 * int Status return value: 00810 * 0: Success. 00811 * 1: Null wcsprm pointer passed. 00812 * 00813 * 00814 * wcsbdx() - Index alternate coordinate representions 00815 * --------------------------------------------------- 00816 * wcsbdx() returns an array of 999 x 27 indices for the alternate coordinate 00817 * representions for binary table image arrays xor pixel lists in the array of 00818 * wcsprm structs returned by wcsbth(). Use wcsidx() for the unattached 00819 * representations derived from image header keywords. 00820 * 00821 * Given: 00822 * nwcs int Number of coordinate representations in the array. 00823 * wcs const struct wcsprm** 00824 * Pointer to an array of wcsprm structs returned by 00825 * wcsbth(). 00826 * type int Select the type of coordinate representation: 00827 * 0: binary table image arrays, 00828 * 1: pixel lists. 00829 * 00830 * Returned: 00831 * alts short[1000][28] 00832 * Index of each alternate coordinate represention in the 00833 * array: alts[col][0] for the primary, alts[col][1] for 00834 * 'A', to alts[col][26] for 'Z', where col is the 00835 * 1-relative column number, and col == 0 is used for 00836 * unattached image headers. Set to -1 if not present. 00837 * 00838 * alts[col][27] counts the number of coordinate 00839 * representations of the chosen type for each column. 00840 * 00841 * For example, if there was no 'P' represention for 00842 * column 13 then 00843 * 00844 = alts[13]['P'-'A'+1] == -1; 00845 * 00846 * Otherwise, the address of its wcsprm struct would be 00847 * 00848 = wcs + alts[13]['P'-'A'+1]; 00849 * 00850 * Function return value: 00851 * int Status return value: 00852 * 0: Success. 00853 * 1: Null wcsprm pointer passed. 00854 * 00855 * 00856 * wcsvfree() - Free the array of wcsprm structs 00857 * --------------------------------------------- 00858 * wcsvfree() frees the memory allocated by wcspih() or wcsbth() for the array 00859 * of wcsprm structs, first invoking wcsfree() on each of the array members. 00860 * 00861 * Given and returned: 00862 * nwcs int* Number of coordinate representations found; set to 0 00863 * on return. 00864 * wcs struct wcsprm** 00865 * Pointer to the array of wcsprm structs; set to 0 on 00866 * return. 00867 * 00868 * Function return value: 00869 * int Status return value: 00870 * 0: Success. 00871 * 1: Null wcsprm pointer passed. 00872 * 00873 * 00874 * wcshdo() - Write out a wcsprm struct as a FITS header 00875 * ----------------------------------------------------- 00876 * wcshdo() translates a wcsprm struct into a FITS header. If the colnum 00877 * member of the struct is non-zero then a binary table image array header will 00878 * be produced. Otherwise, if the colax[] member of the struct is set non-zero 00879 * then a pixel list header will be produced. Otherwise, a primary image or 00880 * image extension header will be produced. 00881 * 00882 * If the struct was originally constructed from a header, e.g. by wcspih(), 00883 * the output header will almost certainly differ in a number of respects: 00884 * 00885 * - The output header only contains WCS-related keywords. In particular, it 00886 * does not contain syntactically-required keywords such as SIMPLE, NAXIS, 00887 * BITPIX, or END. 00888 * 00889 * - Deprecated (e.g. CROTAn) or non-standard usage will be translated to 00890 * standard (this is partially dependent on whether wcsfix() was applied). 00891 * 00892 * - Quantities will be converted to the units used internally, basically SI 00893 * with the addition of degrees. 00894 * 00895 * - Floating-point quantities may be given to a different decimal precision. 00896 * 00897 * - Elements of the PCi_ja matrix will be written if and only if they differ 00898 * from the unit matrix. Thus, if the matrix is unity then no elements 00899 * will be written. 00900 * 00901 * - Additional keywords such as WCSAXESa, CUNITia, LONPOLEa and LATPOLEa may 00902 * appear. 00903 * 00904 * - The original keycomments will be lost, although wcshdo() tries hard to 00905 * write meaningful comments. 00906 * 00907 * - Keyword order may be changed. 00908 * 00909 * Keywords can be translated between the image array, binary table, and pixel 00910 * lists forms by manipulating the colnum or colax[] members of the wcsprm 00911 * struct. 00912 * 00913 * Given: 00914 * relax int Degree of permissiveness: 00915 * 0: Recognize only FITS keywords defined by the 00916 * published WCS standard. 00917 * -1: Admit all informal extensions of the WCS 00918 * standard. 00919 * Fine-grained control of the degree of permissiveness 00920 * is also possible as explained in the notes below. 00921 * 00922 * Given and returned: 00923 * wcs struct wcsprm* 00924 * Pointer to a wcsprm struct containing coordinate 00925 * transformation parameters. Will be initialized if 00926 * necessary. 00927 * 00928 * Returned: 00929 * nkeyrec int* Number of FITS header keyrecords returned in the 00930 * "header" array. 00931 * header char** Pointer to an array of char holding the header. 00932 * Storage for the array is allocated by wcshdo() in 00933 * blocks of 2880 bytes (32 x 80-character keyrecords) 00934 * and must be free'd by the user to avoid memory leaks. 00935 * 00936 * Each keyrecord is 80 characters long and is *NOT* 00937 * null-terminated, so the first keyrecord starts at 00938 * (*header)[0], the second at (*header)[80], etc. 00939 * 00940 * Function return value: 00941 * int Status return value: 00942 * 0: Success. 00943 * 1: Null wcsprm pointer passed. 00944 * 00945 * Notes: 00946 * wcshdo() interprets the "relax" argument as a vector of flag bits to 00947 * provide fine-grained control over what non-standard WCS keywords to write. 00948 * The flag bits are subject to change in future and should be set by using 00949 * the preprocessor macros (see below) for the purpose. 00950 * 00951 * - WCSHDO_none: Don't use any extensions. 00952 * 00953 * - WCSHDO_all: Write all recognized extensions, equivalent to setting each 00954 * flag bit. 00955 * 00956 * - WCSHDO_safe: Write all extensions that are considered to be safe and 00957 * recommended. 00958 * 00959 * - WCSHDO_DOBSn: Write DOBSn, the column-specific analogue of DATE-OBS for 00960 * use in binary tables and pixel lists. WCS Paper III introduced 00961 * DATE-AVG and DAVGn but by an oversight DOBSn (the obvious analogy) 00962 * was never formally defined by the standard. The alternative to 00963 * using DOBSn is to write DATE-OBS which applies to the whole table. 00964 * This usage is considered to be safe and is recommended. 00965 * 00966 * - WCSHDO_TPCn_ka: WCS Paper I defined 00967 * 00968 * - TPn_ka and TCn_ka for pixel lists 00969 * 00970 * but WCS Paper II uses TPCn_ka in one example and subsequently the 00971 * errata for the WCS papers legitimized the use of 00972 * 00973 * - TPCn_ka and TCDn_ka for pixel lists 00974 * 00975 * provided that the keyword does not exceed eight characters. This 00976 * usage is considered to be safe and is recommended because of the 00977 * non-mnemonic terseness of the shorter forms. 00978 * 00979 * - WCSHDO_PVn_ma: WCS Paper I defined 00980 * 00981 * - iVn_ma and iSn_ma for bintables and 00982 * - TVn_ma and TSn_ma for pixel lists 00983 * 00984 * but WCS Paper II uses iPVn_ma and TPVn_ma in the examples and 00985 * subsequently the errata for the WCS papers legitimized the use of 00986 * 00987 * - iPVn_ma and iPSn_ma for bintables and 00988 * - TPVn_ma and TPSn_ma for pixel lists 00989 * 00990 * provided that the keyword does not exceed eight characters. This 00991 * usage is considered to be safe and is recommended because of the 00992 * non-mnemonic terseness of the shorter forms. 00993 * 00994 * - WCSHDO_CRPXna: For historical reasons WCS Paper I defined 00995 * 00996 * - jCRPXn, iCDLTn, iCUNIn, iCTYPn, and iCRVLn for bintables and 00997 * - TCRPXn, TCDLTn, TCUNIn, TCTYPn, and TCRVLn for pixel lists 00998 * 00999 * for use without an alternate version specifier. However, because 01000 * of the eight-character keyword constraint, in order to accommodate 01001 * column numbers greater than 99 WCS Paper I also defined 01002 * 01003 * - jCRPna, iCDEna, iCUNna, iCTYna and iCRVna for bintables and 01004 * - TCRPna, TCDEna, TCUNna, TCTYna and TCRVna for pixel lists 01005 * 01006 * for use with an alternate version specifier (the "a"). Like the 01007 * PC, CD, PV, and PS keywords there is an obvious tendency to 01008 * confuse these two forms for column numbers up to 99. It is very 01009 * unlikely that any parser would reject keywords in the first set 01010 * with a non-blank alternate version specifier so this usage is 01011 * considered to be safe and is recommended. 01012 * 01013 * - WCSHDO_CNAMna: WCS Papers I and III defined 01014 * 01015 * - iCNAna, iCRDna, and iCSYna for bintables and 01016 * - TCNAna, TCRDna, and TCSYna for pixel lists 01017 * 01018 * By analogy with the above, the long forms would be 01019 * 01020 * - iCNAMna, iCRDEna, and iCSYEna for bintables and 01021 * - TCNAMna, TCRDEna, and TCSYEna for pixel lists 01022 * 01023 * Note that these keywords provide auxiliary information only, none 01024 * of them are needed to compute world coordinates. This usage is 01025 * potentially unsafe and is not recommended at this time. 01026 * 01027 * - WCSHDO_WCSNna: In light of wcsbth() note 4, write WCSNna instead of 01028 * TWCSna for pixel lists. While wcsbth() treats WCSNna and TWCSna 01029 * as equivalent, other parsers may not. Consequently, this usage 01030 * is potentially unsafe and is not recommended at this time. 01031 * 01032 * 01033 * Global variable: const char *wcshdr_errmsg[] - Status return messages 01034 * --------------------------------------------------------------------- 01035 * Error messages to match the status value returned from each function. 01036 * 01037 *===========================================================================*/ 01038 01039 #ifndef WCSLIB_WCSHDR 01040 #define WCSLIB_WCSHDR 01041 01042 #include "wcs.h" 01043 01044 #ifdef __cplusplus 01045 extern "C" { 01046 #endif 01047 01048 #define WCSHDR_none 0x00000000 01049 #define WCSHDR_all 0x000FFFFF 01050 #define WCSHDR_reject 0x10000000 01051 01052 #define WCSHDR_CROTAia 0x00000001 01053 #define WCSHDR_EPOCHa 0x00000002 01054 #define WCSHDR_VELREFa 0x00000004 01055 #define WCSHDR_CD00i00j 0x00000008 01056 #define WCSHDR_PC00i00j 0x00000010 01057 #define WCSHDR_PROJPn 0x00000020 01058 #define WCSHDR_RADECSYS 0x00000040 01059 #define WCSHDR_VSOURCE 0x00000080 01060 #define WCSHDR_DOBSn 0x00000100 01061 #define WCSHDR_LONGKEY 0x00000200 01062 #define WCSHDR_CNAMn 0x00000400 01063 #define WCSHDR_AUXIMG 0x00000800 01064 #define WCSHDR_ALLIMG 0x00001000 01065 01066 #define WCSHDR_IMGHEAD 0x00010000 01067 #define WCSHDR_BIMGARR 0x00020000 01068 #define WCSHDR_PIXLIST 0x00040000 01069 01070 #define WCSHDO_none 0x00 01071 #define WCSHDO_all 0xFF 01072 #define WCSHDO_safe 0x0F 01073 #define WCSHDO_DOBSn 0x01 01074 #define WCSHDO_TPCn_ka 0x02 01075 #define WCSHDO_PVn_ma 0x04 01076 #define WCSHDO_CRPXna 0x08 01077 #define WCSHDO_CNAMna 0x10 01078 #define WCSHDO_WCSNna 0x20 01079 01080 01081 extern const char *wcshdr_errmsg[]; 01082 01083 01084 int wcspih(char *header, int nkeyrec, int relax, int ctrl, int *nreject, 01085 int *nwcs, struct wcsprm **wcs); 01086 01087 int wcsbth(char *header, int nkeyrec, int relax, int ctrl, int keysel, 01088 int *colsel, int *nreject, int *nwcs, struct wcsprm **wcs); 01089 01090 int wcstab(struct wcsprm *wcs); 01091 01092 int wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]); 01093 01094 int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]); 01095 01096 int wcsvfree(int *nwcs, struct wcsprm **wcs); 01097 01098 int wcshdo(int relax, struct wcsprm *wcs, int *nkeyrec, char **header); 01099 01100 01101 #ifdef __cplusplus 01102 } 01103 #endif 01104 01105 #endif /* WCSLIB_WCSHDR */