WCSLIB: lin.h Source File

WCSLIB 5.15

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

lin.h
Go to the documentation of this file.
1 /*============================================================================
2
3 WCSLIB 5.15 - an implementation of the FITS WCS standard.
4 Copyright (C) 1995-2016, 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: lin.h,v 5.15 2016/04/05 12:55:10 mcalabre Exp $
26 *=============================================================================
27 *
28 * WCSLIB 5.15 - 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 lin routines
34 * ---------------------------
35 * Routines in this suite apply the linear transformation defined by the FITS
36 * World Coordinate System (WCS) standard, as described in
37 *
38 = "Representations of world coordinates in FITS",
39 = Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)
40 *
41 * These routines are based on the linprm struct which contains all information
42 * needed for the computations. The struct contains some members that must be
43 * set by the user, and others that are maintained by these routines, somewhat
44 * like a C++ class but with no encapsulation.
45 *
46 * Four routines, linini(), lindis(), lincpy(), and linfree() are provided to
47 * manage the linprm struct, and another, linprt(), prints its contents.
48 *
49 * linperr() prints the error message(s) (if any) stored in a linprm struct,
50 * and the disprm structs that it may contain.
51 *
52 * A setup routine, linset(), computes intermediate values in the linprm struct
53 * from parameters in it that were supplied by the user. The struct always
54 * needs to be set up by linset() but need not be called explicitly - refer to
55 * the explanation of linprm::flag.
56 *
57 * linp2x() and linx2p() implement the WCS linear transformations.
58 *
59 * An auxiliary routine, linwarp(), computes various measures of the distortion
60 * over a specified range of pixel coordinates.
61 *
62 * An auxiliary matrix inversion routine, matinv(), is included. It uses
63 * LU-triangular factorization with scaled partial pivoting.
64 *
65 *
66 * linini() - Default constructor for the linprm struct
67 * ----------------------------------------------------
68 * linini() allocates memory for arrays in a linprm struct and sets all members
69 * of the struct to default values.
70 *
71 * PLEASE NOTE: every linprm struct must be initialized by linini(), possibly
72 * repeatedly. On the first invokation, and only the first invokation,
73 * linprm::flag must be set to -1 to initialize memory management, regardless
74 * of whether linini() will actually be used to allocate memory.
75 *
76 * Given:
77 * alloc int If true, allocate memory unconditionally for arrays in
78 * the linprm struct.
79 *
80 * If false, it is assumed that pointers to these arrays
81 * have been set by the user except if they are null
82 * pointers in which case memory will be allocated for
83 * them regardless. (In other words, setting alloc true
84 * saves having to initalize these pointers to zero.)
85 *
86 * naxis int The number of world coordinate axes, used to determine
87 * array sizes.
88 *
89 * Given and returned:
90 * lin struct linprm*
91 * Linear transformation parameters. Note that, in order
92 * to initialize memory management linprm::flag should be
93 * set to -1 when lin is initialized for the first time
94 * (memory leaks may result if it had already been
95 * initialized).
96 *
97 * Function return value:
98 * int Status return value:
99 * 0: Success.
100 * 1: Null linprm pointer passed.
101 * 2: Memory allocation failed.
102 *
103 * For returns > 1, a detailed error message is set in
104 * linprm::err if enabled, see wcserr_enable().
105 *
106 *
107 * lindis() - Assign a distortion to a linprm struct
108 * -------------------------------------------------
109 * lindis() may be used to assign the address of a disprm struct to
110 * linprm::dispre or linprm::disseq. The linprm struct must already have been
111 * initialized by linini().
112 *
113 * The disprm struct must have been allocated from the heap (e.g. using
114 * malloc(), calloc(), etc.). lindis() will immediately initialize it via a
115 * call to disini() using the value of linprm::naxis. Subsequently, it will be
116 * reinitialized by calls to linini(), and freed by linfree(), neither of which
117 * would happen if the disprm struct was assigned directly.
118 *
119 * If the disprm struct had previously been assigned via lindis(), it will be
120 * freed before reassignment. It is also permissable for a null disprm pointer
121 * to be assigned to disable the distortion correction.
122 *
123 * Given:
124 * sequence int Is it a prior or sequent distortion?
125 * 1: Prior, the assignment is to linprm::dispre.
126 * 2: Sequent, the assignment is to linprm::disseq.
127 *
128 * Anything else is an error.
129 *
130 * Given and returned:
131 * lin struct linprm*
132 * Linear transformation parameters.
133 *
134 * dis struct disprm*
135 * Distortion function parameters.
136 *
137 * Function return value:
138 * int Status return value:
139 * 0: Success.
140 * 1: Null linprm pointer passed.
141 * 4: Invalid sequence.
142 *
143 *
144 * lincpy() - Copy routine for the linprm struct
145 * ---------------------------------------------
146 * lincpy() does a deep copy of one linprm struct to another, using linini() to
147 * allocate memory for its arrays if required. Only the "information to be
148 * provided" part of the struct is copied; a call to linset() is required to
149 * initialize the remainder.
150 *
151 * Given:
152 * alloc int If true, allocate memory for the crpix, pc, and cdelt
153 * arrays in the destination. Otherwise, it is assumed
154 * that pointers to these arrays have been set by the
155 * user except if they are null pointers in which case
156 * memory will be allocated for them regardless.
157 *
158 * linsrc const struct linprm*
159 * Struct to copy from.
160 *
161 * Given and returned:
162 * lindst struct linprm*
163 * Struct to copy to. linprm::flag should be set to -1
164 * if lindst was not previously initialized (memory leaks
165 * may result if it was previously initialized).
166 *
167 * Function return value:
168 * int Status return value:
169 * 0: Success.
170 * 1: Null linprm pointer passed.
171 * 2: Memory allocation failed.
172 *
173 * For returns > 1, a detailed error message is set in
174 * linprm::err if enabled, see wcserr_enable().
175 *
176 *
177 * linfree() - Destructor for the linprm struct
178 * --------------------------------------------
179 * linfree() frees memory allocated for the linprm arrays by linini() and/or
180 * linset(). linini() keeps a record of the memory it allocates and linfree()
181 * will only attempt to free this.
182 *
183 * PLEASE NOTE: linfree() must not be invoked on a linprm struct that was not
184 * initialized by linini().
185 *
186 * Given:
187 * lin struct linprm*
188 * Linear transformation parameters.
189 *
190 * Function return value:
191 * int Status return value:
192 * 0: Success.
193 * 1: Null linprm pointer passed.
194 *
195 *
196 * linprt() - Print routine for the linprm struct
197 * ----------------------------------------------
198 * linprt() prints the contents of a linprm struct using wcsprintf(). Mainly
199 * intended for diagnostic purposes.
200 *
201 * Given:
202 * lin const struct linprm*
203 * Linear transformation parameters.
204 *
205 * Function return value:
206 * int Status return value:
207 * 0: Success.
208 * 1: Null linprm pointer passed.
209 *
210 *
211 * linperr() - Print error messages from a linprm struct
212 * -----------------------------------------------------
213 * linperr() prints the error message(s) (if any) stored in a linprm struct,
214 * and the disprm structs that it may contain. If there are no errors then
215 * nothing is printed. It uses wcserr_prt(), q.v.
216 *
217 * Given:
218 * lin const struct linprm*
219 * Coordinate transformation parameters.
220 *
221 * prefix const char *
222 * If non-NULL, each output line will be prefixed with
223 * this string.
224 *
225 * Function return value:
226 * int Status return value:
227 * 0: Success.
228 * 1: Null linprm pointer passed.
229 *
230 *
231 * linset() - Setup routine for the linprm struct
232 * ----------------------------------------------
233 * linset(), if necessary, allocates memory for the linprm::piximg and
234 * linprm::imgpix arrays and sets up the linprm struct according to information
235 * supplied within it - refer to the explanation of linprm::flag.
236 *
237 * Note that this routine need not be called directly; it will be invoked by
238 * linp2x() and linx2p() if the linprm::flag is anything other than a
239 * predefined magic value.
240 *
241 * Given and returned:
242 * lin struct linprm*
243 * Linear transformation parameters.
244 *
245 * Function return value:
246 * int Status return value:
247 * 0: Success.
248 * 1: Null linprm pointer passed.
249 * 2: Memory allocation failed.
250 * 3: PCi_ja matrix is singular.
251 *
252 * For returns > 1, a detailed error message is set in
253 * linprm::err if enabled, see wcserr_enable().
254 *
255 *
256 * linp2x() - Pixel-to-world linear transformation
257 * -----------------------------------------------
258 * linp2x() transforms pixel coordinates to intermediate world coordinates.
259 *
260 * Given and returned:
261 * lin struct linprm*
262 * Linear transformation parameters.
263 *
264 * Given:
265 * ncoord,
266 * nelem int The number of coordinates, each of vector length nelem
267 * but containing lin.naxis coordinate elements.
268 *
269 * pixcrd const double[ncoord][nelem]
270 * Array of pixel coordinates.
271 *
272 * Returned:
273 * imgcrd double[ncoord][nelem]
274 * Array of intermediate world coordinates.
275 *
276 * Function return value:
277 * int Status return value:
278 * 0: Success.
279 * 1: Null linprm pointer passed.
280 * 2: Memory allocation failed.
281 * 3: PCi_ja matrix is singular.
282 *
283 * For returns > 1, a detailed error message is set in
284 * linprm::err if enabled, see wcserr_enable().
285 *
286 *
287 * linx2p() - World-to-pixel linear transformation
288 * -----------------------------------------------
289 * linx2p() transforms intermediate world coordinates to pixel coordinates.
290 *
291 * Given and returned:
292 * lin struct linprm*
293 * Linear transformation parameters.
294 *
295 * Given:
296 * ncoord,
297 * nelem int The number of coordinates, each of vector length nelem
298 * but containing lin.naxis coordinate elements.
299 *
300 * imgcrd const double[ncoord][nelem]
301 * Array of intermediate world coordinates.
302 *
303 * Returned:
304 * pixcrd double[ncoord][nelem]
305 * Array of pixel coordinates.
306 *
307 * int Status return value:
308 * 0: Success.
309 * 1: Null linprm pointer passed.
310 * 2: Memory allocation failed.
311 * 3: PCi_ja matrix is singular.
312 *
313 * For returns > 1, a detailed error message is set in
314 * linprm::err if enabled, see wcserr_enable().
315 *
316 *
317 * linwarp() - Compute measures of distortion
318 * ------------------------------------------
319 * linwarp() computes various measures of the distortion over a specified range
320 * of pixel coordinates.
321 *
322 * All distortion measures are specified as an offset in pixel coordinates,
323 * as given directly by prior distortions. The offset in intermediate pixel
324 * coordinates given by sequent distortions is translated back to pixel
325 * coordinates by applying the inverse of the linear transformation matrix
326 * (PCi_ja or CDi_ja). The difference may be significant if the matrix
327 * introduced a scaling.
328 *
329 * If all distortions are prior, then linwarp() uses diswarp(), q.v.
330 *
331 * Given and returned:
332 * lin struct linprm*
333 * Linear transformation parameters plus distortions.
334 *
335 * Given:
336 * pixblc const double[naxis]
337 * Start of the range of pixel coordinates (i.e. "bottom
338 * left-hand corner" in the conventional FITS image
339 * display orientation). May be specified as a NULL
340 * pointer which is interpreted as (1,1,...).
341 *
342 * pixtrc const double[naxis]
343 * End of the range of pixel coordinates (i.e. "top
344 * right-hand corner" in the conventional FITS image
345 * display orientation).
346 *
347 * pixsamp const double[naxis]
348 * If positive or zero, the increment on the particular
349 * axis, starting at pixblc[]. Zero is interpreted as a
350 * unit increment. pixsamp may also be specified as a
351 * NULL pointer which is interpreted as all zeroes, i.e.
352 * unit increments on all axes.
353 *
354 * If negative, the grid size on the particular axis (the
355 * absolute value being rounded to the nearest integer).
356 * For example, if pixsamp is (-128.0,-128.0,...) then
357 * each axis will be sampled at 128 points between
358 * pixblc[] and pixtrc[] inclusive. Use caution when
359 * using this option on non-square images.
360 *
361 * Returned:
362 * nsamp int* The number of pixel coordinates sampled.
363 *
364 * Can be specified as a NULL pointer if not required.
365 *
366 * maxdis double[naxis]
367 * For each individual distortion function, the
368 * maximum absolute value of the distortion.
369 *
370 * Can be specified as a NULL pointer if not required.
371 *
372 * maxtot double* For the combination of all distortion functions, the
373 * maximum absolute value of the distortion.
374 *
375 * Can be specified as a NULL pointer if not required.
376 *
377 * avgdis double[naxis]
378 * For each individual distortion function, the
379 * mean value of the distortion.
380 *
381 * Can be specified as a NULL pointer if not required.
382 *
383 * avgtot double* For the combination of all distortion functions, the
384 * mean value of the distortion.
385 *
386 * Can be specified as a NULL pointer if not required.
387 *
388 * rmsdis double[naxis]
389 * For each individual distortion function, the
390 * root mean square deviation of the distortion.
391 *
392 * Can be specified as a NULL pointer if not required.
393 *
394 * rmstot double* For the combination of all distortion functions, the
395 * root mean square deviation of the distortion.
396 *
397 * Can be specified as a NULL pointer if not required.
398 *
399 * Function return value:
400 * int Status return value:
401 * 0: Success.
402 * 1: Null linprm pointer passed.
403 * 2: Memory allocation failed.
404 * 3: Invalid parameter.
405 * 4: Distort error.
406 *
407 *
408 * linprm struct - Linear transformation parameters
409 * ------------------------------------------------
410 * The linprm struct contains all of the information required to perform a
411 * linear transformation. It consists of certain members that must be set by
412 * the user ("given") and others that are set by the WCSLIB routines
413 * ("returned").
414 *
415 * int flag
416 * (Given and returned) This flag must be set to zero whenever any of the
417 * following members of the linprm struct are set or modified:
418 *
419 * - linprm::naxis (q.v., not normally set by the user),
420 * - linprm::pc,
421 * - linprm::cdelt,
422 * - linprm::dispre.
423 * - linprm::disseq.
424 *
425 * This signals the initialization routine, linset(), to recompute the
426 * returned members of the linprm struct. linset() will reset flag to
427 * indicate that this has been done.
428 *
429 * PLEASE NOTE: flag should be set to -1 when linini() is called for the
430 * first time for a particular linprm struct in order to initialize memory
431 * management. It must ONLY be used on the first initialization otherwise
432 * memory leaks may result.
433 *
434 * int naxis
435 * (Given or returned) Number of pixel and world coordinate elements.
436 *
437 * If linini() is used to initialize the linprm struct (as would normally
438 * be the case) then it will set naxis from the value passed to it as a
439 * function argument. The user should not subsequently modify it.
440 *
441 * double *crpix
442 * (Given) Pointer to the first element of an array of double containing
443 * the coordinate reference pixel, CRPIXja.
444 *
445 * It is not necessary to reset the linprm struct (via linset()) when
446 * linprm::crpix is changed.
447 *
448 * double *pc
449 * (Given) Pointer to the first element of the PCi_ja (pixel coordinate)
450 * transformation matrix. The expected order is
451 *
452 = struct linprm lin;
453 = lin.pc = {PC1_1, PC1_2, PC2_1, PC2_2};
454 *
455 * This may be constructed conveniently from a 2-D array via
456 *
457 = double m[2][2] = {{PC1_1, PC1_2},
458 = {PC2_1, PC2_2}};
459 *
460 * which is equivalent to
461 *
462 = double m[2][2];
463 = m[0][0] = PC1_1;
464 = m[0][1] = PC1_2;
465 = m[1][0] = PC2_1;
466 = m[1][1] = PC2_2;
467 *
468 * The storage order for this 2-D array is the same as for the 1-D array,
469 * whence
470 *
471 = lin.pc = *m;
472 *
473 * would be legitimate.
474 *
475 * double *cdelt
476 * (Given) Pointer to the first element of an array of double containing
477 * the coordinate increments, CDELTia.
478 *
479 * struct disprm *dispre
480 * (Given) Pointer to a disprm struct holding parameters for prior
481 * distortion functions, or a null (0x0) pointer if there are none.
482 *
483 * Function lindis() may be used to assign a disprm pointer to a linprm
484 * struct, allowing it to take control of any memory allocated for it, as
485 * in the following example:
486 *
487 = void add_distortion(struct linprm *lin)
488 = {
489 = struct disprm *dispre;
490 =
491 = dispre = malloc(sizeof(struct disprm);
492 = dispre->flag = -1;
493 = lindis(1, lin, dispre);
494 = :
495 = (Set up dispre.)
496 = :
497 =
498 = return;
499 = }
500 *
501 * Here, after the distortion function parameters etc. are copied into
502 * dispre, dispre is assigned using lindis() which takes control of the
503 * allocated memory. It will be free'd later when linfree() is invoked on
504 * the linprm struct.
505 *
506 * Consider also the following erroneous code:
507 *
508 = void bad_code(struct linprm *lin)
509 = {
510 = struct disprm dispre;
511 =
512 = dispre.flag = -1;
513 = lindis(1, lin, &dispre); // WRONG.
514 = :
515 =
516 = return;
517 = }
518 *
519 * Here, dispre is declared as a struct, rather than a pointer. When the
520 * function returns, dispre will go out of scope and its memory will most
521 * likely be reused, thereby trashing its contents. Later, a segfault will
522 * occur when linfree() tries to free dispre's stale address.
523 *
524 * struct disprm *disseq
525 * (Given) Pointer to a disprm struct holding parameters for sequent
526 * distortion functions, or a null (0x0) pointer if there are none.
527 *
528 * Refer to the comments and examples given for disprm::dispre.
529 *
530 * double *piximg
531 * (Returned) Pointer to the first element of the matrix containing the
532 * product of the CDELTia diagonal matrix and the PCi_ja matrix.
533 *
534 * double *imgpix
535 * (Returned) Pointer to the first element of the inverse of the
536 * linprm::piximg matrix.
537 *
538 * int i_naxis
539 * (Returned) The dimension of linprm::piximg and linprm::imgpix (normally
540 * equal to naxis).
541 *
542 * int unity
543 * (Returned) True if the linear transformation matrix is unity.
544 *
545 * int affine
546 * (Returned) True if there are no distortions.
547 *
548 * int simple
549 * (Returned) True if unity and no distortions.
550 *
551 * struct wcserr *err
552 * (Returned) If enabled, when an error status is returned, this struct
553 * contains detailed information about the error, see wcserr_enable().
554 *
555 * double *tmpcrd
556 * (For internal use only.)
557 * int m_flag
558 * (For internal use only.)
559 * int m_naxis
560 * (For internal use only.)
561 * double *m_crpix
562 * (For internal use only.)
563 * double *m_pc
564 * (For internal use only.)
565 * double *m_cdelt
566 * (For internal use only.)
567 * struct disprm *m_dispre
568 * (For internal use only.)
569 * struct disprm *m_disseq
570 * (For internal use only.)
571 *
572 *
573 * Global variable: const char *lin_errmsg[] - Status return messages
574 * ------------------------------------------------------------------
575 * Error messages to match the status value returned from each function.
576 *
577 *===========================================================================*/
578
579 #ifndef WCSLIB_LIN
580 #define WCSLIB_LIN
581
582 #ifdef __cplusplus
583 extern "C" {
584 #endif
585
586
587 extern const char *lin_errmsg[];
588
589 enum lin_errmsg_enum {
590 LINERR_SUCCESS = 0, /* Success. */
591 LINERR_NULL_POINTER = 1, /* Null linprm pointer passed. */
592 LINERR_MEMORY = 2, /* Memory allocation failed. */
593 LINERR_SINGULAR_MTX = 3, /* PCi_ja matrix is singular. */
594 LINERR_DISTORT_INIT = 4, /* Failed to initialise distortions. */
595 LINERR_DISTORT = 5, /* Distort error. */
596 LINERR_DEDISTORT = 6 /* De-distort error. */
597 };
598
599 struct linprm {
600 /* Initialization flag (see the prologue above). */
601 /*------------------------------------------------------------------------*/
602 int flag; /* Set to zero to force initialization. */
603
604 /* Parameters to be provided (see the prologue above). */
605 /*------------------------------------------------------------------------*/
606 int naxis; /* The number of axes, given by NAXIS. */
607 double *crpix; /* CRPIXja keywords for each pixel axis. */
608 double *pc; /* PCi_ja linear transformation matrix. */
609 double *cdelt; /* CDELTia keywords for each coord axis. */
610 struct disprm *dispre; /* Prior distortion parameters, if any. */
611 struct disprm *disseq; /* Sequent distortion parameters, if any. */
612
613 /* Information derived from the parameters supplied. */
614 /*------------------------------------------------------------------------*/
615 double *piximg; /* Product of CDELTia and PCi_ja matrices. */
616 double *imgpix; /* Inverse of the piximg matrix. */
617 int i_naxis; /* Dimension of piximg and imgpix. */
618 int unity; /* True if the PCi_ja matrix is unity. */
619 int affine; /* True if there are no distortions. */
620 int simple; /* True if unity and no distortions. */
621
622 /* Error handling, if enabled. */
623 /*------------------------------------------------------------------------*/
624 struct wcserr *err;
625
626 /* Private - the remainder are for internal use. */
627 /*------------------------------------------------------------------------*/
628 double *tmpcrd;
629
630 int m_flag, m_naxis;
631 double *m_crpix, *m_pc, *m_cdelt;
632 struct disprm *m_dispre, *m_disseq;
633 };
634
635 /* Size of the linprm struct in int units, used by the Fortran wrappers. */
636 #define LINLEN (sizeof(struct linprm)/sizeof(int))
637
638
639 int linini(int alloc, int naxis, struct linprm *lin);
640
641 int lindis(int sequence, struct linprm *lin, struct disprm *dis);
642
643 int lincpy(int alloc, const struct linprm *linsrc, struct linprm *lindst);
644
645 int linfree(struct linprm *lin);
646
647 int linprt(const struct linprm *lin);
648
649 int linperr(const struct linprm *lin, const char *prefix);
650
651 int linset(struct linprm *lin);
652
653 int linp2x(struct linprm *lin, int ncoord, int nelem, const double pixcrd[],
654 double imgcrd[]);
655
656 int linx2p(struct linprm *lin, int ncoord, int nelem, const double imgcrd[],
657 double pixcrd[]);
658
659 int linwarp(struct linprm *lin, const double pixblc[], const double pixtrc[],
660 const double pixsamp[], int *nsamp,
661 double maxdis[], double *maxtot,
662 double avgdis[], double *avgtot,
663 double rmsdis[], double *rmstot);
664
665 int matinv(int n, const double mat[], double inv[]);
666
667
668 /* Deprecated. */
669 #define linini_errmsg lin_errmsg
670 #define lincpy_errmsg lin_errmsg
671 #define linfree_errmsg lin_errmsg
672 #define linprt_errmsg lin_errmsg
673 #define linset_errmsg lin_errmsg
674 #define linp2x_errmsg lin_errmsg
675 #define linx2p_errmsg lin_errmsg
676
677 #ifdef __cplusplus
678 }
679 #endif
680
681 #endif /* WCSLIB_LIN */
linprm::m_pc
double * m_pc
Definition: lin.h:631
linp2x
int linp2x(struct linprm *lin, int ncoord, int nelem, const double pixcrd[], double imgcrd[])
Pixel-to-world linear transformation.
linprm::dispre
struct disprm * dispre
Definition: lin.h:610
linprm::tmpcrd
double * tmpcrd
Definition: lin.h:628
LINERR_DEDISTORT
Definition: lin.h:596
linprm::naxis
int naxis
Definition: lin.h:606
linprm::crpix
double * crpix
Definition: lin.h:607
LINERR_MEMORY
Definition: lin.h:592
linprm::m_flag
int m_flag
Definition: lin.h:630
linprm::unity
int unity
Definition: lin.h:618
linprm::m_dispre
struct disprm * m_dispre
Definition: lin.h:632
wcserr
Error message handling.
Definition: wcserr.h:225
linprm::m_naxis
int m_naxis
Definition: lin.h:630
linprm::err
struct wcserr * err
Definition: lin.h:624
disprm::naxis
int naxis
Definition: dis.h:958
matinv
int matinv(int n, const double mat[], double inv[])
Matrix inversion.
linprm
Linear transformation parameters.
Definition: lin.h:599
lin_errmsg
const char * lin_errmsg[]
Status return messages.
linwarp
int linwarp(struct linprm *lin, 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
Distortion parameters.
Definition: dis.h:951
linperr
int linperr(const struct linprm *lin, const char *prefix)
Print error messages from a linprm struct.
linprm::piximg
double * piximg
Definition: lin.h:615
linprm::simple
int simple
Definition: lin.h:620
linprm::i_naxis
int i_naxis
Definition: lin.h:617
linprm::m_crpix
double * m_crpix
Definition: lin.h:631
linprm::m_disseq
struct disprm * m_disseq
Definition: lin.h:632
disprm::maxdis
double * maxdis
Definition: dis.h:964
linfree
int linfree(struct linprm *lin)
Destructor for the linprm struct.
linset
int linset(struct linprm *lin)
Setup routine for the linprm struct.
LINERR_SUCCESS
Definition: lin.h:590
linini
int linini(int alloc, int naxis, struct linprm *lin)
Default constructor for the linprm struct.
linprm::cdelt
double * cdelt
Definition: lin.h:609
lin_errmsg_enum
lin_errmsg_enum
Definition: lin.h:589
linprm::flag
int flag
Definition: lin.h:602
linprm::affine
int affine
Definition: lin.h:619
LINERR_DISTORT_INIT
Definition: lin.h:594
lincpy
int lincpy(int alloc, const struct linprm *linsrc, struct linprm *lindst)
Copy routine for the linprm struct.
linprm::pc
double * pc
Definition: lin.h:608
linx2p
int linx2p(struct linprm *lin, int ncoord, int nelem, const double imgcrd[], double pixcrd[])
World-to-pixel linear transformation.
lindis
int lindis(int sequence, struct linprm *lin, struct disprm *dis)
Assign a distortion to a linprm struct.
linprm::disseq
struct disprm * disseq
Definition: lin.h:611
linprm::imgpix
double * imgpix
Definition: lin.h:616
linprm::m_cdelt
double * m_cdelt
Definition: lin.h:631
LINERR_SINGULAR_MTX
Definition: lin.h:593
linprt
int linprt(const struct linprm *lin)
Print routine for the linprm struct.
LINERR_DISTORT
Definition: lin.h:595
LINERR_NULL_POINTER
Definition: lin.h:591