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