00001 00002 /* 00003 * THIS IS A GENERATED FILE; DO NOT EDIT. 00004 * 00005 * Declarations for calling `smoothsphere' a.k.a. `ssp' as a C library. 00006 * 00007 * Made by intermediate binary `smoothsphere.out' on: 00008 * Thu Jul 7 23:02:43 2011 00009 * 00010 * Code for include-generation driver `../Gen-include.c' last modified on: 00011 * Mon Jun 7 15:11:28 2010 00012 * 00013 */ 00014 00015 // Original documentation block 00016 /* 00017 * smoothsphere: smooth a projected sphere with a kernel 00018 * 00019 * [y,s,p]=smoothsphere(x,geom,k,kparam,kwt,bws) 00020 * * Given a solar image of location given by `geom', smooth it 00021 * using the radially-symmetric kernel `k'. 00022 * * This version is threaded, using 8 threads by default. 00023 * Set MXT_NUM_THREADS in the environment to lower this number. 00024 * * Off-disk values are indicated by NaN in the output. 00025 * * The kernel used is dependent only on the weighted distance 00026 * between two positions, say P1 and P2, in three-dimensional 00027 * coordinates, normalized to live on the unit sphere: 00028 * d = P1 - P2 00029 * dist = d' W d (>= 0) 00030 * for a diagonal weight matrix W. 00031 * The kernel values in `k' are specified for values of `dist' 00032 * in a linear range from 0 to kparam(1), typically 0.015. 00033 * Given a certain value of `dist' found between an image pixel 00034 * and the kernel center, the associated weight is interpolated 00035 * linearly using the table. If dot > kparam(1), a zero weight 00036 * is used. 00037 * * We have typically let k be a gaussian kernel of width 00038 * (standard deviation) = 0.0325, i.e., 00039 * k(dist) = C * exp[ -0.5 * dist / sqr(0.0325) ], 00040 * since dist is a squared quantity already, and C is a constant 00041 * chosen to make k have unit norm as a spherical kernel. 00042 * * As a shortcut, if k is a scalar, the kernel is taken to 00043 * be the above function, but with width 0.0325 multiplied by 00044 * k(1). In this case, the LUT consists of 256 points evenly 00045 * spaced over [0,kparam(1)]. 00046 * * The diagonal portion of the distance weight matrix W may be 00047 * supplied as a triple kwt. This weights distances between 00048 * P1 and P2 in the x, y, and z directions respectively. The 00049 * P-angle (rotation in the x-y plane) is taken into account in 00050 * this weighting, so that y is cross-track, and x and z are 00051 * always along-track. 00052 * * Typically the kernel falls to zero rather quickly. As a 00053 * computational shortcut, it is assumed that the kernel extends 00054 * only kparam(2) pixels on each side of its center. For W = I, 00055 * this implies that an "on" pixel in x extends to influence at 00056 * most a "swath" 2*kparam(2)+1 pixels on a side. Both the P-angle 00057 * and the W matrix are taken into account in finding the swath. 00058 * For instance, a W_y > 1 will cause the y portion of the swath 00059 * to shrink, because distance decreases faster. The swath is 00060 * always parallel to the (i,j) image axes, so P-angles not a 00061 * multiple of 90 degrees will cause the swath to be enlarged 00062 * to contain a rotated rectangle. 00063 * * To decrease computational load, nearby pixels may be grouped 00064 * into meta-pixels called blocks. This is especially trouble-free 00065 * away from the limb, where local geometry is nearly planar, so 00066 * the blocking is given as a table that depends on z (in [0,1]). 00067 * A row in the table of (z,bw) means: above the value z, use 00068 * a blocking of bw (>1). For z=0 to bws(1,1), no blocking is used. 00069 * * For example, the small-image default means to use single pixels 00070 * below 0.4, 2x2 blocks above 0.4, and 4x4 above 0.6. For typical 00071 * MDI images, this is 16%, 20%, and 64% of on-disk pixels, respectively. 00072 * Using block sizes that do not pack together is legal, but causes 00073 * inefficiency due to poor fits between abutting blocks; diagnose 00074 * bad packing with the p output. 00075 * * Supply bws=[] to treat all pixels singly (turn off blocking). 00076 * * The optional output s is the z-coordinate (in [0,R]). 00077 * The optional p output is the block (patch) number of each 00078 * pixel. 00079 * 00080 * Inputs: 00081 * real x[m,n]; 00082 * real geom[5]; -- [x0 y0 rsun b0 p0] 00083 * real k[p] or k[1]; 00084 * real kparam[2]; -- [top window] 00085 * opt real kwt = [1 1 1]; 00086 * opt real bws[bwnum,2] = [0.4 2;0.6 4]; -- m < 2048 00087 * = [0.3 2;0.5 4; 0.7 8]; -- m >= 2048 00088 * 00089 * Outputs: 00090 * real y[m,n]; 00091 * opt real s[m,n]; 00092 * opt int p[m,n]; 00093 * 00094 * See also: 00095 * 00096 * implemented as a mex file 00097 * 00098 * 00099 */ 00100 00101 #ifndef _mexfn_smoothsphere_h_ 00102 #define _mexfn_smoothsphere_h_ 00103 00104 // function entry point 00105 mexfn_lib_t main_smoothsphere; 00106 00107 // argument counts 00108 #define MXT_ssp_NARGIN_MIN 4 00109 #define MXT_ssp_NARGIN_MAX 6 00110 #define MXT_ssp_NARGOUT_MIN 0 00111 #define MXT_ssp_NARGOUT_MAX 3 00112 00113 // input argument numbers 00114 #define MXT_ssp_ARG_x 0 00115 #define MXT_ssp_ARG_geom 1 00116 #define MXT_ssp_ARG_k 2 00117 #define MXT_ssp_ARG_kparam 3 00118 #define MXT_ssp_ARG_kwt 4 00119 #define MXT_ssp_ARG_bws 5 00120 00121 // output argument numbers 00122 #define MXT_ssp_ARG_y 0 00123 #define MXT_ssp_ARG_s 1 00124 #define MXT_ssp_ARG_p 2 00125 00126 00127 #endif // _mexfn_smoothsphere_h_ 00128 00129 // (file ends)