00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 static const char docstring[] =
00011 "makemrfdiscwts make distance metric for mrf segmentation\n"
00012 "\n"
00013 " dist=makemrfdiscwts(n,del,ctr,rho,mode,ell)\n"
00014 " * Given image sizes n, and neighborhood size del, make a distance\n"
00015 " metric array dist, such that dist(:,m1,n1) is the distance-to-\n"
00016 " neighbors of the site m1,n1, where 1 <= m1 <= n(1) and 1 <= n1 <= n(2).\n"
00017 " * Size of del = 3 corresponds to a 3x3 neighborhood around each site.\n"
00018 " * The distance is computed for a disk of center ctr(1:2) and radius\n"
00019 " ctr(3); ctr(1) corresponds to x or n1 and ctr(2) to y or m1.\n"
00020 " ctr(1:2) = [1 1] corresponds to the first pixel.\n"
00021 " * Thus, for instance, if Cx, Cy, r is the MDI center from mdidisk(),\n"
00022 " we would specify ctr=[Cx Cy r]. Note that ctr(1) and n(2) correspond\n"
00023 " to x, while ctr(2) and n(1) correspond to y.\n"
00024 " * Note that p-angle and b-angle are not needed by this routine.\n"
00025 " For simplicity, a 5-tuple containing these as entries 4 and 5\n"
00026 " (a `geom' vector) can be given for ctr, and the tail will be ignored.\n"
00027 " * The distance scale factor is rho. Zero corresponds to uniform\n"
00028 " distances (all one) and large positive values correspond to\n"
00029 " separation-sensitive distances. 100 (20..200) is a typical value\n"
00030 " for images of radius 500. To gain more insight, the raw distances\n"
00031 " (theta below) are returned when rho=NaN is given. A histogram\n"
00032 " of theta values relative to exp(-theta*rho) will show whether most\n"
00033 " theta's land in the linear part of the exponential.\n"
00034 " * If rho < 0 is given, the scale factor is taken to be abs(rho), but\n"
00035 " the distances are rescaled so that the overall max equals 1. Otherwise,\n"
00036 " the distances diminish across the entire disk as rho increases.\n"
00037 " * More explicitly, consider two points (s, s') within the 2d disk.\n"
00038 " They map to points on the unit sphere, say\n"
00039 " s = (x y z), s' = (x' y' z'),\n"
00040 " The angle theta (>0) between them is found, and the distance\n"
00041 " is returned as:\n"
00042 " dist = exp(-theta*rho)\n"
00043 " Because theta is very close to zero, the code in fact uses the chord\n"
00044 " distance rather than the arc distance between the two points.\n"
00045 " * Because the distance is symmetric, dist only includes distances\n"
00046 " between sites s,s' where s' is less than s. This is the case if\n"
00047 " the pixel corresponding to s' comes before s in the memory footprint\n"
00048 " of an image.\n"
00049 " * Elliptical discs are allowed for. In this case, ctr(3) is the\n"
00050 " major axis semidiameter, and ell(1) is that of the minor axis.\n"
00051 " ell(2) is the counterclockwise rotation, in degrees, of the major\n"
00052 " axis off of the \"m\" or \"y\" axis. If not given, ell(1)=ctr(3) and\n"
00053 " ell(2)=0. The implied condition ell(1) <= ctr(3) is not required\n"
00054 " by the code.\n"
00055 " * If either s or s' is off-disk, zero is put in the corresponding\n"
00056 " distance value. This is required by mrf_segment_wts.\n"
00057 " * The required mode string switches between sesw (mode = 'sesw')\n"
00058 " or transposed (mode = 'sene') pixel ordering, which works as follows.\n"
00059 " * The normal HMI (and normal MDI) pixel ordering starts in the\n"
00060 " southeast corner, and the first scan line of pixels runs toward the\n"
00061 " southwest corner. This is `sesw' ordering. The transposed ordering\n"
00062 " is `sene'; this ordering is what we used for the JPL MDI processing.\n"
00063 " This is implemented via internal stride parameters.\n"
00064 " * This is implemented as a MEX file. It agrees with makemrfdiscwts2.m\n"
00065 "\n"
00066 " Inputs:\n"
00067 " int n(1) or (2); -- if n is scalar, assume a square image\n"
00068 " int del;\n"
00069 " real ctr(3) or ctr(4) or ctr(5);\n"
00070 " real rho;\n"
00071 " string mode;\n"
00072 " opt real ell(2) = [ctr(3) 0];\n"
00073 "\n"
00074 " Outputs:\n"
00075 " real dist ((del*del-1)/2,n(1),n(2));\n"
00076 "\n"
00077 " See Also: makemrfdiscwts2, mrf_segment_wts\n"
00078 "\n"
00079 " turmon oct 2006\n"
00080 "\n"
00081 "";
00082
00083
00084