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