WCSLIB: dis.h Source File

WCSLIB 7.4

dis.h
Go to the documentation of this file.
1 /*============================================================================
2 WCSLIB 7.4 - an implementation of the FITS WCS standard.
3 Copyright (C) 1995-2021, 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 7.4 2021/01/31 02:24:51 mcalabre Exp $
23 *=============================================================================
24 *
25 * WCSLIB 7.4 - 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, and another, disprt(), prints its contents.
341 *
342 * disperr() prints the error message(s) (if any) stored in a disprm struct.
343 *
344 * wcshdo() normally writes SIP and TPV headers in their native form if at all
345 * possible. However, dishdo() may be used to set a flag that tells it to
346 * write the header in the form of the TPD translation used internally.
347 *
348 * A setup routine, disset(), computes intermediate values in the disprm struct
349 * from parameters in it that were supplied by the user. The struct always
350 * needs to be set up by disset(), though disset() need not be called
351 * explicitly - refer to the explanation of disprm::flag.
352 *
353 * disp2x() and disx2p() implement the WCS distortion functions, disp2x() using
354 * separate functions, such as dispoly() and tpd7(), to do the computation.
355 *
356 * An auxiliary routine, diswarp(), computes various measures of the distortion
357 * over a specified range of coordinates.
358 *
359 * PLEASE NOTE: Distortions are not yet handled by wcsbth(), or wcscompare().
360 *
361 *
362 * disndp() - Memory allocation for DPja and DQia
363 * ----------------------------------------------
364 * disndp() sets or gets the value of NDPMAX (default 256). This global
365 * variable controls the maximum number of dpkey structs, for holding DPja or
366 * DQia keyvalues, that disini() should allocate space for. It is also used by
367 * disinit() as the default value of ndpmax.
368 *
369 * PLEASE NOTE: This function is not thread-safe.
370 *
371 * Given:
372 * n int Value of NDPMAX; ignored if < 0. Use a value less
373 * than zero to get the current value.
374 *
375 * Function return value:
376 * int Current value of NDPMAX.
377 *
378 *
379 * dpfill() - Fill the contents of a dpkey struct
380 * ----------------------------------------------
381 * dpfill() is a utility routine to aid in filling the contents of the dpkey
382 * struct. No checks are done on the validity of the inputs.
383 *
384 * WCS Paper IV specifies the syntax of a record-valued keyword as
385 *
386 = keyword = '<field-specifier>: <float>'
387 *
388 * However, some DPja and DQia record values, such as those of DPja.NAXES and
389 * DPja.AXIS.j, are intrinsically integer-valued. While FITS header parsers
390 * are not expected to know in advance which of DPja and DQia are integral and
391 * which are floating point, if the record's value parses as an integer (i.e.
392 * without decimal point or exponent), then preferably enter it into the dpkey
393 * struct as an integer. Either way, it doesn't matter as disset() accepts
394 * either data type for all record values.
395 *
396 * Given and returned:
397 * dp struct dpkey*
398 * Store for DPja and DQia keyvalues.
399 *
400 * Given:
401 * keyword const char *
402 * field const char *
403 * These arguments are concatenated with an intervening
404 * "." to construct the full record field name, i.e.
405 * including the keyword name, DPja or DQia (but
406 * excluding the colon delimiter which is NOT part of the
407 * name). Either may be given as a NULL pointer. Set
408 * both NULL to omit setting this component of the
409 * struct.
410 *
411 * j int Axis number (1-relative), i.e. the j in DPja or
412 * i in DQia. Can be given as 0, in which case the axis
413 * number will be obtained from the keyword component of
414 * the field name which must either have been given or
415 * preset.
416 *
417 * If j is non-zero, and keyword was given, then the
418 * value of j will be used to fill in the axis number.
419 *
420 * type int Data type of the record's value
421 * 0: Integer,
422 * 1: Floating point.
423 *
424 * i int For type == 0, the integer value of the record.
425 *
426 * f double For type == 1, the floating point value of the record.
427 *
428 * Function return value:
429 * int Status return value:
430 * 0: Success.
431 *
432 *
433 * dpkeyi() - Get the data value in a dpkey struct as int
434 * ------------------------------------------------------
435 * dpkeyi() returns the data value in a dpkey struct as an integer value.
436 *
437 * Given and returned:
438 * dp const struct dpkey *
439 * Parsed contents of a DPja or DQia keyrecord.
440 *
441 * Function return value:
442 * int The record's value as int.
443 *
444 *
445 * dpkeyd() - Get the data value in a dpkey struct as double
446 * ---------------------------------------------------------
447 * dpkeyd() returns the data value in a dpkey struct as a floating point
448 * value.
449 *
450 * Given and returned:
451 * dp const struct dpkey *
452 * Parsed contents of a DPja or DQia keyrecord.
453 *
454 * Function return value:
455 * double The record's value as double.
456 *
457 *
458 * disini() - Default constructor for the disprm struct
459 * ----------------------------------------------------
460 * disini() is a thin wrapper on disinit(). It invokes it with ndpmax set
461 * to -1 which causes it to use the value of the global variable NDPMAX. It
462 * is thereby potentially thread-unsafe if NDPMAX is altered dynamically via
463 * disndp(). Use disinit() for a thread-safe alternative in this case.
464 *
465 *
466 * disinit() - Default constructor for the disprm struct
467 * ----------------------------------------------------
468 * disinit() allocates memory for arrays in a disprm struct and sets all
469 * members of the struct to default values.
470 *
471 * PLEASE NOTE: every disprm struct must be initialized by disinit(), possibly
472 * repeatedly. On the first invokation, and only the first invokation,
473 * disprm::flag must be set to -1 to initialize memory management, regardless
474 * of whether disinit() will actually be used to allocate memory.
475 *
476 * Given:
477 * alloc int If true, allocate memory unconditionally for arrays in
478 * the disprm struct.
479 *
480 * If false, it is assumed that pointers to these arrays
481 * have been set by the user except if they are null
482 * pointers in which case memory will be allocated for
483 * them regardless. (In other words, setting alloc true
484 * saves having to initalize these pointers to zero.)
485 *
486 * naxis int The number of world coordinate axes, used to determine
487 * array sizes.
488 *
489 * Given and returned:
490 * dis struct disprm*
491 * Distortion function parameters. Note that, in order
492 * to initialize memory management disprm::flag must be
493 * set to -1 when dis is initialized for the first time
494 * (memory leaks may result if it had already been
495 * initialized).
496 *
497 * Given:
498 * ndpmax int The number of DPja or DQia keywords to allocate space
499 * for. If set to -1, the value of the global variable
500 * NDPMAX will be used. This is potentially
501 * thread-unsafe if disndp() is being used dynamically to
502 * alter its value.
503 *
504 * Function return value:
505 * int Status return value:
506 * 0: Success.
507 * 1: Null disprm pointer passed.
508 * 2: Memory allocation failed.
509 *
510 * For returns > 1, a detailed error message is set in
511 * disprm::err if enabled, see wcserr_enable().
512 *
513 *
514 * discpy() - Copy routine for the disprm struct
515 * ---------------------------------------------
516 * discpy() does a deep copy of one disprm struct to another, using disinit()
517 * to allocate memory unconditionally for its arrays if required. Only the
518 * "information to be provided" part of the struct is copied; a call to
519 * disset() is required to initialize the remainder.
520 *
521 * Given:
522 * alloc int If true, allocate memory unconditionally for arrays in
523 * the destination. Otherwise, it is assumed that
524 * pointers to these arrays have been set by the user
525 * except if they are null pointers in which case memory
526 * will be allocated for them regardless.
527 *
528 * dissrc const struct disprm*
529 * Struct to copy from.
530 *
531 * Given and returned:
532 * disdst struct disprm*
533 * Struct to copy to. disprm::flag should be set to -1
534 * if disdst was not previously initialized (memory leaks
535 * may result if it was previously initialized).
536 *
537 * Function return value:
538 * int Status return value:
539 * 0: Success.
540 * 1: Null disprm pointer passed.
541 * 2: Memory allocation failed.
542 *
543 * For returns > 1, a detailed error message is set in
544 * disprm::err if enabled, see wcserr_enable().
545 *
546 *
547 * disfree() - Destructor for the disprm struct
548 * --------------------------------------------
549 * disfree() frees memory allocated for the disprm arrays by disinit().
550 * disinit() keeps a record of the memory it allocates and disfree() will only
551 * attempt to free this.
552 *
553 * PLEASE NOTE: disfree() must not be invoked on a disprm struct that was not
554 * initialized by disinit().
555 *
556 * Given:
557 * dis struct disprm*
558 * Distortion function parameters.
559 *
560 * Function return value:
561 * int Status return value:
562 * 0: Success.
563 * 1: Null disprm pointer passed.
564 *
565 *
566 * disprt() - Print routine for the disprm struct
567 * ----------------------------------------------
568 * disprt() prints the contents of a disprm struct using wcsprintf(). Mainly
569 * intended for diagnostic purposes.
570 *
571 * Given:
572 * dis const struct disprm*
573 * Distortion function parameters.
574 *
575 * Function return value:
576 * int Status return value:
577 * 0: Success.
578 * 1: Null disprm pointer passed.
579 *
580 *
581 * disperr() - Print error messages from a disprm struct
582 * -----------------------------------------------------
583 * disperr() prints the error message(s) (if any) stored in a disprm struct.
584 * If there are no errors then nothing is printed. It uses wcserr_prt(), q.v.
585 *
586 * Given:
587 * dis const struct disprm*
588 * Distortion function parameters.
589 *
590 * prefix const char *
591 * If non-NULL, each output line will be prefixed with
592 * this string.
593 *
594 * Function return value:
595 * int Status return value:
596 * 0: Success.
597 * 1: Null disprm pointer passed.
598 *
599 *
600 * dishdo() - write FITS headers using TPD
601 * ---------------------------------------
602 * dishdo() sets a flag that tells wcshdo() to write FITS headers in the form
603 * of the TPD translation used internally. Normally SIP and TPV would be
604 * written in their native form if at all possible.
605 *
606 * Given and returned:
607 * dis struct disprm*
608 * Distortion function parameters.
609 *
610 * Function return value:
611 * int Status return value:
612 * 0: Success.
613 * 1: Null disprm pointer passed.
614 * 3: No TPD translation.
615 *
616 *
617 * disset() - Setup routine for the disprm struct
618 * ----------------------------------------------
619 * disset(), sets up the disprm struct according to information supplied within
620 * it - refer to the explanation of disprm::flag.
621 *
622 * Note that this routine need not be called directly; it will be invoked by
623 * disp2x() and disx2p() if the disprm::flag is anything other than a
624 * predefined magic value.
625 *
626 * Given and returned:
627 * dis struct disprm*
628 * Distortion function parameters.
629 *
630 * Function return value:
631 * int Status return value:
632 * 0: Success.
633 * 1: Null disprm pointer passed.
634 * 2: Memory allocation failed.
635 * 3: Invalid parameter.
636 *
637 * For returns > 1, a detailed error message is set in
638 * disprm::err if enabled, see wcserr_enable().
639 *
640 *
641 * disp2x() - Apply distortion function
642 * ------------------------------------
643 * disp2x() applies the distortion functions. By definition, the distortion
644 * is in the pixel-to-world direction.
645 *
646 * Depending on the point in the algorithm chain at which it is invoked,
647 * disp2x() may transform pixel coordinates to corrected pixel coordinates, or
648 * intermediate pixel coordinates to corrected intermediate pixel coordinates,
649 * or image coordinates to corrected image coordinates.
650 *
651 *
652 * Given and returned:
653 * dis struct disprm*
654 * Distortion function parameters.
655 *
656 * Given:
657 * rawcrd const double[naxis]
658 * Array of coordinates.
659 *
660 * Returned:
661 * discrd double[naxis]
662 * Array of coordinates to which the distortion functions
663 * have been applied.
664 *
665 * Function return value:
666 * int Status return value:
667 * 0: Success.
668 * 1: Null disprm pointer passed.
669 * 2: Memory allocation failed.
670 * 3: Invalid parameter.
671 * 4: Distort error.
672 *
673 * For returns > 1, a detailed error message is set in
674 * disprm::err if enabled, see wcserr_enable().
675 *
676 *
677 * disx2p() - Apply de-distortion function
678 * ---------------------------------------
679 * disx2p() applies the inverse of the distortion functions. By definition,
680 * the de-distortion is in the world-to-pixel direction.
681 *
682 * Depending on the point in the algorithm chain at which it is invoked,
683 * disx2p() may transform corrected pixel coordinates to pixel coordinates, or
684 * corrected intermediate pixel coordinates to intermediate pixel coordinates,
685 * or corrected image coordinates to image coordinates.
686 *
687 * disx2p() iteratively solves for the inverse using disp2x(). It assumes
688 * that the distortion is small and the functions are well-behaved, being
689 * continuous and with continuous derivatives. Also that, to first order
690 * in the neighbourhood of the solution, discrd[j] ~= a + b*rawcrd[j], i.e.
691 * independent of rawcrd[i], where i != j. This is effectively equivalent to
692 * assuming that the distortion functions are separable to first order.
693 * Furthermore, a is assumed to be small, and b close to unity.
694 *
695 * If disprm::disx2p() is defined, then disx2p() uses it to provide an initial
696 * estimate for its more precise iterative inversion.
697 *
698 * Given and returned:
699 * dis struct disprm*
700 * Distortion function parameters.
701 *
702 * Given:
703 * discrd const double[naxis]
704 * Array of coordinates.
705 *
706 * Returned:
707 * rawcrd double[naxis]
708 * Array of coordinates to which the inverse distortion
709 * functions have been applied.
710 *
711 * Function return value:
712 * int Status return value:
713 * 0: Success.
714 * 1: Null disprm pointer passed.
715 * 2: Memory allocation failed.
716 * 3: Invalid parameter.
717 * 5: De-distort error.
718 *
719 * For returns > 1, a detailed error message is set in
720 * disprm::err if enabled, see wcserr_enable().
721 *
722 *
723 * diswarp() - Compute measures of distortion
724 * ------------------------------------------
725 * diswarp() computes various measures of the distortion over a specified range
726 * of coordinates.
727 *
728 * For prior distortions, the measures may be interpreted simply as an offset
729 * in pixel coordinates. For sequent distortions, the interpretation depends
730 * on the nature of the linear transformation matrix (PCi_ja or CDi_ja). If
731 * the latter introduces a scaling, then the measures will also be scaled.
732 * Note also that the image domain, which is rectangular in pixel coordinates,
733 * may be rotated, skewed, and/or stretched in intermediate pixel coordinates,
734 * and in general cannot be defined using pixblc[] and pixtrc[].
735 *
736 * PLEASE NOTE: the measures of total distortion may be essentially meaningless
737 * if there are multiple sequent distortions with different scaling.
738 *
739 * See also linwarp().
740 *
741 * Given and returned:
742 * dis struct disprm*
743 * Distortion function parameters.
744 *
745 * Given:
746 * pixblc const double[naxis]
747 * Start of the range of pixel coordinates (for prior
748 * distortions), or intermediate pixel coordinates (for
749 * sequent distortions). May be specified as a NULL
750 * pointer which is interpreted as (1,1,...).
751 *
752 * pixtrc const double[naxis]
753 * End of the range of pixel coordinates (prior) or
754 * intermediate pixel coordinates (sequent).
755 *
756 * pixsamp const double[naxis]
757 * If positive or zero, the increment on the particular
758 * axis, starting at pixblc[]. Zero is interpreted as a
759 * unit increment. pixsamp may also be specified as a
760 * NULL pointer which is interpreted as all zeroes, i.e.
761 * unit increments on all axes.
762 *
763 * If negative, the grid size on the particular axis (the
764 * absolute value being rounded to the nearest integer).
765 * For example, if pixsamp is (-128.0,-128.0,...) then
766 * each axis will be sampled at 128 points between
767 * pixblc[] and pixtrc[] inclusive. Use caution when
768 * using this option on non-square images.
769 *
770 * Returned:
771 * nsamp int* The number of pixel coordinates sampled.
772 *
773 * Can be specified as a NULL pointer if not required.
774 *
775 * maxdis double[naxis]
776 * For each individual distortion function, the
777 * maximum absolute value of the distortion.
778 *
779 * Can be specified as a NULL pointer if not required.
780 *
781 * maxtot double* For the combination of all distortion functions, the
782 * maximum absolute value of the distortion.
783 *
784 * Can be specified as a NULL pointer if not required.
785 *
786 * avgdis double[naxis]
787 * For each individual distortion function, the
788 * mean value of the distortion.
789 *
790 * Can be specified as a NULL pointer if not required.
791 *
792 * avgtot double* For the combination of all distortion functions, the
793 * mean value of the distortion.
794 *
795 * Can be specified as a NULL pointer if not required.
796 *
797 * rmsdis double[naxis]
798 * For each individual distortion function, the
799 * root mean square deviation of the distortion.
800 *
801 * Can be specified as a NULL pointer if not required.
802 *
803 * rmstot double* For the combination of all distortion functions, the
804 * root mean square deviation of the distortion.
805 *
806 * Can be specified as a NULL pointer if not required.
807 *
808 * Function return value:
809 * int Status return value:
810 * 0: Success.
811 * 1: Null disprm pointer passed.
812 * 2: Memory allocation failed.
813 * 3: Invalid parameter.
814 * 4: Distort error.
815 *
816 *
817 * disprm struct - Distortion parameters
818 * -------------------------------------
819 * The disprm struct contains all of the information required to apply a set of
820 * distortion functions. It consists of certain members that must be set by
821 * the user ("given") and others that are set by the WCSLIB routines
822 * ("returned"). While the addresses of the arrays themselves may be set by
823 * disinit() if it (optionally) allocates memory, their contents must be set by
824 * the user.
825 *
826 * int flag
827 * (Given and returned) This flag must be set to zero whenever any of the
828 * following members of the disprm struct are set or modified:
829 *
830 * - disprm::naxis,
831 * - disprm::dtype,
832 * - disprm::ndp,
833 * - disprm::dp.
834 *
835 * This signals the initialization routine, disset(), to recompute the
836 * returned members of the disprm struct. disset() will reset flag to
837 * indicate that this has been done.
838 *
839 * PLEASE NOTE: flag must be set to -1 when disinit() is called for the
840 * first time for a particular disprm struct in order to initialize memory
841 * management. It must ONLY be used on the first initialization otherwise
842 * memory leaks may result.
843 *
844 * int naxis
845 * (Given or returned) Number of pixel and world coordinate elements.
846 *
847 * If disinit() is used to initialize the disprm struct (as would normally
848 * be the case) then it will set naxis from the value passed to it as a
849 * function argument. The user should not subsequently modify it.
850 *
851 * char (*dtype)[72]
852 * (Given) Pointer to the first element of an array of char[72] containing
853 * the name of the distortion function for each axis.
854 *
855 * int ndp
856 * (Given) The number of entries in the disprm::dp[] array.
857 *
858 * int ndpmax
859 * (Given) The length of the disprm::dp[] array.
860 *
861 * ndpmax will be set by disinit() if it allocates memory for disprm::dp[],
862 * otherwise it must be set by the user. See also disndp().
863 *
864 * struct dpkey dp
865 * (Given) Address of the first element of an array of length ndpmax of
866 * dpkey structs.
867 *
868 * As a FITS header parser encounters each DPja or DQia keyword it should
869 * load it into a dpkey struct in the array and increment ndp. However,
870 * note that a single disprm struct must hold only DPja or DQia keyvalues,
871 * not both. disset() interprets them as required by the particular
872 * distortion function.
873 *
874 * double *maxdis
875 * (Given) Pointer to the first element of an array of double specifying
876 * the maximum absolute value of the distortion for each axis computed over
877 * the whole image.
878 *
879 * It is not necessary to reset the disprm struct (via disset()) when
880 * disprm::maxdis is changed.
881 *
882 * double totdis
883 * (Given) The maximum absolute value of the combination of all distortion
884 * functions specified as an offset in pixel coordinates computed over the
885 * whole image.
886 *
887 * It is not necessary to reset the disprm struct (via disset()) when
888 * disprm::totdis is changed.
889 *
890 * int *docorr
891 * (Returned) Pointer to the first element of an array of int containing
892 * flags that indicate the mode of correction for each axis.
893 *
894 * If docorr is zero, the distortion function returns the corrected
895 * coordinates directly. Any other value indicates that the distortion
896 * function computes a correction to be added to pixel coordinates (prior
897 * distortion) or intermediate pixel coordinates (sequent distortion).
898 *
899 * int *Nhat
900 * (Returned) Pointer to the first element of an array of int containing
901 * the number of coordinate axes that form the independent variables of the
902 * distortion function for each axis.
903 *
904 * int **axmap
905 * (Returned) Pointer to the first element of an array of int* containing
906 * pointers to the first elements of the axis mapping arrays for each axis.
907 *
908 * An axis mapping associates the independent variables of a distortion
909 * function with the 0-relative image axis number. For example, consider
910 * an image with a spectrum on the first axis (axis 0), followed by RA
911 * (axis 1), Dec (axis2), and time (axis 3) axes. For a distortion in
912 * (RA,Dec) and no distortion on the spectral or time axes, the axis
913 * mapping arrays, axmap[j][], would be
914 *
915 = j=0: [-1, -1, -1, -1] ...no distortion on spectral axis,
916 = 1: [ 1, 2, -1, -1] ...RA distortion depends on RA and Dec,
917 = 2: [ 2, 1, -1, -1] ...Dec distortion depends on Dec and RA,
918 = 3: [-1, -1, -1, -1] ...no distortion on time axis,
919 *
920 * where -1 indicates that there is no corresponding independent
921 * variable.
922 *
923 * double **offset
924 * (Returned) Pointer to the first element of an array of double*
925 * containing pointers to the first elements of arrays of offsets used to
926 * renormalize the independent variables of the distortion function for
927 * each axis.
928 *
929 * The offsets are subtracted from the independent variables before
930 * scaling.
931 *
932 * double **scale
933 * (Returned) Pointer to the first element of an array of double*
934 * containing pointers to the first elements of arrays of scales used to
935 * renormalize the independent variables of the distortion function for
936 * each axis.
937 *
938 * The scale is applied to the independent variables after the offsets are
939 * subtracted.
940 *
941 * int **iparm
942 * (Returned) Pointer to the first element of an array of int*
943 * containing pointers to the first elements of the arrays of integer
944 * distortion parameters for each axis.
945 *
946 * double **dparm
947 * (Returned) Pointer to the first element of an array of double*
948 * containing pointers to the first elements of the arrays of floating
949 * point distortion parameters for each axis.
950 *
951 * int i_naxis
952 * (Returned) Dimension of the internal arrays (normally equal to naxis).
953 *
954 * int ndis
955 * (Returned) The number of distortion functions.
956 *
957 * struct wcserr *err
958 * (Returned) If enabled, when an error status is returned, this struct
959 * contains detailed information about the error, see wcserr_enable().
960 *
961 * int (**disp2x)(DISP2X_ARGS)
962 * (For internal use only.)
963 * int (**disx2p)(DISX2P_ARGS)
964 * (For internal use only.)
965 * double *tmpmem
966 * (For internal use only.)
967 * int m_flag
968 * (For internal use only.)
969 * int m_naxis
970 * (For internal use only.)
971 * char (*m_dtype)[72]
972 * (For internal use only.)
973 * double **m_dp
974 * (For internal use only.)
975 * double *m_maxdis
976 * (For internal use only.)
977 *
978 *
979 * dpkey struct - Store for DPja and DQia keyvalues
980 * ------------------------------------------------
981 * The dpkey struct is used to pass the parsed contents of DPja or DQia
982 * keyrecords to disset() via the disprm struct. A disprm struct must hold
983 * only DPja or DQia keyvalues, not both.
984 *
985 * All members of this struct are to be set by the user.
986 *
987 * char field[72]
988 * (Given) The full field name of the record, including the keyword name.
989 * Note that the colon delimiter separating the field name and the value in
990 * record-valued keyvalues is not part of the field name. For example, in
991 * the following:
992 *
993 = DP3A = 'AXIS.1: 2'
994 *
995 * the full record field name is "DP3A.AXIS.1", and the record's value
996 * is 2.
997 *
998 * int j
999 * (Given) Axis number (1-relative), i.e. the j in DPja or i in DQia.
1000 *
1001 * int type
1002 * (Given) The data type of the record's value
1003 * - 0: Integer (stored as an int),
1004 * - 1: Floating point (stored as a double).
1005 *
1006 * union value
1007 * (Given) A union comprised of
1008 * - dpkey::i,
1009 * - dpkey::f,
1010 *
1011 * the record's value.
1012 *
1013 *
1014 * Global variable: const char *dis_errmsg[] - Status return messages
1015 * ------------------------------------------------------------------
1016 * Error messages to match the status value returned from each function.
1017 *
1018 *===========================================================================*/
1019
1020 #ifndef WCSLIB_DIS
1021 #define WCSLIB_DIS
1022
1023 #ifdef __cplusplus
1024 extern "C" {
1025 #endif
1026
1027
1028 extern const char *dis_errmsg[];
1029
1030 enum dis_errmsg_enum {
1031 DISERR_SUCCESS = 0, // Success.
1032 DISERR_NULL_POINTER = 1, // Null disprm pointer passed.
1033 DISERR_MEMORY = 2, // Memory allocation failed.
1034 DISERR_BAD_PARAM = 3, // Invalid parameter value.
1035 DISERR_DISTORT = 4, // Distortion error.
1036 DISERR_DEDISTORT = 5 // De-distortion error.
1037 };
1038
1039 // For use in declaring distortion function prototypes (= DISX2P_ARGS).
1040 #define DISP2X_ARGS int inverse, const int iparm[], const double dparm[], \
1041 int ncrd, const double rawcrd[], double *discrd
1042
1043 // For use in declaring de-distortion function prototypes (= DISP2X_ARGS).
1044 #define DISX2P_ARGS int inverse, const int iparm[], const double dparm[], \
1045 int ncrd, const double discrd[], double *rawcrd
1046
1047
1048 // Struct used for storing DPja and DQia keyvalues.
1049 struct dpkey {
1050 char field[72]; // Full record field name (no colon).
1051 int j; // Axis number, as in DPja (1-relative).
1052 int type; // Data type of value.
1053 union {
1054 int i; // Integer record value.
1055 double f; // Floating point record value.
1056 } value; // Record value.
1057 };
1058
1059 // Size of the dpkey struct in int units, used by the Fortran wrappers.
1060 #define DPLEN (sizeof(struct dpkey)/sizeof(int))
1061
1062
1063 struct disprm {
1064 // Initialization flag (see the prologue above).
1065 //--------------------------------------------------------------------------
1066 int flag; // Set to zero to force initialization.
1067
1068 // Parameters to be provided (see the prologue above).
1069 //--------------------------------------------------------------------------
1070 int naxis; // The number of pixel coordinate elements,
1071 // given by NAXIS.
1072 char (*dtype)[72]; // For each axis, the distortion type.
1073 int ndp; // Number of DPja or DQia keywords, and the
1074 int ndpmax; // number for which space was allocated.
1075 struct dpkey *dp; // DPja or DQia keyvalues (not both).
1076 double *maxdis; // For each axis, the maximum distortion.
1077 double totdis; // The maximum combined distortion.
1078
1079 // Information derived from the parameters supplied.
1080 //--------------------------------------------------------------------------
1081 int *docorr; // For each axis, the mode of correction.
1082 int *Nhat; // For each axis, the number of coordinate
1083 // axes that form the independent variables
1084 // of the distortion function.
1085 int **axmap; // For each axis, the axis mapping array.
1086 double **offset; // For each axis, renormalization offsets.
1087 double **scale; // For each axis, renormalization scales.
1088 int **iparm; // For each axis, the array of integer
1089 // distortion parameters.
1090 double **dparm; // For each axis, the array of floating
1091 // point distortion parameters.
1092 int i_naxis; // Dimension of the internal arrays.
1093 int ndis; // The number of distortion functions.
1094
1095 // Error handling, if enabled.
1096 //--------------------------------------------------------------------------
1097 struct wcserr *err;
1098
1099 // Private - the remainder are for internal use.
1100 //--------------------------------------------------------------------------
1101 int (**disp2x)(DISP2X_ARGS); // For each axis, pointers to the
1102 int (**disx2p)(DISX2P_ARGS); // distortion function and its inverse.
1103
1104 double *tmpmem;
1105
1106 int m_flag, m_naxis; // The remainder are for memory management.
1107 char (*m_dtype)[72];
1108 struct dpkey *m_dp;
1109 double *m_maxdis;
1110 };
1111
1112 // Size of the disprm struct in int units, used by the Fortran wrappers.
1113 #define DISLEN (sizeof(struct disprm)/sizeof(int))
1114
1115
1116 int disndp(int n);
1117
1118 int dpfill(struct dpkey *dp, const char *keyword, const char *field, int j,
1119 int type, int i, double f);
1120
1121 int dpkeyi(const struct dpkey *dp);
1122
1123 double dpkeyd(const struct dpkey *dp);
1124
1125 int disini(int alloc, int naxis, struct disprm *dis);
1126
1127 int disinit(int alloc, int naxis, struct disprm *dis, int ndpmax);
1128
1129 int discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst);
1130
1131 int disfree(struct disprm *dis);
1132
1133 int disprt(const struct disprm *dis);
1134
1135 int disperr(const struct disprm *dis, const char *prefix);
1136
1137 int dishdo(struct disprm *dis);
1138
1139 int disset(struct disprm *dis);
1140
1141 int disp2x(struct disprm *dis, const double rawcrd[], double discrd[]);
1142
1143 int disx2p(struct disprm *dis, const double discrd[], double rawcrd[]);
1144
1145 int diswarp(struct disprm *dis, const double pixblc[], const double pixtrc[],
1146 const double pixsamp[], int *nsamp,
1147 double maxdis[], double *maxtot,
1148 double avgdis[], double *avgtot,
1149 double rmsdis[], double *rmstot);
1150
1151 #ifdef __cplusplus
1152 }
1153 #endif
1154
1155 #endif // WCSLIB_DIS
disp2x
int disp2x(struct disprm *dis, const double rawcrd[], double discrd[])
Apply distortion function.
dpkeyd
double dpkeyd(const struct dpkey *dp)
Get the data value in a dpkey struct as double.
DISP2X_ARGS
#define DISP2X_ARGS
Definition: dis.h:1040
dis_errmsg_enum
dis_errmsg_enum
Definition: dis.h:1030
DISERR_MEMORY
@ DISERR_MEMORY
Definition: dis.h:1033
DISERR_NULL_POINTER
@ DISERR_NULL_POINTER
Definition: dis.h:1032
DISERR_DEDISTORT
@ DISERR_DEDISTORT
Definition: dis.h:1036
DISERR_BAD_PARAM
@ DISERR_BAD_PARAM
Definition: dis.h:1034
DISERR_DISTORT
@ DISERR_DISTORT
Definition: dis.h:1035
DISERR_SUCCESS
@ DISERR_SUCCESS
Definition: dis.h:1031
disinit
int disinit(int alloc, int naxis, struct disprm *dis, int ndpmax)
Default constructor for the disprm struct.
discpy
int discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst)
Copy routine for the disprm struct.
dpfill
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.
dpkeyi
int dpkeyi(const struct dpkey *dp)
Get the data value in a dpkey struct as int.
dis_errmsg
const char * dis_errmsg[]
Status return messages.
disfree
int disfree(struct disprm *dis)
Destructor for the disprm struct.
disini
int disini(int alloc, int naxis, struct disprm *dis)
Default constructor for the disprm struct.
diswarp
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.
disndp
int disndp(int n)
Memory allocation for DPja and DQia.
dishdo
int dishdo(struct disprm *dis)
write FITS headers using TPD.
disx2p
int disx2p(struct disprm *dis, const double discrd[], double rawcrd[])
Apply de-distortion function.
DISX2P_ARGS
#define DISX2P_ARGS
Definition: dis.h:1044
disperr
int disperr(const struct disprm *dis, const char *prefix)
Print error messages from a disprm struct.
disset
int disset(struct disprm *dis)
Setup routine for the disprm struct.
disprt
int disprt(const struct disprm *dis)
Print routine for the disprm struct.
disprm
Distortion parameters.
Definition: dis.h:1063
disprm::totdis
double totdis
Definition: dis.h:1077
disprm::iparm
int ** iparm
Definition: dis.h:1088
disprm::scale
double ** scale
Definition: dis.h:1087
disprm::naxis
int naxis
Definition: dis.h:1070
disprm::err
struct wcserr * err
Definition: dis.h:1097
disprm::dtype
char(* dtype)[72]
Definition: dis.h:1072
disprm::flag
int flag
Definition: dis.h:1066
disprm::m_maxdis
double * m_maxdis
Definition: dis.h:1109
disprm::i_naxis
int i_naxis
Definition: dis.h:1092
disprm::disp2x
int(** disp2x)(DISP2X_ARGS)
Definition: dis.h:1101
disprm::ndpmax
int ndpmax
Definition: dis.h:1074
disprm::m_naxis
int m_naxis
Definition: dis.h:1106
disprm::dp
struct dpkey * dp
Definition: dis.h:1075
disprm::tmpmem
double * tmpmem
Definition: dis.h:1104
disprm::ndis
int ndis
Definition: dis.h:1093
disprm::docorr
int * docorr
Definition: dis.h:1081
disprm::offset
double ** offset
Definition: dis.h:1086
disprm::m_dtype
char(* m_dtype)[72]
Definition: dis.h:1107
disprm::dparm
double ** dparm
Definition: dis.h:1090
disprm::axmap
int ** axmap
Definition: dis.h:1085
disprm::m_dp
struct dpkey * m_dp
Definition: dis.h:1108
disprm::maxdis
double * maxdis
Definition: dis.h:1076
disprm::ndp
int ndp
Definition: dis.h:1073
disprm::disx2p
int(** disx2p)(DISX2P_ARGS)
Definition: dis.h:1102
disprm::Nhat
int * Nhat
Definition: dis.h:1082
disprm::m_flag
int m_flag
Definition: dis.h:1106
dpkey
Store for DPja and DQia keyvalues.
Definition: dis.h:1049
dpkey::value
union dpkey::@0 value
dpkey::i
int i
Definition: dis.h:1054
dpkey::field
char field[72]
Definition: dis.h:1050
dpkey::type
int type
Definition: dis.h:1052
dpkey::j
int j
Definition: dis.h:1051
dpkey::f
double f
Definition: dis.h:1055
wcserr
Error message handling.
Definition: wcserr.h:220