00001 00002 /* 00003 * THIS IS A GENERATED FILE; DO NOT EDIT. 00004 * 00005 * Declarations for calling `makemrfdiscwts' a.k.a. `mdw' as a C library. 00006 * 00007 * Made by intermediate binary `makemrfdiscwts.out' on: 00008 * Thu Jun 16 23:36:44 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 * makemrfdiscwts make distance metric for mrf segmentation 00018 * 00019 * dist=makemrfdiscwts(n,del,ctr,rho,mode,ell) 00020 * * Given image sizes n, and neighborhood size del, make a distance 00021 * metric array dist, such that dist(:,m1,n1) is the distance-to- 00022 * neighbors of the site m1,n1, where 1 <= m1 <= n(1) and 1 <= n1 <= n(2). 00023 * * Size of del = 3 corresponds to a 3x3 neighborhood around each site. 00024 * * The distance is computed for a disk of center ctr(1:2) and radius 00025 * ctr(3); ctr(1) corresponds to x or n1 and ctr(2) to y or m1. 00026 * ctr(1:2) = [1 1] corresponds to the first pixel. 00027 * * Thus, for instance, if Cx, Cy, r is the MDI center from mdidisk(), 00028 * we would specify ctr=[Cx Cy r]. Note that ctr(1) and n(2) correspond 00029 * to x, while ctr(2) and n(1) correspond to y. 00030 * * Note that p-angle and b-angle are not needed by this routine. 00031 * For simplicity, a 5-tuple containing these as entries 4 and 5 00032 * (a `geom' vector) can be given for ctr, and the tail will be ignored. 00033 * * The distance scale factor is rho. Zero corresponds to uniform 00034 * distances (all one) and large positive values correspond to 00035 * separation-sensitive distances. 100 (20..200) is a typical value 00036 * for images of radius 500. To gain more insight, the raw distances 00037 * (theta below) are returned when rho=NaN is given. A histogram 00038 * of theta values relative to exp(-theta*rho) will show whether most 00039 * theta's land in the linear part of the exponential. 00040 * * If rho < 0 is given, the scale factor is taken to be abs(rho), but 00041 * the distances are rescaled so that the overall max equals 1. Otherwise, 00042 * the distances diminish across the entire disk as rho increases. 00043 * * More explicitly, consider two points (s, s') within the 2d disk. 00044 * They map to points on the unit sphere, say 00045 * s = (x y z), s' = (x' y' z'), 00046 * The angle theta (>0) between them is found, and the distance 00047 * is returned as: 00048 * dist = exp(-theta*rho) 00049 * Because theta is very close to zero, the code in fact uses the chord 00050 * distance rather than the arc distance between the two points. 00051 * * Because the distance is symmetric, dist only includes distances 00052 * between sites s,s' where s' is less than s. This is the case if 00053 * the pixel corresponding to s' comes before s in the memory footprint 00054 * of an image. 00055 * * Elliptical discs are allowed for. In this case, ctr(3) is the 00056 * major axis semidiameter, and ell(1) is that of the minor axis. 00057 * ell(2) is the counterclockwise rotation, in degrees, of the major 00058 * axis off of the "m" or "y" axis. If not given, ell(1)=ctr(3) and 00059 * ell(2)=0. The implied condition ell(1) <= ctr(3) is not required 00060 * by the code. 00061 * * If either s or s' is off-disk, zero is put in the corresponding 00062 * distance value. This is required by mrf_segment_wts. 00063 * * The required mode string switches between sesw (mode = 'sesw') 00064 * or transposed (mode = 'sene') pixel ordering, which works as follows. 00065 * * The normal HMI (and normal MDI) pixel ordering starts in the 00066 * southeast corner, and the first scan line of pixels runs toward the 00067 * southwest corner. This is `sesw' ordering. The transposed ordering 00068 * is `sene'; this ordering is what we used for the JPL MDI processing. 00069 * This is implemented via internal stride parameters. 00070 * * This is implemented as a MEX file. It agrees with makemrfdiscwts2.m 00071 * 00072 * Inputs: 00073 * int n(1) or (2); -- if n is scalar, assume a square image 00074 * int del; 00075 * real ctr(3) or ctr(4) or ctr(5); 00076 * real rho; 00077 * string mode; 00078 * opt real ell(2) = [ctr(3) 0]; 00079 * 00080 * Outputs: 00081 * real dist ((del*del-1)/2,n(1),n(2)); 00082 * 00083 * See Also: makemrfdiscwts2, mrf_segment_wts 00084 * 00085 * turmon oct 2006 00086 * 00087 * 00088 */ 00089 00090 #ifndef _mexfn_makemrfdiscwts_h_ 00091 #define _mexfn_makemrfdiscwts_h_ 00092 00093 // function entry point 00094 mexfn_lib_t main_makemrfdiscwts; 00095 00096 // argument counts 00097 #define MXT_mdw_NARGIN_MIN 5 00098 #define MXT_mdw_NARGIN_MAX 6 00099 #define MXT_mdw_NARGOUT_MIN 0 00100 #define MXT_mdw_NARGOUT_MAX 1 00101 00102 // input argument numbers 00103 #define MXT_mdw_ARG_n 0 00104 #define MXT_mdw_ARG_del 1 00105 #define MXT_mdw_ARG_ctr 2 00106 #define MXT_mdw_ARG_rho 3 00107 #define MXT_mdw_ARG_mode 4 00108 #define MXT_mdw_ARG_ell 5 00109 00110 // output argument numbers 00111 #define MXT_mdw_ARG_dist 0 00112 00113 00114 #endif // _mexfn_makemrfdiscwts_h_ 00115 00116 // (file ends)