version 1.3, 2011/11/11 08:44:05
|
version 1.4, 2013/05/03 20:47:15
|
|
|
*/ | */ |
| |
#include <math.h> | #include <math.h> |
//#include "astro.h" |
#include "projection.h" |
| |
typedef struct LIBASTRO_Dist_Struct |
char *cvsinfo_imageinterp = "cvsinfo: $Header$"; |
{ |
|
int disttype; |
|
double scale; /* Image scale relative to FD. 5 for vw. */ |
|
double xc, yc; /* Nominal image center in pixels. */ |
|
double cdist; /* Cubic distortion constant for FD images */ |
|
double feff, alpha, cosbeta, sinbeta; /* Tilt constants for FD. */ |
|
} LIBASTRO_Dist_t; |
|
|
|
typedef enum |
|
{ |
|
kLIBASTRO_InterBilinear = 0, |
|
kLIBASTRO_InterCubic = 1, |
|
} LIBASTRO_Interpolation_t; |
|
|
|
typedef enum |
|
{ |
|
kLIBASTRO_Success = 0, |
|
kLIBASTRO_BadDimensionality, |
|
kLIBASTRO_BadData, |
|
kLIBASTRO_CouldntCreateData, |
|
kLIBASTRO_DimensionMismatch, |
|
kLIBASTRO_CantDoOddNumLats, |
|
kLIBASTRO_UnsupportedInterp, |
|
kLIBASTRO_UnsupportedMCOR, |
|
kLIBASTRO_UnsupportedVCOR, |
|
kLIBASTRO_InconsistentConstraints, |
|
kLIBASTRO_InvalidArgs, |
|
kLIBASTRO_Interpolation, |
|
kLIBASTRO_InsufficientData |
|
} LIBASTRO_Error_t; |
|
| |
const int kMaxCols = 8192; | const int kMaxCols = 8192; |
const double kOmegaCarr = (360 / 27.27527); /* degrees/day - synodic Carrington rotation rate */ | const double kOmegaCarr = (360 / 27.27527); /* degrees/day - synodic Carrington rotation rate */ |
Line 83 static void Distort(double x, |
|
Line 53 static void Distort(double x, |
|
int sign, | int sign, |
double *xd, | double *xd, |
double *yd, | double *yd, |
const LIBASTRO_Dist_t *distpars); |
const LIBPROJECTION_Dist_t *distpars); |
| |
/* Calculate the interpolation kernel. */ | /* Calculate the interpolation kernel. */ |
void Ccker(double *u, double s) | void Ccker(double *u, double s) |
Line 191 int SetDistort(int dist, |
|
Line 161 int SetDistort(int dist, |
|
double alpha, | double alpha, |
double beta, | double beta, |
double feff, | double feff, |
LIBASTRO_Dist_t *dOut) |
LIBPROJECTION_Dist_t *dOut) |
{ | { |
int error = 0; | int error = 0; |
| |
Line 256 void Distort(double x, |
|
Line 226 void Distort(double x, |
|
int sign, | int sign, |
double *xd, | double *xd, |
double *yd, | double *yd, |
const LIBASTRO_Dist_t *distpars) |
const LIBPROJECTION_Dist_t *distpars) |
{ | { |
/* | /* |
For sign=+1 transforms ideal coordinates (x,y) to distorted | For sign=+1 transforms ideal coordinates (x,y) to distorted |
Line 339 int imageinterp( |
|
Line 309 int imageinterp( |
|
int cols, /* width of output array */ | int cols, /* width of output array */ |
int rows, /* height of output array */ | int rows, /* height of output array */ |
double vsign, | double vsign, |
const LIBASTRO_Dist_t *distpars) |
const LIBPROJECTION_Dist_t *distpars) |
{ | { |
| |
float u; /* output temp */ | float u; /* output temp */ |
Line 363 int imageinterp( |
|
Line 333 int imageinterp( |
|
| |
if (cols > kMaxCols) | if (cols > kMaxCols) |
{ | { |
return kLIBASTRO_DimensionMismatch; |
return kLIBPROJECTION_DimensionMismatch; |
} | } |
| |
| |
if (interpolation != kLIBASTRO_InterCubic && interpolation != kLIBASTRO_InterBilinear) |
if (interpolation != kLIBPROJECTION_InterCubic && interpolation != kLIBPROJECTION_InterBilinear) |
{ | { |
return kLIBASTRO_UnsupportedInterp; |
return kLIBPROJECTION_UnsupportedInterp; |
} | } |
| |
xratio=(double)xpixels/cols; | xratio=(double)xpixels/cols; |
Line 393 int imageinterp( |
|
Line 363 int imageinterp( |
|
| |
Distort(x, y, rsun, +1, &x, &y, distpars); | Distort(x, y, rsun, +1, &x, &y, distpars); |
| |
if (interpolation == kLIBASTRO_InterCubic) |
if (interpolation == kLIBPROJECTION_InterCubic) |
{ | { |
u = (float)(vsign * Ccintd (VD,xpixels,ypixels,x,y)); | u = (float)(vsign * Ccintd (VD,xpixels,ypixels,x,y)); |
} | } |
else if (interpolation == kLIBASTRO_InterBilinear) |
else if (interpolation == kLIBPROJECTION_InterBilinear) |
{ | { |
u = (float)(vsign * Linintd (VD,xpixels,ypixels,x,y)); | u = (float)(vsign * Linintd (VD,xpixels,ypixels,x,y)); |
} | } |
Line 406 int imageinterp( |
|
Line 376 int imageinterp( |
|
} | } |
} | } |
free(VD); | free(VD); |
return kLIBASTRO_Success; |
return kLIBPROJECTION_Success; |
} | } |