WCSLIB 8.3
Loading...
Searching...
No Matches
dis.h
Go to the documentation of this file.
1/*============================================================================
2 WCSLIB 8.3 - an implementation of the FITS WCS standard.
3 Copyright (C) 1995-2024, Mark Calabretta
4
5 This file is part of WCSLIB.
6
7 WCSLIB is free software: you can redistribute it and/or modify it under the
8 terms of the GNU Lesser General Public License as published by the Free
9 Software Foundation, either version 3 of the License, or (at your option)
10 any later version.
11
12 WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with WCSLIB. If not, see http://www.gnu.org/licenses.
19
20 Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
21 http://www.atnf.csiro.au/people/Mark.Calabretta
22 $Id: dis.h,v 8.3 2024/05/08 16:02:37 mcalabre Exp $
23*=============================================================================
24*
25* WCSLIB 8.3 - C routines that implement the FITS World Coordinate System
26* (WCS) standard. Refer to the README file provided with WCSLIB for an
27* overview of the library.
28*
29*
30* Summary of the dis routines
31* ---------------------------
32* Routines in this suite implement extensions to the FITS World Coordinate
33* System (WCS) standard proposed by
34*
35= "Representations of distortions in FITS world coordinate systems",
36= Calabretta, M.R. et al. (WCS Paper IV, draft dated 2004/04/22),
37= available from http://www.atnf.csiro.au/people/Mark.Calabretta
38*
39* In brief, a distortion function may occupy one of two positions in the WCS
40* algorithm chain. Prior distortions precede the linear transformation
41* matrix, whether it be PCi_ja or CDi_ja, and sequent distortions follow it.
42* WCS Paper IV defines FITS keywords used to specify parameters for predefined
43* distortion functions. The following are used for prior distortions:
44*
45= CPDISja ...(string-valued, identifies the distortion function)
46= DPja ...(record-valued, parameters)
47= CPERRja ...(floating-valued, maximum value)
48*
49* Their counterparts for sequent distortions are CQDISia, DQia, and CQERRia.
50* An additional floating-valued keyword, DVERRa, records the maximum value of
51* the combined distortions.
52*
53* DPja and DQia are "record-valued". Syntactically, the keyvalues are
54* standard FITS strings, but they are to be interpreted in a special way.
55* The general form is
56*
57= DPja = '<field-specifier>: <float>'
58*
59* where the field-specifier consists of a sequence of fields separated by
60* periods, and the ': ' between the field-specifier and the floating-point
61* value is part of the record syntax. For example:
62*
63= DP1 = 'AXIS.1: 1'
64*
65* Certain field-specifiers are defined for all distortion functions, while
66* others are defined only for particular distortions. Refer to WCS Paper IV
67* for further details. wcspih() parses all distortion keywords and loads them
68* into a disprm struct for analysis by disset() which knows (or possibly does
69* not know) how to interpret them. Of the Paper IV distortion functions, only
70* the general Polynomial distortion is currently implemented here.
71*
72* TPV - the TPV "projection":
73* ---------------------------
74* The distortion function component of the TPV celestial "projection" is also
75* supported. The TPV projection, originally proposed in a draft of WCS Paper
76* II, consists of a TAN projection with sequent polynomial distortion, the
77* coefficients of which are encoded in PVi_ma keyrecords. Full details may be
78* found at the registry of FITS conventions:
79*
80= http://fits.gsfc.nasa.gov/registry/tpvwcs/tpv.html
81*
82* Internally, wcsset() changes TPV to a TAN projection, translates the PVi_ma
83* keywords to DQia and loads them into a disprm struct. These DQia keyrecords
84* have the form
85*
86= DQia = 'TPV.m: <value>'
87*
88* where i, a, m, and the value for each DQia match each PVi_ma. Consequently,
89* WCSLIB would handle a FITS header containing these keywords, along with
90* CQDISia = 'TPV' and the required DQia.NAXES and DQia.AXIS.ihat keywords.
91*
92* Note that, as defined, TPV assumes that CDi_ja is used to define the linear
93* transformation. The section on historical idiosyncrasies (below) cautions
94* about translating CDi_ja to PCi_ja plus CDELTia in this case.
95*
96* SIP - Simple Imaging Polynomial:
97* --------------------------------
98* These routines also support the Simple Imaging Polynomial (SIP), whose
99* design was influenced by early drafts of WCS Paper IV. It is described in
100* detail in
101*
102= http://fits.gsfc.nasa.gov/registry/sip.html
103*
104* SIP, which is defined only as a prior distortion for 2-D celestial images,
105* has the interesting feature that it records an approximation to the inverse
106* polynomial distortion function. This is used by disx2p() to provide an
107* initial estimate for its more precise iterative inversion. The
108* special-purpose keywords used by SIP are parsed and translated by wcspih()
109* as follows:
110*
111= A_p_q = <value> -> DP1 = 'SIP.FWD.p_q: <value>'
112= AP_p_q = <value> -> DP1 = 'SIP.REV.p_q: <value>'
113= B_p_q = <value> -> DP2 = 'SIP.FWD.p_q: <value>'
114= BP_p_q = <value> -> DP2 = 'SIP.REV.p_q: <value>'
115= A_DMAX = <value> -> DPERR1 = <value>
116= B_DMAX = <value> -> DPERR2 = <value>
117*
118* SIP's A_ORDER and B_ORDER keywords are not used. WCSLIB would recognise a
119* FITS header containing the above keywords, along with CPDISja = 'SIP' and
120* the required DPja.NAXES keywords.
121*
122* DSS - Digitized Sky Survey:
123* ---------------------------
124* The Digitized Sky Survey resulted from the production of the Guide Star
125* Catalogue for the Hubble Space Telescope. Plate solutions based on a
126* polynomial distortion function were encoded in FITS using non-standard
127* keywords. Sect. 5.2 of WCS Paper IV describes how DSS coordinates may be
128* translated to a sequent Polynomial distortion using two auxiliary variables.
129* That translation is based on optimising the non-distortion component of the
130* plate solution.
131*
132* Following Paper IV, wcspih() translates the non-distortion component of DSS
133* coordinates to standard WCS keywords (CRPIXja, PCi_ja, CRVALia, etc), and
134* fills a wcsprm struct with their values. It encodes the DSS polynomial
135* coefficients as
136*
137= AMDXm = <value> -> DQ1 = 'AMD.m: <value>'
138= AMDYm = <value> -> DQ2 = 'AMD.m: <value>'
139*
140* WCSLIB would recognise a FITS header containing the above keywords, along
141* with CQDISia = 'DSS' and the required DQia.NAXES keywords.
142*
143* WAT - the TNX and ZPX "projections":
144* ------------------------------------
145* The TNX and ZPX "projections" add a polynomial distortion function to the
146* standard TAN and ZPN projections respectively. Unusually, the polynomial
147* may be expressed as the sum of Chebyshev or Legendre polynomials, or as a
148* simple sum of monomials, as described in
149*
150= http://fits.gsfc.nasa.gov/registry/tnx/tnx-doc.html
151= http://fits.gsfc.nasa.gov/registry/zpxwcs/zpx.html
152*
153* The polynomial coefficients are encoded in special-purpose WATi_n keywords
154* as a set of continued strings, thus providing the name for this distortion
155* type. WATi_n are parsed and translated by wcspih() into the following set:
156*
157= DQi = 'WAT.POLY: <value>'
158= DQi = 'WAT.XMIN: <value>'
159= DQi = 'WAT.XMAX: <value>'
160= DQi = 'WAT.YMIN: <value>'
161= DQi = 'WAT.YMAX: <value>'
162= DQi = 'WAT.CHBY.m_n: <value>' or
163= DQi = 'WAT.LEGR.m_n: <value>' or
164= DQi = 'WAT.MONO.m_n: <value>'
165*
166* along with CQDISia = 'WAT' and the required DPja.NAXES keywords. For ZPX,
167* the ZPN projection parameters are also encoded in WATi_n, and wcspih()
168* translates these to standard PVi_ma.
169*
170* Note that, as defined, TNX and ZPX assume that CDi_ja is used to define the
171* linear transformation. The section on historical idiosyncrasies (below)
172* cautions about translating CDi_ja to PCi_ja plus CDELTia in this case.
173*
174* TPD - Template Polynomial Distortion:
175* -------------------------------------
176* The "Template Polynomial Distortion" (TPD) is a superset of the TPV, SIP,
177* DSS, and WAT (TNX & ZPX) polynomial distortions that also supports 1-D usage
178* and inversions. Like TPV, SIP, and DSS, the form of the polynomial is fixed
179* (the "template") and only the coefficients for the required terms are set
180* non-zero. TPD generalizes TPV in going to 9th degree, SIP by accomodating
181* TPV's linear and radial terms, and DSS in both respects. While in theory
182* the degree of the WAT polynomial distortion in unconstrained, in practice it
183* is limited to values that can be handled by TPD.
184*
185* Within WCSLIB, TPV, SIP, DSS, and WAT are all implemented as special cases
186* of TPD. Indeed, TPD was developed precisely for that purpose. WAT
187* distortions expressed as the sum of Chebyshev or Legendre polynomials are
188* expanded for TPD as a simple sum of monomials. Moreover, the general
189* Polynomial distortion is translated and implemented internally as TPD
190* whenever possible.
191*
192* However, WCSLIB also recognizes 'TPD' as a distortion function in its own
193* right (i.e. a recognized value of CPDISja or CQDISia), for use as both prior
194* and sequent distortions. Its DPja and DQia keyrecords have the form
195*
196= DPja = 'TPD.FWD.m: <value>'
197= DPja = 'TPD.REV.m: <value>'
198*
199* for the forward and reverse distortion functions. Moreover, like the
200* general Polynomial distortion, TPD supports auxiliary variables, though only
201* as a linear transformation of pixel coordinates (p1,p2):
202*
203= x = a0 + a1*p1 + a2*p2
204= y = b0 + b1*p1 + b2*p2
205*
206* where the coefficients of the auxiliary variables (x,y) are recorded as
207*
208= DPja = 'AUX.1.COEFF.0: a0' ...default 0.0
209= DPja = 'AUX.1.COEFF.1: a1' ...default 1.0
210= DPja = 'AUX.1.COEFF.2: a2' ...default 0.0
211= DPja = 'AUX.2.COEFF.0: b0' ...default 0.0
212= DPja = 'AUX.2.COEFF.1: b1' ...default 0.0
213= DPja = 'AUX.2.COEFF.2: b2' ...default 1.0
214*
215* Though nowhere near as powerful, in typical applications TPD is considerably
216* faster than the general Polynomial distortion. As TPD has a finite and not
217* too large number of possible terms (60), the coefficients for each can be
218* stored (by disset()) in a fixed location in the disprm::dparm[] array. A
219* large part of the speedup then arises from evaluating the polynomial using
220* Horner's scheme.
221*
222* Separate implementations for polynomials of each degree, and conditionals
223* for 1-D polynomials and 2-D polynomials with and without the radial
224* variable, ensure that unused terms mostly do not impose a significant
225* computational overhead.
226*
227* The TPD terms are as follows
228*
229= 0: 1 4: xx 12: xxxx 24: xxxxxx 40: xxxxxxxx
230= 5: xy 13: xxxy 25: xxxxxy 41: xxxxxxxy
231= 1: x 6: yy 14: xxyy 26: xxxxyy 42: xxxxxxyy
232= 2: y 15: xyyy 27: xxxyyy 43: xxxxxyyy
233= 3: r 7: xxx 16: yyyy 28: xxyyyy 44: xxxxyyyy
234= 8: xxy 29: xyyyyy 45: xxxyyyyy
235= 9: xyy 17: xxxxx 30: yyyyyy 46: xxyyyyyy
236= 10: yyy 18: xxxxy 47: xyyyyyyy
237= 11: rrr 19: xxxyy 31: xxxxxxx 48: yyyyyyyy
238= 20: xxyyy 32: xxxxxxy
239= 21: xyyyy 33: xxxxxyy 49: xxxxxxxxx
240= 22: yyyyy 34: xxxxyyy 50: xxxxxxxxy
241= 23: rrrrr 35: xxxyyyy 51: xxxxxxxyy
242= 36: xxyyyyy 52: xxxxxxyyy
243= 37: xyyyyyy 53: xxxxxyyyy
244= 38: yyyyyyy 54: xxxxyyyyy
245= 39: rrrrrrr 55: xxxyyyyyy
246= 56: xxyyyyyyy
247= 57: xyyyyyyyy
248= 58: yyyyyyyyy
249= 59: rrrrrrrrr
250*
251* where r = sqrt(xx + yy). Note that even powers of r are excluded since they
252* can be accomodated by powers of (xx + yy).
253*
254* Note here that "x" refers to the axis to which the distortion function is
255* attached, with "y" being the complementary axis. So, for example, with
256* longitude on axis 1 and latitude on axis 2, for TPD attached to axis 1, "x"
257* refers to axis 1 and "y" to axis 2. For TPD attached to axis 2, "x" refers
258* to axis 2, and "y" to axis 1.
259*
260* TPV uses all terms up to 39. The m in its PVi_ma keywords translates
261* directly to the TPD coefficient number.
262*
263* SIP uses all terms except for 0, 3, 11, 23, 39, and 59, with terms 1 and 2
264* only used for the inverse. Its A_p_q, etc. keywords must be translated
265* using a map.
266*
267* DSS uses terms 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 17, 19, and 21. The presence
268* of a non-zero constant term arises through the use of auxiliary variables
269* with origin offset from the reference point of the TAN projection. However,
270* in the translation given by WCS Paper IV, the distortion polynomial is zero,
271* or very close to zero, at the reference pixel itself. The mapping between
272* DSS's AMDXm (or AMDYm) keyvalues and TPD coefficients, while still simple,
273* is not quite as straightforward as for TPV and SIP.
274*
275* WAT uses all but the radial terms, namely 3, 11, 23, 39, and 59. While the
276* mapping between WAT's monomial coefficients and TPD is fairly simple, for
277* its expression in terms of a sum of Chebyshev or Legendre polynomials it is
278* much less so.
279*
280* Historical idiosyncrasies:
281* --------------------------
282* In addition to the above, some historical distortion functions have further
283* idiosyncrasies that must be taken into account when translating them to TPD.
284*
285* WCS Paper IV specifies that a distortion function returns a correction to be
286* added to pixel coordinates (prior distortion) or intermediate pixel
287* coordinates (sequent distortion). The correction is meant to be small so
288* that ignoring the distortion function, i.e. setting the correction to zero,
289* produces a commensurately small error.
290*
291* However, rather than an additive correction, some historical distortion
292* functions (TPV, DSS) define a polynomial that returns the corrected
293* coordinates directly.
294*
295* The difference between the two approaches is readily accounted for simply by
296* adding or subtracting 1 from the coefficient of the first degree term of the
297* polynomial. However, it opens the way for considerable confusion.
298*
299* Additional to the formalism of WCS Paper IV, both the Polynomial and TPD
300* distortion functions recognise a keyword
301*
302= DPja = 'DOCORR: 0'
303*
304* which is meant to apply generally to indicate that the distortion function
305* returns the corrected coordinates directly. Any other value for DOCORR (or
306* its absence) indicates that the distortion function returns an additive
307* correction.
308*
309* WCS Paper IV also specifies that the independent variables of a distortion
310* function are pixel coordinates (prior distortion) or intermediate pixel
311* coordinates (sequent distortion).
312*
313* On the contrary, the independent variables of the SIP polynomial are pixel
314* coordinate offsets from the reference pixel. This is readily handled via
315* the renormalisation parameters
316*
317= DPja = 'OFFSET.jhat: <value>'
318*
319* where the value corresponds to CRPIXja.
320*
321* Likewise, because TPV, TNX, and ZPX are defined in terms of CDi_ja, the
322* independent variables of the polynomial are intermediate world coordinates
323* rather than intermediate pixel coordinates. Because sequent distortions
324* are always applied before CDELTia, if CDi_ja is translated to PCi_ja plus
325* CDELTia, then either CDELTia must be unity, or the distortion polynomial
326* coefficients must be adjusted to account for the change of scale.
327*
328* Summary of the dis routines:
329* ----------------------------
330* These routines apply the distortion functions defined by the extension to
331* the FITS WCS standard proposed in Paper IV. They are based on the disprm
332* struct which contains all information needed for the computations. The
333* struct contains some members that must be set by the user, and others that
334* are maintained by these routines, somewhat like a C++ class but with no
335* encapsulation.
336*
337* dpfill(), dpkeyi(), and dpkeyd() are provided to manage the dpkey struct.
338*
339* disndp(), disini(), disinit(), discpy(), and disfree() are provided to
340* manage the disprm struct, dissize() computes its total size including
341* allocated memory, disenq() returns information about the state of the
342* struct, and disprt() prints its contents.
343*
344* disperr() prints the error message(s) (if any) stored in a disprm struct.
345*
346* wcshdo() normally writes SIP and TPV headers in their native form if at all
347* possible. However, dishdo() may be used to set a flag that tells it to
348* write the header in the form of the TPD translation used internally.
349*
350* A setup routine, disset(), computes intermediate values in the disprm struct
351* from parameters in it that were supplied by the user. The struct always
352* needs to be set up by disset(), though disset() need not be called
353* explicitly - refer to the explanation of disprm::flag.
354*
355* disp2x() and disx2p() implement the WCS distortion functions, disp2x() using
356* separate functions, such as dispoly() and tpd7(), to do the computation.
357*
358* An auxiliary routine, diswarp(), computes various measures of the distortion
359* over a specified range of coordinates.
360*
361* PLEASE NOTE: Distortions are not yet handled by wcsbth(), or wcscompare().
362*
363*
364* disndp() - Memory allocation for DPja and DQia
365* ----------------------------------------------
366* disndp() sets or gets the value of NDPMAX (default 256). This global
367* variable controls the maximum number of dpkey structs, for holding DPja or
368* DQia keyvalues, that disini() should allocate space for. It is also used by
369* disinit() as the default value of ndpmax.
370*
371* PLEASE NOTE: This function is not thread-safe.
372*
373* Given:
374* n int Value of NDPMAX; ignored if < 0. Use a value less
375* than zero to get the current value.
376*
377* Function return value:
378* int Current value of NDPMAX.
379*
380*
381* dpfill() - Fill the contents of a dpkey struct
382* ----------------------------------------------
383* dpfill() is a utility routine to aid in filling the contents of the dpkey
384* struct. No checks are done on the validity of the inputs.
385*
386* WCS Paper IV specifies the syntax of a record-valued keyword as
387*
388= keyword = '<field-specifier>: <float>'
389*
390* However, some DPja and DQia record values, such as those of DPja.NAXES and
391* DPja.AXIS.j, are intrinsically integer-valued. While FITS header parsers
392* are not expected to know in advance which of DPja and DQia are integral and
393* which are floating point, if the record's value parses as an integer (i.e.
394* without decimal point or exponent), then preferably enter it into the dpkey
395* struct as an integer. Either way, it doesn't matter as disset() accepts
396* either data type for all record values.
397*
398* Given and returned:
399* dp struct dpkey*
400* Store for DPja and DQia keyvalues.
401*
402* Given:
403* keyword const char *
404* field const char *
405* These arguments are concatenated with an intervening
406* "." to construct the full record field name, i.e.
407* including the keyword name, DPja or DQia (but
408* excluding the colon delimiter which is NOT part of the
409* name). Either may be given as a NULL pointer. Set
410* both NULL to omit setting this component of the
411* struct.
412*
413* j int Axis number (1-relative), i.e. the j in DPja or
414* i in DQia. Can be given as 0, in which case the axis
415* number will be obtained from the keyword component of
416* the field name which must either have been given or
417* preset.
418*
419* If j is non-zero, and keyword was given, then the
420* value of j will be used to fill in the axis number.
421*
422* type int Data type of the record's value
423* 0: Integer,
424* 1: Floating point.
425*
426* i int For type == 0, the integer value of the record.
427*
428* f double For type == 1, the floating point value of the record.
429*
430* Function return value:
431* int Status return value:
432* 0: Success.
433*
434*
435* dpkeyi() - Get the data value in a dpkey struct as int
436* ------------------------------------------------------
437* dpkeyi() returns the data value in a dpkey struct as an integer value.
438*
439* Given and returned:
440* dp const struct dpkey *
441* Parsed contents of a DPja or DQia keyrecord.
442*
443* Function return value:
444* int The record's value as int.
445*
446*
447* dpkeyd() - Get the data value in a dpkey struct as double
448* ---------------------------------------------------------
449* dpkeyd() returns the data value in a dpkey struct as a floating point
450* value.
451*
452* Given and returned:
453* dp const struct dpkey *
454* Parsed contents of a DPja or DQia keyrecord.
455*
456* Function return value:
457* double The record's value as double.
458*
459*
460* disini() - Default constructor for the disprm struct
461* ----------------------------------------------------
462* disini() is a thin wrapper on disinit(). It invokes it with ndpmax set
463* to -1 which causes it to use the value of the global variable NDPMAX. It
464* is thereby potentially thread-unsafe if NDPMAX is altered dynamically via
465* disndp(). Use disinit() for a thread-safe alternative in this case.
466*
467*
468* disinit() - Default constructor for the disprm struct
469* ----------------------------------------------------
470* disinit() allocates memory for arrays in a disprm struct and sets all
471* members of the struct to default values.
472*
473* PLEASE NOTE: every disprm struct must be initialized by disinit(), possibly
474* repeatedly. On the first invokation, and only the first invokation,
475* disprm::flag must be set to -1 to initialize memory management, regardless
476* of whether disinit() will actually be used to allocate memory.
477*
478* Given:
479* alloc int If true, allocate memory unconditionally for arrays in
480* the disprm struct.
481*
482* If false, it is assumed that pointers to these arrays
483* have been set by the user except if they are null
484* pointers in which case memory will be allocated for
485* them regardless. (In other words, setting alloc true
486* saves having to initalize these pointers to zero.)
487*
488* naxis int The number of world coordinate axes, used to determine
489* array sizes.
490*
491* Given and returned:
492* dis struct disprm*
493* Distortion function parameters. Note that, in order
494* to initialize memory management disprm::flag must be
495* set to -1 when dis is initialized for the first time
496* (memory leaks may result if it had already been
497* initialized).
498*
499* Given:
500* ndpmax int The number of DPja or DQia keywords to allocate space
501* for. If set to -1, the value of the global variable
502* NDPMAX will be used. This is potentially
503* thread-unsafe if disndp() is being used dynamically to
504* alter its value.
505*
506* Function return value:
507* int Status return value:
508* 0: Success.
509* 1: Null disprm pointer passed.
510* 2: Memory allocation failed.
511*
512* For returns > 1, a detailed error message is set in
513* disprm::err if enabled, see wcserr_enable().
514*
515*
516* discpy() - Copy routine for the disprm struct
517* ---------------------------------------------
518* discpy() does a deep copy of one disprm struct to another, using disinit()
519* to allocate memory unconditionally for its arrays if required. Only the
520* "information to be provided" part of the struct is copied; a call to
521* disset() is required to initialize the remainder.
522*
523* Given:
524* alloc int If true, allocate memory unconditionally for arrays in
525* the destination. Otherwise, it is assumed that
526* pointers to these arrays have been set by the user
527* except if they are null pointers in which case memory
528* will be allocated for them regardless.
529*
530* dissrc const struct disprm*
531* Struct to copy from.
532*
533* Given and returned:
534* disdst struct disprm*
535* Struct to copy to. disprm::flag should be set to -1
536* if disdst was not previously initialized (memory leaks
537* may result if it was previously initialized).
538*
539* Function return value:
540* int Status return value:
541* 0: Success.
542* 1: Null disprm pointer passed.
543* 2: Memory allocation failed.
544*
545* For returns > 1, a detailed error message is set in
546* disprm::err if enabled, see wcserr_enable().
547*
548*
549* disfree() - Destructor for the disprm struct
550* --------------------------------------------
551* disfree() frees memory allocated for the disprm arrays by disinit().
552* disinit() keeps a record of the memory it allocates and disfree() will only
553* attempt to free this.
554*
555* PLEASE NOTE: disfree() must not be invoked on a disprm struct that was not
556* initialized by disinit().
557*
558* Given:
559* dis struct disprm*
560* Distortion function parameters.
561*
562* Function return value:
563* int Status return value:
564* 0: Success.
565* 1: Null disprm pointer passed.
566*
567*
568* dissize() - Compute the size of a disprm struct
569* -----------------------------------------------
570* dissize() computes the full size of a disprm struct, including allocated
571* memory.
572*
573* Given:
574* dis const struct disprm*
575* Distortion function parameters.
576*
577* If NULL, the base size of the struct and the allocated
578* size are both set to zero.
579*
580* Returned:
581* sizes int[2] The first element is the base size of the struct as
582* returned by sizeof(struct disprm). The second element
583* is the total allocated size, in bytes, assuming that
584* the allocation was done by disini(). This figure
585* includes memory allocated for members of constituent
586* structs, such as disprm::dp.
587*
588* It is not an error for the struct not to have been set
589* up via tabset(), which normally results in additional
590* memory allocation.
591*
592* Function return value:
593* int Status return value:
594* 0: Success.
595*
596*
597* disenq() - enquire about the state of a disprm struct
598* -----------------------------------------------------
599* disenq() may be used to obtain information about the state of a disprm
600* struct. The function returns a true/false answer for the enquiry asked.
601*
602* Given:
603* dis const struct disprm*
604* Distortion function parameters.
605*
606* enquiry int Enquiry according to the following parameters:
607* DISENQ_MEM: memory in the struct is being managed by
608* WCSLIB (see disinit()).
609* DISENQ_SET: the struct has been set up by disset().
610* DISENQ_BYP: the struct is in bypass mode, which
611* implies that it has been set up (see
612* disset()).
613* These may be combined by logical OR, e.g.
614* DISENQ_MEM | DISENQ_SET. The enquiry result will be
615* the logical AND of the individual results.
616*
617* Function return value:
618* int Enquiry result:
619* 0: No.
620* 1: Yes.
621*
622*
623* disprt() - Print routine for the disprm struct
624* ----------------------------------------------
625* disprt() prints the contents of a disprm struct using wcsprintf(). Mainly
626* intended for diagnostic purposes.
627*
628* Given:
629* dis const struct disprm*
630* Distortion function parameters.
631*
632* Function return value:
633* int Status return value:
634* 0: Success.
635* 1: Null disprm pointer passed.
636*
637*
638* disperr() - Print error messages from a disprm struct
639* -----------------------------------------------------
640* disperr() prints the error message(s) (if any) stored in a disprm struct.
641* If there are no errors then nothing is printed. It uses wcserr_prt(), q.v.
642*
643* Given:
644* dis const struct disprm*
645* Distortion function parameters.
646*
647* prefix const char *
648* If non-NULL, each output line will be prefixed with
649* this string.
650*
651* Function return value:
652* int Status return value:
653* 0: Success.
654* 1: Null disprm pointer passed.
655*
656*
657* dishdo() - write FITS headers using TPD
658* ---------------------------------------
659* dishdo() sets a flag that tells wcshdo() to write FITS headers in the form
660* of the TPD translation used internally. Normally SIP and TPV would be
661* written in their native form if at all possible.
662*
663* Given and returned:
664* dis struct disprm*
665* Distortion function parameters.
666*
667* Function return value:
668* int Status return value:
669* 0: Success.
670* 1: Null disprm pointer passed.
671* 3: No TPD translation.
672*
673*
674* disset() - Setup routine for the disprm struct
675* ----------------------------------------------
676* disset(), sets up the disprm struct according to information supplied within
677* it - refer to the explanation of disprm::flag.
678*
679* Note that this routine need not be called directly; it will be invoked by
680* disp2x() and disx2p() if the disprm::flag is anything other than a
681* predefined magic value.
682*
683* disset() normally operates regardless of the value of disprm::flag; i.e.
684* even if a struct was previously set up it will be reset unconditionally.
685* However, a disprm struct may be put into "bypass" mode by invoking disset()
686* initially with disprm::flag == 1 (rather than 0). disset() will return
687* immediately if invoked on a struct in that state. To take a struct out of
688* bypass mode, simply reset disprm::flag to zero. See also disenq().
689*
690* Given and returned:
691* dis struct disprm*
692* Distortion function parameters.
693*
694* Function return value:
695* int Status return value:
696* 0: Success.
697* 1: Null disprm pointer passed.
698* 2: Memory allocation failed.
699* 3: Invalid parameter.
700*
701* For returns > 1, a detailed error message is set in
702* disprm::err if enabled, see wcserr_enable().
703*
704*
705* disp2x() - Apply distortion function
706* ------------------------------------
707* disp2x() applies the distortion functions. By definition, the distortion
708* is in the pixel-to-world direction.
709*
710* Depending on the point in the algorithm chain at which it is invoked,
711* disp2x() may transform pixel coordinates to corrected pixel coordinates, or
712* intermediate pixel coordinates to corrected intermediate pixel coordinates,
713* or image coordinates to corrected image coordinates.
714*
715*
716* Given and returned:
717* dis struct disprm*
718* Distortion function parameters.
719*
720* Given:
721* rawcrd const double[naxis]
722* Array of coordinates.
723*
724* Returned:
725* discrd double[naxis]
726* Array of coordinates to which the distortion functions
727* have been applied.
728*
729* Function return value:
730* int Status return value:
731* 0: Success.
732* 1: Null disprm pointer passed.
733* 2: Memory allocation failed.
734* 3: Invalid parameter.
735* 4: Distort error.
736*
737* For returns > 1, a detailed error message is set in
738* disprm::err if enabled, see wcserr_enable().
739*
740*
741* disx2p() - Apply de-distortion function
742* ---------------------------------------
743* disx2p() applies the inverse of the distortion functions. By definition,
744* the de-distortion is in the world-to-pixel direction.
745*
746* Depending on the point in the algorithm chain at which it is invoked,
747* disx2p() may transform corrected pixel coordinates to pixel coordinates, or
748* corrected intermediate pixel coordinates to intermediate pixel coordinates,
749* or corrected image coordinates to image coordinates.
750*
751* disx2p() iteratively solves for the inverse using disp2x(). It assumes
752* that the distortion is small and the functions are well-behaved, being
753* continuous and with continuous derivatives. Also that, to first order
754* in the neighbourhood of the solution, discrd[j] ~= a + b*rawcrd[j], i.e.
755* independent of rawcrd[i], where i != j. This is effectively equivalent to
756* assuming that the distortion functions are separable to first order.
757* Furthermore, a is assumed to be small, and b close to unity.
758*
759* If disprm::disx2p() is defined, then disx2p() uses it to provide an initial
760* estimate for its more precise iterative inversion.
761*
762* Given and returned:
763* dis struct disprm*
764* Distortion function parameters.
765*
766* Given:
767* discrd const double[naxis]
768* Array of coordinates.
769*
770* Returned:
771* rawcrd double[naxis]
772* Array of coordinates to which the inverse distortion
773* functions have been applied.
774*
775* Function return value:
776* int Status return value:
777* 0: Success.
778* 1: Null disprm pointer passed.
779* 2: Memory allocation failed.
780* 3: Invalid parameter.
781* 5: De-distort error.
782*
783* For returns > 1, a detailed error message is set in
784* disprm::err if enabled, see wcserr_enable().
785*
786*
787* diswarp() - Compute measures of distortion
788* ------------------------------------------
789* diswarp() computes various measures of the distortion over a specified range
790* of coordinates.
791*
792* For prior distortions, the measures may be interpreted simply as an offset
793* in pixel coordinates. For sequent distortions, the interpretation depends
794* on the nature of the linear transformation matrix (PCi_ja or CDi_ja). If
795* the latter introduces a scaling, then the measures will also be scaled.
796* Note also that the image domain, which is rectangular in pixel coordinates,
797* may be rotated, skewed, and/or stretched in intermediate pixel coordinates,
798* and in general cannot be defined using pixblc[] and pixtrc[].
799*
800* PLEASE NOTE: the measures of total distortion may be essentially meaningless
801* if there are multiple sequent distortions with different scaling.
802*
803* See also linwarp().
804*
805* Given and returned:
806* dis struct disprm*
807* Distortion function parameters.
808*
809* Given:
810* pixblc const double[naxis]
811* Start of the range of pixel coordinates (for prior
812* distortions), or intermediate pixel coordinates (for
813* sequent distortions). May be specified as a NULL
814* pointer which is interpreted as (1,1,...).
815*
816* pixtrc const double[naxis]
817* End of the range of pixel coordinates (prior) or
818* intermediate pixel coordinates (sequent).
819*
820* pixsamp const double[naxis]
821* If positive or zero, the increment on the particular
822* axis, starting at pixblc[]. Zero is interpreted as a
823* unit increment. pixsamp may also be specified as a
824* NULL pointer which is interpreted as all zeroes, i.e.
825* unit increments on all axes.
826*
827* If negative, the grid size on the particular axis (the
828* absolute value being rounded to the nearest integer).
829* For example, if pixsamp is (-128.0,-128.0,...) then
830* each axis will be sampled at 128 points between
831* pixblc[] and pixtrc[] inclusive. Use caution when
832* using this option on non-square images.
833*
834* Returned:
835* nsamp int* The number of pixel coordinates sampled.
836*
837* Can be specified as a NULL pointer if not required.
838*
839* maxdis double[naxis]
840* For each individual distortion function, the
841* maximum absolute value of the distortion.
842*
843* Can be specified as a NULL pointer if not required.
844*
845* maxtot double* For the combination of all distortion functions, the
846* maximum absolute value of the distortion.
847*
848* Can be specified as a NULL pointer if not required.
849*
850* avgdis double[naxis]
851* For each individual distortion function, the
852* mean value of the distortion.
853*
854* Can be specified as a NULL pointer if not required.
855*
856* avgtot double* For the combination of all distortion functions, the
857* mean value of the distortion.
858*
859* Can be specified as a NULL pointer if not required.
860*
861* rmsdis double[naxis]
862* For each individual distortion function, the
863* root mean square deviation of the distortion.
864*
865* Can be specified as a NULL pointer if not required.
866*
867* rmstot double* For the combination of all distortion functions, the
868* root mean square deviation of the distortion.
869*
870* Can be specified as a NULL pointer if not required.
871*
872* Function return value:
873* int Status return value:
874* 0: Success.
875* 1: Null disprm pointer passed.
876* 2: Memory allocation failed.
877* 3: Invalid parameter.
878* 4: Distort error.
879*
880*
881* disprm struct - Distortion parameters
882* -------------------------------------
883* The disprm struct contains all of the information required to apply a set of
884* distortion functions. It consists of certain members that must be set by
885* the user ("given") and others that are set by the WCSLIB routines
886* ("returned"). While the addresses of the arrays themselves may be set by
887* disinit() if it (optionally) allocates memory, their contents must be set by
888* the user.
889*
890* int flag
891* (Given and returned) This flag must be set to zero (or 1, see disset())
892* whenever any of the following disprm members are set or changed:
893*
894* - disprm::naxis,
895* - disprm::dtype,
896* - disprm::ndp,
897* - disprm::dp.
898*
899* This signals the initialization routine, disset(), to recompute the
900* returned members of the disprm struct. disset() will reset flag to
901* indicate that this has been done.
902*
903* PLEASE NOTE: flag must be set to -1 when disinit() is called for the
904* first time for a particular disprm struct in order to initialize memory
905* management. It must ONLY be used on the first initialization otherwise
906* memory leaks may result.
907*
908* int naxis
909* (Given or returned) Number of pixel and world coordinate elements.
910*
911* If disinit() is used to initialize the disprm struct (as would normally
912* be the case) then it will set naxis from the value passed to it as a
913* function argument. The user should not subsequently modify it.
914*
915* char (*dtype)[72]
916* (Given) Pointer to the first element of an array of char[72] containing
917* the name of the distortion function for each axis.
918*
919* int ndp
920* (Given) The number of entries in the disprm::dp[] array.
921*
922* int ndpmax
923* (Given) The length of the disprm::dp[] array.
924*
925* ndpmax will be set by disinit() if it allocates memory for disprm::dp[],
926* otherwise it must be set by the user. See also disndp().
927*
928* struct dpkey dp
929* (Given) Address of the first element of an array of length ndpmax of
930* dpkey structs.
931*
932* As a FITS header parser encounters each DPja or DQia keyword it should
933* load it into a dpkey struct in the array and increment ndp. However,
934* note that a single disprm struct must hold only DPja or DQia keyvalues,
935* not both. disset() interprets them as required by the particular
936* distortion function.
937*
938* double *maxdis
939* (Given) Pointer to the first element of an array of double specifying
940* the maximum absolute value of the distortion for each axis computed over
941* the whole image.
942*
943* It is not necessary to reset the disprm struct (via disset()) when
944* disprm::maxdis is changed.
945*
946* double totdis
947* (Given) The maximum absolute value of the combination of all distortion
948* functions specified as an offset in pixel coordinates computed over the
949* whole image.
950*
951* It is not necessary to reset the disprm struct (via disset()) when
952* disprm::totdis is changed.
953*
954* int *docorr
955* (Returned) Pointer to the first element of an array of int containing
956* flags that indicate the mode of correction for each axis.
957*
958* If docorr is zero, the distortion function returns the corrected
959* coordinates directly. Any other value indicates that the distortion
960* function computes a correction to be added to pixel coordinates (prior
961* distortion) or intermediate pixel coordinates (sequent distortion).
962*
963* int *Nhat
964* (Returned) Pointer to the first element of an array of int containing
965* the number of coordinate axes that form the independent variables of the
966* distortion function for each axis.
967*
968* int **axmap
969* (Returned) Pointer to the first element of an array of int* containing
970* pointers to the first elements of the axis mapping arrays for each axis.
971*
972* An axis mapping associates the independent variables of a distortion
973* function with the 0-relative image axis number. For example, consider
974* an image with a spectrum on the first axis (axis 0), followed by RA
975* (axis 1), Dec (axis2), and time (axis 3) axes. For a distortion in
976* (RA,Dec) and no distortion on the spectral or time axes, the axis
977* mapping arrays, axmap[j][], would be
978*
979= j=0: [-1, -1, -1, -1] ...no distortion on spectral axis,
980= 1: [ 1, 2, -1, -1] ...RA distortion depends on RA and Dec,
981= 2: [ 2, 1, -1, -1] ...Dec distortion depends on Dec and RA,
982= 3: [-1, -1, -1, -1] ...no distortion on time axis,
983*
984* where -1 indicates that there is no corresponding independent
985* variable.
986*
987* double **offset
988* (Returned) Pointer to the first element of an array of double*
989* containing pointers to the first elements of arrays of offsets used to
990* renormalize the independent variables of the distortion function for
991* each axis.
992*
993* The offsets are subtracted from the independent variables before
994* scaling.
995*
996* double **scale
997* (Returned) Pointer to the first element of an array of double*
998* containing pointers to the first elements of arrays of scales used to
999* renormalize the independent variables of the distortion function for
1000* each axis.
1001*
1002* The scale is applied to the independent variables after the offsets are
1003* subtracted.
1004*
1005* int **iparm
1006* (Returned) Pointer to the first element of an array of int*
1007* containing pointers to the first elements of the arrays of integer
1008* distortion parameters for each axis.
1009*
1010* double **dparm
1011* (Returned) Pointer to the first element of an array of double*
1012* containing pointers to the first elements of the arrays of floating
1013* point distortion parameters for each axis.
1014*
1015* int i_naxis
1016* (Returned) Dimension of the internal arrays (normally equal to naxis).
1017*
1018* int ndis
1019* (Returned) The number of distortion functions.
1020*
1021* struct wcserr *err
1022* (Returned) If enabled, when an error status is returned, this struct
1023* contains detailed information about the error, see wcserr_enable().
1024*
1025* int (**disp2x)(DISP2X_ARGS)
1026* (For internal use only.)
1027* int (**disx2p)(DISX2P_ARGS)
1028* (For internal use only.)
1029* double *dummy
1030* (For internal use only.)
1031* int m_flag
1032* (For internal use only.)
1033* int m_naxis
1034* (For internal use only.)
1035* char (*m_dtype)[72]
1036* (For internal use only.)
1037* double **m_dp
1038* (For internal use only.)
1039* double *m_maxdis
1040* (For internal use only.)
1041*
1042*
1043* dpkey struct - Store for DPja and DQia keyvalues
1044* ------------------------------------------------
1045* The dpkey struct is used to pass the parsed contents of DPja or DQia
1046* keyrecords to disset() via the disprm struct. A disprm struct must hold
1047* only DPja or DQia keyvalues, not both.
1048*
1049* All members of this struct are to be set by the user.
1050*
1051* char field[72]
1052* (Given) The full field name of the record, including the keyword name.
1053* Note that the colon delimiter separating the field name and the value in
1054* record-valued keyvalues is not part of the field name. For example, in
1055* the following:
1056*
1057= DP3A = 'AXIS.1: 2'
1058*
1059* the full record field name is "DP3A.AXIS.1", and the record's value
1060* is 2.
1061*
1062* int j
1063* (Given) Axis number (1-relative), i.e. the j in DPja or i in DQia.
1064*
1065* int type
1066* (Given) The data type of the record's value
1067* - 0: Integer (stored as an int),
1068* - 1: Floating point (stored as a double).
1069*
1070* union value
1071* (Given) A union comprised of
1072* - dpkey::i,
1073* - dpkey::f,
1074*
1075* the record's value.
1076*
1077*
1078* Global variable: const char *dis_errmsg[] - Status return messages
1079* ------------------------------------------------------------------
1080* Error messages to match the status value returned from each function.
1081*
1082*===========================================================================*/
1083
1084#ifndef WCSLIB_DIS
1085#define WCSLIB_DIS
1086
1087#ifdef __cplusplus
1088extern "C" {
1089#endif
1090
1092 DISENQ_MEM = 1, // disprm struct memory is managed by WCSLIB.
1093 DISENQ_SET = 2, // disprm struct has been set up.
1094 DISENQ_BYP = 4, // disprm struct is in bypass mode.
1095};
1096
1097extern const char *dis_errmsg[];
1098
1100 DISERR_SUCCESS = 0, // Success.
1101 DISERR_NULL_POINTER = 1, // Null disprm pointer passed.
1102 DISERR_MEMORY = 2, // Memory allocation failed.
1103 DISERR_BAD_PARAM = 3, // Invalid parameter value.
1104 DISERR_DISTORT = 4, // Distortion error.
1105 DISERR_DEDISTORT = 5 // De-distortion error.
1107
1108// For use in declaring distortion function prototypes (= DISX2P_ARGS).
1109#define DISP2X_ARGS int inverse, const int iparm[], const double dparm[], \
1110int ncrd, const double rawcrd[], double *discrd
1111
1112// For use in declaring de-distortion function prototypes (= DISP2X_ARGS).
1113#define DISX2P_ARGS int inverse, const int iparm[], const double dparm[], \
1114int ncrd, const double discrd[], double *rawcrd
1115
1116
1117// Struct used for storing DPja and DQia keyvalues.
1118struct dpkey {
1119 char field[72]; // Full record field name (no colon).
1120 int j; // Axis number, as in DPja (1-relative).
1121 int type; // Data type of value.
1122 union {
1123 int i; // Integer record value.
1124 double f; // Floating point record value.
1125 } value; // Record value.
1126};
1127
1128// Size of the dpkey struct in int units, used by the Fortran wrappers.
1129#define DPLEN (sizeof(struct dpkey)/sizeof(int))
1130
1131
1132struct disprm {
1133 // Initialization flag (see the prologue above).
1134 //--------------------------------------------------------------------------
1135 int flag; // Set to zero to force initialization.
1136
1137 // Parameters to be provided (see the prologue above).
1138 //--------------------------------------------------------------------------
1139 int naxis; // The number of pixel coordinate elements,
1140 // given by NAXIS.
1141 char (*dtype)[72]; // For each axis, the distortion type.
1142 int ndp; // Number of DPja or DQia keywords, and the
1143 int ndpmax; // number for which space was allocated.
1144 struct dpkey *dp; // DPja or DQia keyvalues (not both).
1145 double totdis; // The maximum combined distortion.
1146 double *maxdis; // For each axis, the maximum distortion.
1147
1148 // Information derived from the parameters supplied.
1149 //--------------------------------------------------------------------------
1150 int *docorr; // For each axis, the mode of correction.
1151 int *Nhat; // For each axis, the number of coordinate
1152 // axes that form the independent variables
1153 // of the distortion function.
1154 int **axmap; // For each axis, the axis mapping array.
1155 double **offset; // For each axis, renormalization offsets.
1156 double **scale; // For each axis, renormalization scales.
1157 int **iparm; // For each axis, the array of integer
1158 // distortion parameters.
1159 double **dparm; // For each axis, the array of floating
1160 // point distortion parameters.
1161 int i_naxis; // Dimension of the internal arrays.
1162 int ndis; // The number of distortion functions.
1163
1164 // Error handling, if enabled.
1165 //--------------------------------------------------------------------------
1166 struct wcserr *err;
1167
1168 // Private - the remainder are for internal use.
1169 //--------------------------------------------------------------------------
1170 int (**disp2x)(DISP2X_ARGS); // For each axis, pointers to the
1171 int (**disx2p)(DISX2P_ARGS); // distortion function and its inverse.
1172
1173 int m_flag, m_naxis; // The remainder are for memory management.
1174 char (*m_dtype)[72];
1175 struct dpkey *m_dp;
1176 double *m_maxdis;
1177};
1178
1179// Size of the disprm struct in int units, used by the Fortran wrappers.
1180#define DISLEN (sizeof(struct disprm)/sizeof(int))
1181
1182
1183int disndp(int n);
1184
1185int dpfill(struct dpkey *dp, const char *keyword, const char *field, int j,
1186 int type, int i, double f);
1187
1188int dpkeyi(const struct dpkey *dp);
1189
1190double dpkeyd(const struct dpkey *dp);
1191
1192int disini(int alloc, int naxis, struct disprm *dis);
1193
1194int disinit(int alloc, int naxis, struct disprm *dis, int ndpmax);
1195
1196int discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst);
1197
1198int disfree(struct disprm *dis);
1199
1200int dissize(const struct disprm *dis, int sizes[2]);
1201
1202int disenq(const struct disprm *dis, int enquiry);
1203
1204int disprt(const struct disprm *dis);
1205
1206int disperr(const struct disprm *dis, const char *prefix);
1207
1208int dishdo(struct disprm *dis);
1209
1210int disset(struct disprm *dis);
1211
1212int disp2x(struct disprm *dis, const double rawcrd[], double discrd[]);
1213
1214int disx2p(struct disprm *dis, const double discrd[], double rawcrd[]);
1215
1216int diswarp(struct disprm *dis, const double pixblc[], const double pixtrc[],
1217 const double pixsamp[], int *nsamp,
1218 double maxdis[], double *maxtot,
1219 double avgdis[], double *avgtot,
1220 double rmsdis[], double *rmstot);
1221
1222#ifdef __cplusplus
1223}
1224#endif
1225
1226#endif // WCSLIB_DIS
int disp2x(struct disprm *dis, const double rawcrd[], double discrd[])
Apply distortion function.
double dpkeyd(const struct dpkey *dp)
Get the data value in a dpkey struct as double.
#define DISP2X_ARGS
Definition dis.h:1109
dis_errmsg_enum
Definition dis.h:1099
@ DISERR_MEMORY
Definition dis.h:1102
@ DISERR_NULL_POINTER
Definition dis.h:1101
@ DISERR_DEDISTORT
Definition dis.h:1105
@ DISERR_BAD_PARAM
Definition dis.h:1103
@ DISERR_DISTORT
Definition dis.h:1104
@ DISERR_SUCCESS
Definition dis.h:1100
int disinit(int alloc, int naxis, struct disprm *dis, int ndpmax)
Default constructor for the disprm struct.
int discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst)
Copy routine for the disprm struct.
int dpfill(struct dpkey *dp, const char *keyword, const char *field, int j, int type, int i, double f)
Fill the contents of a dpkey struct.
disenq_enum
Definition dis.h:1091
@ DISENQ_MEM
Definition dis.h:1092
@ DISENQ_SET
Definition dis.h:1093
@ DISENQ_BYP
Definition dis.h:1094
int dpkeyi(const struct dpkey *dp)
Get the data value in a dpkey struct as int.
int dissize(const struct disprm *dis, int sizes[2])
Compute the size of a disprm struct.
const char * dis_errmsg[]
Status return messages.
int disfree(struct disprm *dis)
Destructor for the disprm struct.
int disini(int alloc, int naxis, struct disprm *dis)
Default constructor for the disprm struct.
int diswarp(struct disprm *dis, const double pixblc[], const double pixtrc[], const double pixsamp[], int *nsamp, double maxdis[], double *maxtot, double avgdis[], double *avgtot, double rmsdis[], double *rmstot)
Compute measures of distortion.
int disndp(int n)
Memory allocation for DPja and DQia.
int dishdo(struct disprm *dis)
write FITS headers using TPD.
int disx2p(struct disprm *dis, const double discrd[], double rawcrd[])
Apply de-distortion function.
#define DISX2P_ARGS
Definition dis.h:1113
int disperr(const struct disprm *dis, const char *prefix)
Print error messages from a disprm struct.
int disset(struct disprm *dis)
Setup routine for the disprm struct.
int disenq(const struct disprm *dis, int enquiry)
enquire about the state of a disprm struct.
int disprt(const struct disprm *dis)
Print routine for the disprm struct.
Distortion parameters.
Definition dis.h:1132
double totdis
Definition dis.h:1145
int ** iparm
Definition dis.h:1157
double ** scale
Definition dis.h:1156
int naxis
Definition dis.h:1139
struct wcserr * err
Definition dis.h:1166
char(* dtype)[72]
Definition dis.h:1141
int flag
Definition dis.h:1135
double * m_maxdis
Definition dis.h:1176
int i_naxis
Definition dis.h:1161
int(** disp2x)(DISP2X_ARGS)
Definition dis.h:1170
int ndpmax
Definition dis.h:1143
int m_naxis
Definition dis.h:1173
struct dpkey * dp
Definition dis.h:1144
int ndis
Definition dis.h:1162
int * docorr
Definition dis.h:1150
double ** offset
Definition dis.h:1155
char(* m_dtype)[72]
Definition dis.h:1174
double ** dparm
Definition dis.h:1159
int ** axmap
Definition dis.h:1154
struct dpkey * m_dp
Definition dis.h:1175
double * maxdis
Definition dis.h:1146
int ndp
Definition dis.h:1142
int(** disx2p)(DISX2P_ARGS)
Definition dis.h:1171
int * Nhat
Definition dis.h:1151
int m_flag
Definition dis.h:1173
Store for DPja and DQia keyvalues.
Definition dis.h:1118
union dpkey::@0 value
int i
Definition dis.h:1123
char field[72]
Definition dis.h:1119
int type
Definition dis.h:1121
int j
Definition dis.h:1120
double f
Definition dis.h:1124
Error message handling.
Definition wcserr.h:243