1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947
|
<!-- This file was generated by mk_html_help.pro -->
<html>
<head>
<TITLE>IDL Example Programs</TITLE>
</head>
<body>
<H1>IDL Example Programs</H1>
<P>
This page was created by the IDL library routine
<CODE>mk_html_help</CODE>. For more information on
this routine, refer to the IDL Online Help Navigator
or type: <P>
<PRE> ? mk_html_help</PRE><P>
at the IDL command line prompt.<P>
<STRONG>Last modified: </STRONG>Mon Jan 27 18:31:36 2014.<P>
<HR>
<A NAME="ROUTINELIST">
<H1>List of Routines</H1></A>
<UL>
<LI><A HREF="#ADJUSTPOSITION">ADJUSTPOSITION</A>
<LI><A HREF="#ANSI_VALUE">ANSI_VALUE</A>
<LI><A HREF="#ARCSAMPLE">ARCSAMPLE</A>
<LI><A HREF="#ASINHSCL">ASINHSCL</A>
<LI><A HREF="#ASPECT">ASPECT</A>
<LI><A HREF="#BINARY">BINARY</A>
<LI><A HREF="#BITGET">BITGET</A>
<LI><A HREF="#BLOB_ANALYZER__DEFINE">BLOB_ANALYZER__DEFINE</A>
<LI><A HREF="#CAPFIRSTLETTER">CAPFIRSTLETTER</A>
<LI><A HREF="#CHECKERBOARD">CHECKERBOARD</A>
<LI><A HREF="#CINDEX">CINDEX</A>
<LI><A HREF="#CLIPBOARD">CLIPBOARD</A>
<LI><A HREF="#CLIPSCL">CLIPSCL</A>
<LI><A HREF="#COLORBUTTONBITMAP">COLORBUTTONBITMAP</A>
<LI><A HREF="#COLORSAREIDENTICAL">COLORSAREIDENTICAL</A>
<LI><A HREF="#CONTRASTZOOM">CONTRASTZOOM</A>
<LI><A HREF="#CONVERT_TO_TYPE">CONVERT_TO_TYPE</A>
<LI><A HREF="#CW_DRAWCOLOR">CW_DRAWCOLOR</A>
<LI><A HREF="#DIRPATH">DIRPATH</A>
<LI><A HREF="#ERRORLOGGER__DEFINE">ERRORLOGGER__DEFINE</A>
<LI><A HREF="#FIND_BOUNDARY">FIND_BOUNDARY</A>
<LI><A HREF="#FIT_ELLIPSE">FIT_ELLIPSE</A>
<LI><A HREF="#FIXED_MAP_GRID">FIXED_MAP_GRID</A>
<LI><A HREF="#FLOATS_EQUAL">FLOATS_EQUAL</A>
<LI><A HREF="#FPUFIX">FPUFIX</A>
<LI><A HREF="#FSCCLEANUP7">FSCCLEANUP7</A>
<LI><A HREF="#FSCCLEANUP8">FSCCLEANUP8</A>
<LI><A HREF="#FSC_COLORBAR__DEFINE">FSC_COLORBAR__DEFINE</A>
<LI><A HREF="#FSC_COLORSELECT">FSC_COLORSELECT</A>
<LI><A HREF="#FSC_DROPLIST">FSC_DROPLIST</A>
<LI><A HREF="#FSC_FIELD">FSC_FIELD</A>
<LI><A HREF="#FSC_FILESELECT">FSC_FILESELECT</A>
<LI><A HREF="#FSC_INPUTFIELD">FSC_INPUTFIELD</A>
<LI><A HREF="#FSC_PLOTWINDOW">FSC_PLOTWINDOW</A>
<LI><A HREF="#FSC_PSCONFIG__DEFINE">FSC_PSCONFIG__DEFINE</A>
<LI><A HREF="#GAUSSSCL">GAUSSSCL</A>
<LI><A HREF="#GETIMAGE">GETIMAGE</A>
<LI><A HREF="#GETPRIMARYSCREENSIZE">GETPRIMARYSCREENSIZE</A>
<LI><A HREF="#GET_OBJECT_ID">GET_OBJECT_ID</A>
<LI><A HREF="#CGGMASCL">CGGMASCL</A>
<LI><A HREF="#HCOLORBAR">HCOLORBAR</A>
<LI><A HREF="#HELP_VAR">HELP_VAR</A>
<LI><A HREF="#HISTOMATCH">HISTOMATCH</A>
<LI><A HREF="#IMAGESELECT">IMAGESELECT</A>
<LI><A HREF="#IMAGE_BLEND">IMAGE_BLEND</A>
<LI><A HREF="#IMAGE_DIMENSIONS">IMAGE_DIMENSIONS</A>
<LI><A HREF="#INSIDE">INSIDE</A>
<LI><A HREF="#JD2TIME">JD2TIME</A>
<LI><A HREF="#LEFTJUSTIFY">LEFTJUSTIFY</A>
<LI><A HREF="#LINKEDLIST">LINKEDLIST</A>
<LI><A HREF="#LIST_SELECTOR">LIST_SELECTOR</A>
<LI><A HREF="#LOGSCL">LOGSCL</A>
<LI><A HREF="#MAXMIN">MAXMIN</A>
<LI><A HREF="#MAXWINDOWSIZE">MAXWINDOWSIZE</A>
<LI><A HREF="#NAME_SELECTOR">NAME_SELECTOR</A>
<LI><A HREF="#NCDF_ATTRIBUTE">NCDF_ATTRIBUTE</A>
<LI><A HREF="#NCDF_BROWSER">NCDF_BROWSER</A>
<LI><A HREF="#NCDF_CASTDATATYPE">NCDF_CASTDATATYPE</A>
<LI><A HREF="#NCDF_CONTAINER">NCDF_CONTAINER</A>
<LI><A HREF="#NCDF_DATA__DEFINE">NCDF_DATA__DEFINE</A>
<LI><A HREF="#NCDF_DIMENSION">NCDF_DIMENSION</A>
<LI><A HREF="#NCDF_FILE">NCDF_FILE</A>
<LI><A HREF="#NCDF_FILE_EXAMPLES">NCDF_FILE_EXAMPLES</A>
<LI><A HREF="#NCDF_ISVALIDFILE">NCDF_ISVALIDFILE</A>
<LI><A HREF="#NCDF_VARIABLE">NCDF_VARIABLE</A>
<LI><A HREF="#PICKCOLOR">PICKCOLOR</A>
<LI><A HREF="#PRECIPMAP">PRECIPMAP</A>
<LI><A HREF="#PRINTWINDOW">PRINTWINDOW</A>
<LI><A HREF="#PSWINDOW">PSWINDOW</A>
<LI><A HREF="#PS_BACKGROUND">PS_BACKGROUND</A>
<LI><A HREF="#RANDOMNUMBERGENERATOR">RANDOMNUMBERGENERATOR</A>
<LI><A HREF="#RANGEOF">RANGEOF</A>
<LI><A HREF="#REPMAT">REPMAT</A>
<LI><A HREF="#RESOLVE_OBJECT">RESOLVE_OBJECT</A>
<LI><A HREF="#REVERSE_AXES">REVERSE_AXES</A>
<LI><A HREF="#SAVETOMAIN">SAVETOMAIN</A>
<LI><A HREF="#SCALEMODIS">SCALEMODIS</A>
<LI><A HREF="#SCROLLWINDOW">SCROLLWINDOW</A>
<LI><A HREF="#SDEVSCL">SDEVSCL</A>
<LI><A HREF="#SELECT_OBJECTS">SELECT_OBJECTS</A>
<LI><A HREF="#SETDEFAULTVALUE">SETDEFAULTVALUE</A>
<LI><A HREF="#SHARPEN">SHARPEN</A>
<LI><A HREF="#SORT_ND">SORT_ND</A>
<LI><A HREF="#STATIONPLOT">STATIONPLOT</A>
<LI><A HREF="#STR_SIZE">STR_SIZE</A>
<LI><A HREF="#TEXTBOX">TEXTBOX</A>
<LI><A HREF="#TEXTLINEFORMAT">TEXTLINEFORMAT</A>
<LI><A HREF="#TEXTURE_SURFACE">TEXTURE_SURFACE</A>
<LI><A HREF="#TRANSFORM_VOLUME">TRANSFORM_VOLUME</A>
<LI><A HREF="#UNDEFINE">UNDEFINE</A>
<LI><A HREF="#VCOLORBAR">VCOLORBAR</A>
<LI><A HREF="#WINDBARB">WINDBARB</A>
<LI><A HREF="#WINDOWAVAILABLE">WINDOWAVAILABLE</A>
<LI><A HREF="#WINDOWIMAGE">WINDOWIMAGE</A>
</UL><P>
<HR>
<H1>Routine Descriptions</H1>
<A NAME="ADJUSTPOSITION">
<H2>ADJUSTPOSITION</H2></A>
<A HREF="#ANSI_VALUE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
AdjustPosition
PURPOSE:
This is a program for interactively adjusting the plot position
coordinates. The result of the function is a four-element floating
point array of normalized coordinates, suitable for passing to the
POSITION keyword of most IDL graphics commands.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics
CALLING SEQUENCE:
position = AdjustPosition(startingPosition)
OPTIONAL INPUTS:
startingPosition - A four-element array of normalized coordinates
of the form [x0, y0, x1, y1].
OUTPUTS:
position - The adjusted plot position. A four-element array of normalized coordinates.
INPUT KEYWORDS:
GROUP_LEADER - The group leader of this program. This keyword
is required to ensure modal operation when calling from
another widget program.
TITLE - The title of the window. "Adjust Plot Position in Window..." by default.
XOFFSET - The X offset of the program on the display. Calculated from the
upper left-hand corner of the display.
YOFFSET - The Y offset of the program on the display. Calculated from the
upper left-hand corner of the display.
OUTPUT KEYWORDS:
CANCEL - Returns a 1 if the user selects the Cancel button. Returns 0 otherwise.
Note that if the use cancels, the "position" parameter is set to the value of
the "startingPosition" parameter.
DEPENDENCIES:
Reqires FSC_FIELD and FSC_PLOTWINDOW from the Coyote Library:
http://www.idlcoyote.com/programs/fsc_field.pro
http://www.idlcoyote.com/programs/fsc_plotwindow.pro
MODIFICATION HISTORY:
Written by David Fanning, March 2001.
</PRE><P>
<STRONG>(See adjustposition.pro)</STRONG><P>
<HR>
<A NAME="ANSI_VALUE">
<H2>ANSI_VALUE</H2></A>
<A HREF="#ADJUSTPOSITION">[Previous Routine]</A>
<A HREF="#ARCSAMPLE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Provides a way to display non-printable characters in widget elements.
:Categories:
Widgets
:Params:
str_in: in, required, type=string
The input string that you wish to render on a widget element.
:Keywords:
example: in, optional, type=boolean, default=0
Set this keyword to see an example of non-printable characters
rendered in a Dialog_Pickfile widget.
:Examples:
Call the built-in example::
IDL> void = ANSI_Value(/EXAMPLE)
:Author:
Bernat Puigdomenech
:History:
Change History::
Written, 2 September 2011. Bernat Puigdomenech.
:Copyright:
Copyright (c) 2011, Bernat Puigdomenech.
</PRE><P>
<STRONG>(See ansi_value.pro)</STRONG><P>
<HR>
<A NAME="ARCSAMPLE">
<H2>ARCSAMPLE</H2></A>
<A HREF="#ANSI_VALUE">[Previous Routine]</A>
<A HREF="#ASINHSCL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
ARCSAMPLE
PURPOSE:
Given X and Y points that describe a closed curve in 2D space,
this function returns an output curve that is sampled a specified
number of times at approximately equal arc distances.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
ArcSample, x_in, y_in, x_out, y_out
INPUT_PARAMETERS:
x_in: The input X vector of points.
y_in: The input Y vector of points.
OUTPUT_PARAMETERS:
x_out: The output X vector of points.
y_out: The output Y vector of points.
KEYWORDS:
POINTS: The number of points in the output vectors. Default: 50.
PHASE: A scalar between 0.0 and 1.0, for fine control of where interpolates
are sampled. Default: 0.0.
MODIFICATION HISTORY:
Written by David W. Fanning, 1 December 2003, based on code supplied
to me by Craig Markwardt.
</PRE><P>
<STRONG>(See arcsample.pro)</STRONG><P>
<HR>
<A NAME="ASINHSCL">
<H2>ASINHSCL</H2></A>
<A HREF="#ARCSAMPLE">[Previous Routine]</A>
<A HREF="#ASPECT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
ASINHSCL
PURPOSE:
This is a utility routine to perform an inverse hyperbolic sine
function intensity transformation on an image. I think of this
as a sort of "tuned" gamma or power-law function. The algorithm,
and notion of "asinh magnitudes", comes from a paper by Lupton,
et. al, in The Astronomical Journal, 118:1406-1410, 1999 September.
I've relied on the implementation of Erin Sheldon, found here:
http://cheops1.uchicago.edu/idlhelp/sdssidl/plotting/tvasinh.html
I'm also grateful of discussions with Marshall Perrin on the IDL
newsgroup with respect to the meaning of the "softening parameter", beta,
and for finding (and fixing!) small problems with the code.
Essentially this transformation allow linear scaling of noise values,
and logarithmic scaling of signal values, since there is a small
linear portion of the curve and a much large logarithmic portion of
the curve. (See the EXAMPLE section for some tips on how to view this
transformation curve.)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
outputImage = ASINHSCL(image)
ARGUMENTS:
image: The image or signal to be scaled. Written for 2D images, but arrays
of any size are treated alike.
KEYWORDS:
BETA: This keyword corresponds to the "softening parameter" in the Lupon et. al paper.
This factor determines the input level at which linear behavior sets in. Beta
should be set approximately equal to the amount of "noise" in the input signal.
IF BETA=0 there is a very small linear portion of the curve; if BETA=200 the
curve is essentially all linear. The default value of BETA is set to 3, which
is appropriate for a small amount of noise in your signal. The value is always
positive.
NEGATIVE: If set, the "negative" of the result is returned.
MAX: Any value in the input image greater than this value is
set to this value before scaling.
MIN: Any value in the input image less than this value is
set to this value before scaling.
OMAX: The output image is scaled between OMIN and OMAX. The
default value is 255.
OMIN: The output image is scaled between OMIN and OMAX. The
default value is 0.
RETURN VALUE:
outputImage: The output, scaled into the range OMIN to OMAX. A byte array.
COMMON BLOCKS:
None.
EXAMPLES:
Plot, ASinhScl(Indgen(256), Beta=0.0), LineStyle=0
OPlot, ASinhScl(Indgen(256), Beta=0.1), LineStyle=1
OPlot, ASinhScl(Indgen(256), Beta=1.0), LineStyle=2
OPlot, ASinhScl(Indgen(256), Beta=10.), LineStyle=3
OPlot, ASinhScl(Indgen(256), Beta=100), LineStyle=4
RESTRICTIONS:
Requires cgScaleVector from the Coyote Library:
http://www.idlcoyote.com/programs/cgScaleVector.pro
Incorporates ASINH from the NASA Astronomy Library and renamed ASINHSCL_ASINH.
http://idlastro.gsfc.nasa.gov/homepage.html
MODIFICATION HISTORY:
Written by: David W. Fanning, 24 February 2006.
Removed ALPHA keyword and redefined the BETA keyword to correspond
to the "softening parameter" of Lupton et. al., following the
suggestions of Marshall Perrin. 25 April 2006. DWF.
</PRE><P>
<STRONG>(See asinhscl.pro)</STRONG><P>
<HR>
<A NAME="ASPECT">
<H2>ASPECT</H2></A>
<A HREF="#ASINHSCL">[Previous Routine]</A>
<A HREF="#BINARY">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
ASPECT
PURPOSE:
This function calculates and returns the normalized position
coordinates necessary to put a plot with a specified aspect ratio
into the currently active graphics window. It works on the display
output window as well as in a PostScript output window.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics
CALLING SEQUENCE:
position = ASPECT(aspectRatio)
INPUTS:
aspectRatio: A floating point value that is the desired aspect
ratio (ratio of heigth to width) of the plot in the current
graphics output window. If this parameter is missing, an aspect
ratio of 1.0 (a square plot) is assumed.
KEYWORD PARAMETERS:
MARGIN: The margin around the edges of the plot. The value must be
a floating point value between 0.0 and 0.5. It is expressed in
normalized coordinate units. The default margin is 0.15.
WINDOWASPECT: The aspect ratio of the target window. If not provided,
the value is obtained from the current graphics window.
OUTPUTS:
position: A four-element floating array of normalized coordinates.
The order of the elements is [x0, y0, x1, y1], similar to the
!P.POSITION system variable or the POSITION keyword on any IDL
graphic command.
EXAMPLE:
To create a plot with an aspect ratio of 1:2 and a margin of
0.10 around the edge of the output window, do this:
plotPosition = ASPECT(0.5, Margin=0.10)
PLOT, Findgen(11), POSITION=plotPosition
Notice this can be done in a single IDL command, like this:
PLOT, Findgen(11), POSITION=ASPECT(0.5, Margin=0.10)
MODIFICATION HISTORY:
Written by: David Fanning, November 1996.
Added better error checking, 18 Feb 1997, DWF.
Added WindowAspect keyword. 10 Feb 2000. DWF
Added double precision tolerance for aspectRatio. 9 NOV 2001 BT
Officially retired in favor of cgAspect. 11 February 2013. DWF.
</PRE><P>
<STRONG>(See aspect.pro)</STRONG><P>
<HR>
<A NAME="BINARY">
<H2>BINARY</H2></A>
<A HREF="#ASPECT">[Previous Routine]</A>
<A HREF="#BITGET">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
BINARY
PURPOSE:
This function is used to display a binary representation of byte,
integer, and long integer values.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utilities
CALLING SEQUENCE:
output = Binary(theNumber)
RETURN VALUE:
output: A string array of 0s and 1s to be printed (normally), in a
binary representation of the number. The number is represented with
the highest bits on the left and the lowest bits on the right,
when printed with the PRINT command.
ARGUMENTS:
theNumber: The number for which the user wants a binary representation.
It must be BYTE, INT, or LONG.
KEYWORDRS:
COLOR: If this keyword is set, the binary representation always
contains 24 bits of output.
SEPARATE: If this keyword is set, the output is separated with space
between each group of eight bits.
EXAMPLE:
IDL> Print, Binary(24B)
0 0 0 1 1 0 0 0
IDL> Print, Binary(24L)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
IDL> Print, Binary(24L, /COLOR)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
IDL> Print, Binary(24L, /COLOR, /SEPARATE)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
MODIFICATION HISTORY:
Written by: David W. Fanning, November 10, 2007.
Fixed a problem with error handling. 13 March 2008. DWF.
</PRE><P>
<STRONG>(See binary.pro)</STRONG><P>
<HR>
<A NAME="BITGET">
<H2>BITGET</H2></A>
<A HREF="#BINARY">[Previous Routine]</A>
<A HREF="#BLOB_ANALYZER__DEFINE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
BITGET
PURPOSE:
Returns the bit value (0 or 1) of a specified bit in a supplied number.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
bitValue = BitGet(number, bit)
INPUT_PARAMETERS:
number: The input number. Should be a scalar integer. If not, it is converted to
one by rounding.
bit: The number of the bit you are interested in. A value between 0 and 63.
If not supplied, all 64 bit values of the number are returned. May be
an array of bit numbers.
OUTPUT_PARAMETERS:
bitValue: The value, 0 or 1, of the specified bit in the number.
KEYWORDS:
SILENT: If set, suppresses informational messages regarding rounding operations.
MODIFICATION HISTORY:
Written by David W. Fanning, 14 June 2006.
</PRE><P>
<STRONG>(See bitget.pro)</STRONG><P>
<HR>
<A NAME="BLOB_ANALYZER__DEFINE">
<H2>BLOB_ANALYZER__DEFINE</H2></A>
<A HREF="#BITGET">[Previous Routine]</A>
<A HREF="#CAPFIRSTLETTER">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
BLOB_ANALYZER__DEFINE
PURPOSE:
The purpose of this routine is to create a system for analyzing
regions of interest (ROIs) or (more commonly) "blobs" inside images.
In particular, given a suitable image (this will require judgement on
your part), the program will automatically select "blobs" or connected
regions in the image and make it possible for you to analyze these
blobs. An example program is provided to show you one way the program
can be used.
The code is a wrapper, essentially, for LABEL_REGION and HISTOGRAM, with
a couple of my other image processing routines (FIND_BOUNDARY and FIT_ELLIPSE)
used in a supporting role.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Analysis, Image Processing
CALLING SEQUENCE:
analyzer = Obj_New("BLOB_ANALYZER", image)
INPUTS:
image: A two-dimensional image array. To make this program memory efficient,
a copy of the image is *not* stored in the object. You will be responsible
for image operations outside this program.
KEYWORDS:
ALL_NEIGHBORS: Set this keyword to look at all eight neighbors when searching
for connectivity. The default is to look for four neighbors on
each side of the starting pixel. Passed directly to LABEL_REGION.
MASK: A two-dimensional array, the same size as image, that identifies the
foreground and background pixels in the image. Applying the mask
should result in a bi-level image of 0s and 1s, where 1 identifies the
blobs you wish to analyze. If a mask is not provided, the mask is created
like this:
mask = image > 0
SCALE: A one- or two-dimensional given the pixel scaling parameters. By default [1.0, 1.0].
If passed a scalar, the scale parameter is applied to both the X and Y directions of
each pixel. Statistical output is reported with scaling unless the NOSCALE keyword
is set. Scaling also effects the data that is output from the various methods.
OBJECT METHODS:
The following methods are provided. Please see the documentation header for each method for
information on arguments and keywords that can be used with the method.
FitEllipse: This method fits an ellipse to the blob. It returns information about the fitted
ellipse, including the points that all the ellipse to be drawn.
GetIndices: This method returns the indices for a particular blob in the image.
GetStats: This method returns a structure containing statistics for a particular blob in the image.
The structure is defined as follows:
stats = {INDEX: indexNumber, $ ; The index number of this blob.
COUNT: N_Elements(indices), $ ; The number of indices in this blob.
PERIMETER_PTS: boundaryPts, $ ; A [2,n] array of points that describe the blob perimeter.
PIXEL_AREA: pixelArea, $ ; The area as calculated by pixels in the blob.
PERIMETER_AREA: perimeterArea, $ ; The area as calculated by the blob perimeter. (Smaller than pixel area.)
CENTER: centroid[0:1], $ ; The [x,y] array that identifies the centroid of the blob.
PERIMETER_LENGTH: perimeter_length, $ ; The perimenter length (scaled unless the NOSCALE keyword is set).
SCALE: scale, $ ; The [xscale, yscale] array used in scaling.
MINCOL: Min(xyindices[0,*]), $ ; The minimum column index in the blob.
MAXCOL: Max(xyindices[0,*]), $ ; The maximum column index in the blob.
MINROW: Min(xyindices[1,*]), $ ; The minimum row index in the blob.
MAXROW: Max(xyindices[1,*])} ; The maximum row index in the blob.
NumberOfBlobs: The number of blobs identified in the image.
ReportStats: This methods reports statistics on every identified blob in the image. The
report can be sent to the display (the default) or to a file. The format for
the report works for most images, but you may have to change the format or override
this method for your particular image. The reported statistics are basically the
output of the GetStats and FitEllipse methods.
Here is an example of statistical output from the example program below.
INDEX NUM_PIXELS CENTER_X CENTER_Y PIXEL_AREA PERIMETER_AREA PERIMETER_LENGTH MAJOR_AXIS MINOR_AXIS ANGLE
0 426 107.89 9.78 106.50 98.00 37.56 12.15 11.29 -8.05
1 580 151.97 10.22 145.00 134.25 49.21 17.49 11.77 -0.99
2 812 266.29 15.36 203.00 190.75 52.56 17.88 14.65 -107.48
3 1438 204.53 43.29 359.50 344.13 70.23 21.68 21.12 -76.47
RESTRICTIONS:
Requires programs from the Coyote Library. At the very least, those below are required.
It is *highly* recommended that you install the entire library. FIT_ELLIPSE has been
changed specifically for this release, so by sure you get a copy of that with this
source code.
The program currently works only with 2D bi-level images.
EXAMPLE:
To run an example program. Compile the file and type "example" at the IDL command line.
IDL> .compile blob_analyzer__define
IDL> example
MODIFICATION HISTORY:
Written by David W. Fanning, Fanning Software Consulting, 17 August 2008.
Ideas taken from discussion with Ben Tupper and Ben's program HBB_ANALYZER.
</PRE><P>
<STRONG>(See blob_analyzer__define.pro)</STRONG><P>
<HR>
<A NAME="CAPFIRSTLETTER">
<H2>CAPFIRSTLETTER</H2></A>
<A HREF="#BLOB_ANALYZER__DEFINE">[Previous Routine]</A>
<A HREF="#CHECKERBOARD">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CAPFIRSTLETTER
PURPOSE:
Given a string, separates the parts by white space, commas,
semi-colons, or colons. Each part has the first letter capitalized.
The returned string has the capitalized parts separated by a space.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
capitalizedString = CatFirstLetter(theString)
AUGUMENTS:
theString: The input string.
RETURN_VALUE:
capitalizedString: The capitalized output string. There is a space between parts
(words) of the input string.
KEYWORDS:
None.
MODIFICATION HISTORY:
Written by David W. Fanning, 29 July 2005.
</PRE><P>
<STRONG>(See capfirstletter.pro)</STRONG><P>
<HR>
<A NAME="CHECKERBOARD">
<H2>CHECKERBOARD</H2></A>
<A HREF="#CAPFIRSTLETTER">[Previous Routine]</A>
<A HREF="#CINDEX">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
Checkerboard
PURPOSE:
This function returns a 2D image, with boxes of alternating colors.
Checkerboard images are useful in certain types of image processing
procedures and for making blended image masks.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Image Processing
CALLING SEQUENCE:
board = Checkerboard()
RETURN VALUE:
board: A 2D long array of alternating colored boxes.
ARGUMENTS:
boxes: The number of boxes of alternating colors on each side
of the resulting image. Must be an even integer greater
than or equal to two. Optional. Default is 8 (normal
checkerboard).
INPUT KEYWORDS:
BLACK: The value of the "black" boxes. By default, 0.
WHITE: The value of the "white" boxes. By default, 255.
XSIZE: The X size of the returned image. By default, 400.
YSIZE: The Y size of the returned image. By default, 400.
COMMON BLOCKS:
None.
EXAMPLE:
IDL> cgImage, Checkerboard()
MODIFICATION HISTORY:
Written by David W. Fanning, 26 September 2007, based on suggestions
of JD Smith on IDL newsgroup 25-26 Septermber 2007.
</PRE><P>
<STRONG>(See checkerboard.pro)</STRONG><P>
<HR>
<A NAME="CINDEX">
<H2>CINDEX</H2></A>
<A HREF="#CHECKERBOARD">[Previous Routine]</A>
<A HREF="#CLIPBOARD">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CIndex
PURPOSE:
This is a program for viewing the current colors in the
colortable with their index numbers overlayed on each color.
On 24-bit systems you must click the cursor in the graphics window
to see the colors in the current color table.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY: Graphics
CALLING SEQUENCE: CIndex
INPUTS: None.
INPUT KEYWORDS:
BREWER: If this keyword is set, the BREWER colors will be loaded with the
Change Colors button. (Assuming the brewer color table file, fsc_brewer.tbl,
has been installed.
OUTPUTS: None
OPTIONAL OUTPUTS: None
OUTPUT KEYWORDS:
NOTIFYID: A two-element array containing the Change Colors button widget
identifier and the identifier of the top-level base widget. This
array is meant to be sent to an XCOLORS routine via its NOTIFYID
keyword. This will allow instant updating of the CINDEX interface.
COMMON BLOCKS: None
SIDE EFFECTS: None
RESTRICTIONS: Reqires XCOLORS and cgImage from the Coyote Library:
http://www.idlcoyote.com/programs/xcolors.pro
http://www.idlcoyote.com/programs/cgImage.pro
PROCEDURE:
Draws a 31x25 set of small rectangles in 256 different colors.
Writes the color index number on top of each rectangle.
MODIFICATION HISTORY: Written by David Fanning, May 1995
Widgetized and made it work in 24-bit color. Colors are
updated by clicking in window. 22 Oct 98. DWF
Replace POLYFILL with TV command to avoid underflow error in
Z-buffer. 8 March 99. DWF
Fixed a problem with 24-bit devices with color decomposition ON. 15 Feb 2000. DWF.
Added the NOTIFYID keyword, 15 Dec 2005. DWF.
Added BREWER keyword, 19 May 2008. DWF.
Replaced TV commands with cgImage, 12 June 2013. DWF.
</PRE><P>
<STRONG>(See cindex.pro)</STRONG><P>
<HR>
<A NAME="CLIPBOARD">
<H2>CLIPBOARD</H2></A>
<A HREF="#CINDEX">[Previous Routine]</A>
<A HREF="#CLIPSCL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CLIPBOARD
PURPOSE:
The purpose of this program is to copy the contents of a
graphics window to the clipboard for subsequent pasting into
applications such as Photoshop or Powerpoint.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics.
CALLING SEQUENCE:
CLIPBOARD, window_index
OPTIONAL INPUTS:
window_index: The window index number of the graphics window to
copy. If absent, the current graphics window is used
by default.
KEYWORDS:
All COLOR_QUAN keywords are allowed. In particular, if you are
taking snapshots of line plots with few colors in them, you may
get better results by calling the program with the CUBE=6 keyword
set. Otherwise, white colors can sometimes be a bit gray.
OUTPUTS:
None.
COMMON BLOCKS:
None.
DEPENDENCIES:
Uses the IDLgrClipboard object introduced in IDL 5.2(?).
PROCEDURE:
Copies the window contents to a clipboard object.
EXAMPLE:
IDL> Window
IDL> Plot, Findgen(11)
IDL> CLIPBOARD
RESTRICTIONS:
May not work for all applications. Applications tested successfully
include: Framemaker, Powerpoint, Photoshop, Excel, Microsoft Word.
Converts 24-bit images to 2D images with color tables.
MODIFICATION HISTORY:
Written by: David W. Fanning, 24 October 2001.
Added _EXTRA keyword to pass COLOR_QUAN keywords along. 28 Oct 2002. DWF.
</PRE><P>
<STRONG>(See clipboard.pro)</STRONG><P>
<HR>
<A NAME="CLIPSCL">
<H2>CLIPSCL</H2></A>
<A HREF="#CLIPBOARD">[Previous Routine]</A>
<A HREF="#COLORBUTTONBITMAP">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CLIPSCL
PURPOSE:
This is a utility routine to perform linear scaling (similar to BYTSCL)
on image arrays. If differs from BYTSCL only in that a user-specified
percentage of pixels can be clipped from the image histogram, prior to
scaling. By default, two percent of the pixels are clipped. Clipping
occurs at both ends of the image histogram.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
scaledImage = CLIPSCL(image, clipPercent)
ARGUMENTS:
image: The image to be scaled. Written for 2D images, but arrays
of any size are treated alike.
clipPercent: The percent of image clipping. Optional argument is set
to 2 by default. Must be value between 0 and 49. Clipping
occurs from both ends of image histogram, so a clip of 2
linearly scales approximately 96% of the image histogram.
Clipping percents are approximations only, and depend
entirely on the distribution of pixels in the image. For
interactive scaling, see cgStretch.
INPUT KEYWORDS:
NEGATIVE: If set, the "negative" of the result is returned.
OMAX: The output image is scaled between OMIN and OMAX. The
default value is 255.
OMIN: The output image is scaled between OMIN and OMAX. The
default value is 0.
OUTPUT KEYWORDS:
THRESHOLD: A two-element array containing the image thresholds for clipping.
RETURN VALUE:
scaledImage: The output, scaled into the range OMIN to OMAX. A byte array.
COMMON BLOCKS:
None.
EXAMPLES:
LoadCT, 0 ; Gray-scale colors.
image = cgDemoData(22) ; Load image.
TV, ClipScl(image, 4)
RESTRICTIONS:
Requires cgScaleVector from the Coyote Library:
http://www.idlcoyote.com/programs/cgScaleVector.pro
MODIFICATION HISTORY:
Written by: David W. Fanning, 6 September 2007.
Not sure what this program was doing, but not what I thought. I've reworked
the algorithm to scale the data appropriately. 25 Oct 2011. DWF.
</PRE><P>
<STRONG>(See clipscl.pro)</STRONG><P>
<HR>
<A NAME="COLORBUTTONBITMAP">
<H2>COLORBUTTONBITMAP</H2></A>
<A HREF="#CLIPSCL">[Previous Routine]</A>
<A HREF="#COLORSAREIDENTICAL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
ColorButtonBitmap
PURPOSE:
The purpose of this program is to create a 24-bit bitmap that can be used to
create a colored widget button.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Widget Programming
CALLING SEQUENCE:
bitmap = ColorButtonBitmap(theText)
button = Widget_Button(tlb, Value=bitmap)
REQUIRED INPUTS:
theText - The text you wish to have on the button.
OUTPUTS:
bitmap - A 3xMxN byte array, representing a 24-bit image that is used
as a button value.
OPTIONAL KEYWORDS:
BGCOLOR - The name of the background color. For example, 'Yellow', 'Tan', etc.
The name must be compatible with names appropriate for cgColor.
FGCOLOR - The name of the foreground color. For example, 'Navy', 'Black', etc.
The name must be compatible with names appropriate for cgColor.
DEPENDENCIES:
Reqires cgColor from the Coyote Library:
http://www.idlcoyote.com/programs/cgColor.pro
EXAMPLE:
tlb = Widget_Base(/Row, /Exclusive)
button1 = Widget_Button(tlb, Value=ColorButtonBitmap('Button 1')) ; Normal button.
button2 = Widget_Button(tlb, Value=ColorButtonBitmap('Button 2', FGCOLOR='YELLOW', BGCOLOR='NAVY'))
button3 = Widget_Button(tlb, Value=ColorButtonBitmap('Button 3', BGCOLOR='YELLOW', FGCOLOR='NAVY'))
Widget_Control, tlb, /Realize
MODIFICATION HISTORY:
Written by David Fanning, May 25, 2007 based on code named BitmapForButtonText supplied to the IDL
newsgroup by Dick Jackson: http://www.idlcoyote.com/tip_examples/bitmapforbuttontext.pro.
Fixed a problem with foreground and background colors that caused them to work correctly only
when color decomposition is on--as it should be :-). 6 May 2009.
</PRE><P>
<STRONG>(See colorbuttonbitmap.pro)</STRONG><P>
<HR>
<A NAME="COLORSAREIDENTICAL">
<H2>COLORSAREIDENTICAL</H2></A>
<A HREF="#COLORBUTTONBITMAP">[Previous Routine]</A>
<A HREF="#CONTRASTZOOM">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Returns a 1 if the two input colors refer to the same color, otherwise returns a 0.
:Categories:
Graphics Utility
:Params:
color_1: in, required, type=string/integer/long
The first color to compare for "equality".
color_2: in, required, type=string/integer/long
The second color to compare for "equality".
:Keywords:
None.
:Examples:
Used to compare if two different colors are the same color::
IDL> Print, ColorsAreIdentical('white', cgColor('white'))
IDL> Print, ColorsAreIdentical(252, !P.Color)
IDL> Print, ColorsAreIdentical('white', '255')
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written, 24 December 2010. DWF.
Fixed a typo when first color is INTEGER and second color is STRING. 3 Jan 2011. DWF.
Added error handling for out of bounds color values. 25 May 2011. DWF.
:Copyright:
Copyright (c) 2010, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See colorsareidentical.pro)</STRONG><P>
<HR>
<A NAME="CONTRASTZOOM">
<H2>CONTRASTZOOM</H2></A>
<A HREF="#COLORSAREIDENTICAL">[Previous Routine]</A>
<A HREF="#CONVERT_TO_TYPE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CONTRASTZOOM
PURPOSE:
The purpose of this program is to demonstrate how to
zoom an image "in place" and how to window and level
(set "contrast and brightness") an image using object
graphics functionality. The exercise involves using
multiple views in an object graphics scene, and being
able to interact with different views in different ways.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Widgets, Object Graphics.
CALLING SEQUENCE:
ContrastZoom, image
REQUIRED INPUTS:
None. The image "mr_knee.dcm" from the examples/data directory
is used if no data is supplied in call.
OPTIONAL INPUTS
image: A 2D image array of any data type.
OPTIONAL KEYWORD PARAMETERS:
COLORTABLE: The number of a color table to use as the image palette.
Color table 0 (grayscale) is used as a default.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None. The Coyote Library program VCOLORBAR is included.
EXAMPLE:
To use this program with your 8-bit image data and a red-temperature
color scale, type:
IDL> ContrastZoom, image, Colortable=3
NOTES:
The left image is used to "zoom" into a portion of the image.
The aspect ratio of the sub-image is always preserved. To see
the entire image, click and release the mouse button in this
window.
The center image is used to adjust the contrast and brightness
(sometimes called the "window" and "level" of the image. Click and
drag the mouse vertically to set contrast. Click and drag the mouse
horizontally to set brightness. To return to original values (25%
contrast and 75% brightness), click and release in the center image.
The color bars shows the image values of the image.
MODIFICATION HISTORY:
Written by David Fanning, 18 November 2001.
Added second colorbar to show the relationship of the clamped
colors to the overall image values. 19 November 2001. DWF.
Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See contrastzoom.pro)</STRONG><P>
<HR>
<A NAME="CONVERT_TO_TYPE">
<H2>CONVERT_TO_TYPE</H2></A>
<A HREF="#CONTRASTZOOM">[Previous Routine]</A>
<A HREF="#CW_DRAWCOLOR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CONVERT_TO_TYPE
PURPOSE:
Converts its input argument to a specified data type.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
result = Convert_To_Type(input, type)
INPUT_PARAMETERS:
input: The input data to be converted.
type: The data type. Accepts values as given by Size(var, /TNAME) or Size(var, /TYPE).
If converting to integer types, values are truncated (similar to FLOOR keyword below),
unless keywords are set.
OUTPUT_PARAMETERS:
result: The input data is converted to specified data type.
KEYWORDS:
CEILING: If set and converting to an integer type, the CEIL function is applied before conversion.
FLOOR: If set and converting to an integer type, the FLOOR function is applied before conversion.
ROUND: If set and converting to an integer type, the ROUND function is applied before conversion.
RESTRICTIONS:
Data types STRUCT, POINTER, and OBJREF are not allowed.
MODIFICATION HISTORY:
Written by David W. Fanning, 19 February 2006.
Typo had "UNIT" instead of "UINT". 23 February 2009. DWF.
Added CEILING, FLOOR, and ROUND keywords. 1 April 2009. DWF.
Modified so that the "type" variable is not changed by the program. 5 May 2009. DWF.
</PRE><P>
<STRONG>(See convert_to_type.pro)</STRONG><P>
<HR>
<A NAME="CW_DRAWCOLOR">
<H2>CW_DRAWCOLOR</H2></A>
<A HREF="#CONVERT_TO_TYPE">[Previous Routine]</A>
<A HREF="#DIRPATH">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CW_DRAWCOLOR
PURPOSE:
This compound widget is used to place a label or color name next
to a color patch. Clicking on the color patch allows the user
to select another color
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics
CALLING SEQUENCE:
colorpatchID = CW_DrawColor(parent)
REQUIRED INPUTS:
parent - The identifier of a parent base widget.
OUTPUTS:
colorpatchID - The widget identifier of the top-level base of this compound widget
INPUT KEYWORDS:
COLOR - The name of the color to be displayed. Color names come from cgPickColorName.
COLUMN - Set this keyword to stack widgets in a column. Default is in a row.
EVENT_FUNC - The name of an event handler function for this compound widget.
EVENT_PRO -The name of an event handler procedure for this compound widget.
INDEX - An index number where the color should be loaded. !D.Table_Size-2, by default.
FILENAME - An optional input to cgPickColorName specifying different
colors. See the cgPickColorName documenation for the file format.
LABEL_LEFT - Set this keyword to have the label text aligned on the left of the label. Default is to center.
LABEL_RIGHT - Set this keyword to have the label text aligned on the right of the label. Default is to center.
LABELSIZE - This is the X size of the label widget (containing the label) in device coordinates. Default is natural size.
LABELTEXT - This is the text on the label. Example, "Background Color", etc.
TITLE - This is the title on the cgPickColorName program that allows the user to select another color.
UVALUE - A user value for the widget.
XSIZE - The xsize (in pixel units) of the color patch. By default, 20.
YSIZE - The xsize (in pixel units) of the color patch. By default, 20.
OUTPUT KEYWORDS:
OBJECT - The object reference. Use this to call methods, etc.
OBJECT PROCEDURE METHODS:
Set_Value -- this method takes one argument, the new color name.
It will change the color of the widget if it has
already been realized.
Get_Value -- this method returns the color name the widget is displaying
DEPENDENCIES:
Reqires cgColor and cgPickColorName from the Coyote Library:
http://www.idlcoyote.com/programs/cgColor.pro
http://www.idlcoyote.com/programs/cgPickColorName.pro
MODIFICATION HISTORY:
Written by David W. Fanning, March 2001.
Fixed a problem with self object cleanup. 7 March 2006. DWF.
Allow addition to already realized widget hierarchies, October 2007. L. Anderson.
Added set_value and get_value methods to the widget can be
updated after being realized. October 2007. L. Anderson.
Added option to pass filename on to cgPickColorName. October
2007. L. Anderson
</PRE><P>
<STRONG>(See cw_drawcolor.pro)</STRONG><P>
<HR>
<A NAME="DIRPATH">
<H2>DIRPATH</H2></A>
<A HREF="#CW_DRAWCOLOR">[Previous Routine]</A>
<A HREF="#ERRORLOGGER__DEFINE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
DIRPATH
PURPOSE:
The purpose of this function is to return a device-independent
name of a directory. It is similar to the IDL-supplied FILEPATH
routine, except that a file name is not required.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utility.
CALLING SEQUENCE:
IDL> theDirectory = DIRPATH('examples')
IDL> Print, theDirectory
C:\IDL\IDL56\examples
INPUTS:
subDirectory: This is a string argument containing the name of the
sub-directory you wish to use. It can be a string
array of sub-directory names. By default, the subDirectory
is set to ['examples', 'data']. To only return the Root_Directory,
set the subDirectory to a null string ("").
KEYWORDS:
ROOT_DIRECTORY: The name of the root directory to use. By default,
the root directory is set to !DIR.
OUTPUTS:
The machine-independent directory path.
MODIFICATION HISTORY:
Written by: David W. Fanning, 28 April 2003.
</PRE><P>
<STRONG>(See dirpath.pro)</STRONG><P>
<HR>
<A NAME="ERRORLOGGER__DEFINE">
<H2>ERRORLOGGER__DEFINE</H2></A>
<A HREF="#DIRPATH">[Previous Routine]</A>
<A HREF="#FIND_BOUNDARY">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
ErrorLogger__Define
PURPOSE:
The purpose of this program is to log program errors or text messages during
program execution as an aid to debugging such a program at a later date. The
ErrorLogger program is written as an object so that it will persist in the IDL
session until it is destroyed.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
errorLogger = Obj_New("ErrorLogger")
ARGUMENTS:
filename: The name of the error log file. If not provided, a default name
will be created, based on the current system time. (Optional)
KEYWORDS:
ALERT: The default behavior of the error logger is simply to write text to a file.
But if the ALERT keyword is set, the program will alert the user via a
message dialog that an error has occurred when using the AddError method.
Default is 0. (Input)
DELETE_ON_DESTROY: If this keyword is set, the error log file will be deleted when the
ErrorLogger object is destroyed, but only if the ErrorLogger object is not
in an error state at that time (error status = 2). Default is 0. (Input)
NOCLUTTER: Believe it or not, some people who use an ErrorLogger prefer that an error log
file is never left behind. (They prefer that the program act like cgErrorMsg.)
For those people, the NOCLUTTER keyword provides a way for them to automatically
set the ALERT and DESTROY_ON_DELETE keywords to 1. It also prevents the error
logger from ever setting the error status to 2. Thus, when the ErrorLogger is
destroyed, the file is always deleted. Default is 0. When set, overrides ALERT
and DELETE_ON_DESTROY settings. (Input)
NOTRACEBACK: Set this keyword to suppress traceback information in the error log output
and in any alerts issued by the program. Default is 0. (Input)
TIMESTAMP: Set this keyword if you wish a time stamp to be appended to the provided
filename. Otherwise, the filename is used as defined. Default filenames
always have a timestamp appended to the file name. (Input)
METHODS:
AddError: Adds an error text string or array to the error log file. By default,
it will add the HELP, LAST_MESSAGE=1, /TRACEBACE traceback
information to the file. (Procedure)
AddText: Adds a text string or array to the error log file. (Procedure)
ClearLog: Erases all the text currently in the error log file. (Procedure)
CloseFile: Closes the currently open error log file. (Procedure)
Flush: Forces a write of any current information to the disk (Procedure)
GetProperty: Gets properties of the object. (Procedure)
LastMessage: Returns the last message text written into the error log file. (Function)
OpenFile: Opens the error log file for writing. (Function)
PrintLastMessage: Writes the last message text written into the error log file to
standard output. (Procedure)
Status: Returns the current status of the error logger. (0 - waiting for input,
1 - normal operation, 2 - error operation.) (Function)
SetProperty: Sets properties of the object. (Procedure)
SetStatus: Sets the current status of the error logger. Normally not used by the
user, but used internally. (Procedure)
MODIFICATION HISTORY:
Written by David W. Fanning, November 2009.
Modified and expanded the way errors are written into the log file and displayed.
Also made it possible to automatically delete the log file when the object is
destroyed, if the error logger is not in an error state at the time. Added
DELETE_ON_DESTROY and NOTRACEBACK keywords to the INIT and SetProperty
methods. 28 Jan 2010. DWF.
Modified default filenames so that I am now guaranteed to get unique file names
by using cgTimestamp program from the Coyote Library. 8 Feb 2010. DWF.
Added NOCLUTTER keyword. 15 February 2010. DWF.
Added PRINT keyword to AddText method to allow users to log statements that should
also be printed easily to a file. 17 February 2010. DWF.
Small documentation changes to the program. 22 June 2010. DWF.
Made a change so that the file is not opened until something needs to be written
to it. 22 June 2010. DWF.
Added FLUSH method and keyword IMMEDIATE to the INIT method (defaults to 1) which
will immediately flush the log information to disk when log information is
added to the object. This will prevent missing information that is buffered
when a program crashes. Matt Savoie suggestion. DWF, 10 Sept 2010.
Now calling cgTimeStamp rather than TimeStamp to avoid problems with IDL code. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See errorlogger__define.pro)</STRONG><P>
<HR>
<A NAME="FIND_BOUNDARY">
<H2>FIND_BOUNDARY</H2></A>
<A HREF="#ERRORLOGGER__DEFINE">[Previous Routine]</A>
<A HREF="#FIT_ELLIPSE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FIND_BOUNDARY
PURPOSE:
This program finds the boundary points about a region of interest (ROI)
represented by pixel indices. It uses a "chain-code" algorithm for finding
the boundary pixels.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics, math.
CALLING SEQUENCE:
boundaryPts = Find_Boundary(indices, XSize=xsize, YSize=ysize)
OPTIONAL INPUTS:
indices - A 1D vector of pixel indices that describe the ROI. For example,
the indices may be returned as a result of the WHERE function.
OUTPUTS:
boundaryPts - A 2-by-n points array of the X and Y points that describe the
boundary. The points are scaled if the SCALE keyword is used.
INPUT KEYWORDS:
SCALE - A one-element or two-element array of the pixel scale factors, [xscale, yscale],
used to calculate the perimeter length or area of the ROI. The SCALE keyword is
NOT applied to the boundary points. By default, SCALE=[1,1].
XSIZE - The X size of the window or array from which the ROI indices are taken.
Set to !D.X_Size by default.
YSIZE - The Y size of the window or array from which the ROI indices are taken.
Set to !D.Y_Size by default.
OUTPUT KEYWORDS:
AREA - A named variable that contains the pixel area represented by the input pixel indices,
scaled by the SCALE factors.
CENTER - A named variable that contains a two-element array containing the center point or
centroid of the ROI. The centroid is the position in the ROI that the ROI would
balance on if all the index pixels were equally weighted. The output is a two-element
floating-point array in device coordinate system, unless the SCALE keyword is used,
in which case the values will be in the scaled coordinate system.
PERIM_AREA - A named variable that contains the (scaled) area represented by the perimeter
points, as indicated by John Russ in _The Image Processing Handbook, 2nd Edition_ on
page 490. This is the same "perimeter" that is returned by IDLanROI in its
ComputeGeometry method, for example. In general, the perimeter area will be
smaller than the pixel area.
PERIMETER - A named variable that will contain the perimeter length of the boundary
upon returning from the function, scaled by the SCALE factors.
EXAMPLE:
LoadCT, 0, /Silent
image = BytArr(400, 300)+125
image[125:175, 180:245] = 255B
indices = Where(image EQ 255)
Window, XSize=400, YSize=300
TV, image
PLOTS, Find_Boundary(indices, XSize=400, YSize=300, Perimeter=length), $
/Device, Color=cgColor('red')
Print, length
230.0
MODIFICATION HISTORY:
Written by David W. Fanning, April 2002. Based on an algorithm written by Guy
Blanchard and provided by Richard Adams.
Fixed a problem with distinction between solitary points and
isolated points (a single point connected on a diagonal to
the rest of the mask) in which the program can't get back to
the starting pixel. 2 Nov 2002. DWF
Added the ability to return the perimeter length with PERIMETER and
SCALE keywords. 2 Nov 2002. DWF.
Added AREA keyword to return area enclosed by boundary. 2 Nov 2002. DWF.
Fixed a problem with POLYFILLV under-reporting the area by removing
POLYFILLV and using a pixel counting method. 10 Dec 2002. DWF.
Added the PERIM_AREA and CENTER keywords. 15 December 2002. DWF.
Replaced the cgErrorMsg routine with the latest version. 15 December 2002. DWF.
Fixed a problem in which XSIZE and YSIZE have to be specified as integers to work. 6 March 2006. DWF.
Fixed a small problem with very small ROIs that caused the program to crash. 1 October 2008. DWF.
Modified the algorithm that determines the number of boundary points for small ROIs. 28 Sept 2010. DWF.
</PRE><P>
<STRONG>(See find_boundary.pro)</STRONG><P>
<HR>
<A NAME="FIT_ELLIPSE">
<H2>FIT_ELLIPSE</H2></A>
<A HREF="#FIND_BOUNDARY">[Previous Routine]</A>
<A HREF="#FIXED_MAP_GRID">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
Fit_Ellipse
PURPOSE:
This program fits an ellipse to an ROI given by a vector of ROI indices.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics, math.
CALLING SEQUENCE:
ellipsePts = Fit_Ellipse(indices)
OPTIONAL INPUTS:
indices - A 1D vector of pixel indices that describe the ROI. For example,
the indices may be returned as a result of the WHERE function.
OUTPUTS:
ellipsePts - A 2-by-npoints array of the X and Y points that describe the
fitted ellipse. The points are in the device coodinate system.
INPUT KEYWORDS:
NPOINTS - The number of points in the fitted ellipse. Set to 120 by default.
SCALE - A two-element array that gives the scaling parameters for each X and Y pixel, respectively.
Set to [1.0,1.0] by default.
XSIZE - The X size of the window or array from which the ROI indices are taken.
Set to !D.X_Size by default.
YSIZE - The Y size of the window or array from which the ROI indices are taken.
Set to !D.Y_Size by default.
OUTPUT KEYWORDS:
CENTER -- Set to a named variable that contains the X and Y location of the center
of the fitted ellipse in device coordinates.
ORIENTATION - Set to a named variable that contains the orientation of the major
axis of the fitted ellipse. The direction is calculated in degrees
counter-clockwise from the X axis.
AXES - A two element array that contains the length of the major and minor
axes of the fitted ellipse, respectively.
SEMIAXES - A two element array that contains the length of the semi-major and semi-minor
axes of the fitted ellipse, respectively. (This is simple AXES/2.)
EXAMPLE:
LoadCT, 0, /Silent
image = BytArr(400, 300)+125
image[180:245, 125:175] = 255B
indices = Where(image EQ 255)
Window, XSize=400, YSize=300
TV, image
PLOTS, Fit_Ellipse(indices, XSize=400, YSize=300), /Device, Color=cgColor('red')
MODIFICATION HISTORY:
Written by David W. Fanning, April 2002. Based on algorithms provided by Craig Markwardt
and Wayne Landsman in his TVEllipse program.
Added SCALE keyword and modified the algorithm to use memory more efficiently.
I no longer have to make huge arrays. The arrays are only as big as the blob
being fitted. 17 AUG 2008. DWF.
Fixed small typo that caused blobs of indices with a longer X axis than Y axis
to misrepresent the center of the ellipse. 23 February 2009.
</PRE><P>
<STRONG>(See fit_ellipse.pro)</STRONG><P>
<HR>
<A NAME="FIXED_MAP_GRID">
<H2>FIXED_MAP_GRID</H2></A>
<A HREF="#FIT_ELLIPSE">[Previous Routine]</A>
<A HREF="#FLOATS_EQUAL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FIXED_MAP_GRID
PURPOSE:
The MAP_GRID procedure draws the graticule of parallels and meridians,
according to the specifications established by MAP_SET. MAP_SET must be called
before MAP_GRID to establish the projection type, the center of the
projection, polar rotation and geographical limits.
CATEGORY:
Mapping.
CALLING SEQUENCE:
MAP_GRID
INPUTS:
NONE
OPTIONAL INPUTS:
NONE
KEYWORD PARAMETERS:
BOX_AXES: Surround the map window with a "box" style axes with
annotations, outside the box, where the parallels intersect the
sides, and the meridians intersect the bottom and top edges of the
box. The border of the box is drawn in alternating foreground and
background colors, with color changes at each intersection with
a parallel or meridian. This keyword determines the thickness of
the box's border, in millimeters. If LABEL is not explicitly
specified, it defaults to 1 when this keyword is present. If this
feature is selected, be sure to leave enough room around the map
window for the annotation, usually by specifying the XMARGIN and
YMARGIN keywords to MAP_SET. See the example below.
CHARSIZE: The size of the characters used for the labels. The default is 1.
COLOR: The color index for the grid lines.
FILL_HORIZON: Fills the current map_horizon.
HORIZON: Draws the current map horizon.
INCREMENT: Determines the spacing between graticle points.
GLINESTYLE: If set, the line style used to draw the grid of parallels and
meridians. See the IDL User's Guide for options. The default is
dotted.
GLINETHICK: The thickness of the grid lines. Default is 1.
LABEL: Set this keyword to label the parallels and meridians with their
corresponding latitudes and longitudes. Setting this keyword to
an integer will cause every LABEL gridline to be labeled (i.e,
if LABEL=3 then every third gridline will be labeled). The
starting point for determining which gridlines are labeled is the
minimum latitude or longitude (-180 to 180), unless the LATS or
LONS keyword is set to a single value. In this case, the starting
point is the value of LATS or LONS.
LATALIGN: This keyword controls the alignment of the text baseline for
latitude labels. A value of 0.0 left justifies the label,
1.0 right justifies it, and 0.5 centers it.
LATDEL: The spacing in degrees between parallels of latitude in the grid.
If not set, a suitable value is determined from the current map
projection.
LATS: The desired latitudes to be drawn (and optionally labeled). If
this keyword is omitted, appropriate latitudes will be generated
with consideration of the optional LATDEL keyword. If this
keyword is set to a single value, drawn (and optionally labeled)
latitudes will be automatically generated as
[...,LATS-LATDEL,LATS,LATS+LATDEL,...] over the extent of the
map. The single valued LATS is taken to be the starting point
for labelling (See the LABEL keyword).
LATLAB: The longitude at which to place latitude labels. The default is
the center longitude on the map.
LATNAMES: An array specifing the names to be used for the latitude labels.
By default, this array is automatically generated in units of
degrees. This array can be a string array or numeric, but should
not be of mixed type. When LATNAMES is specified, LATS must also
be specified, but the number of elments in the two arrays need not
be equal. Extra LATNAMES are ignored, while LATNAMES not supplied
are automatically reported in degrees. LATNAMES can be used when
LATS is set to a single value. It this case, the LATS used will
start at the specified latitude and progress northward, wrapping
around the globe if appropriate. Caution should be used when
using LATNAMES in conjunction with a single LATS, since the
number of visible latitude gridlines is dependent on many factors.
LONALIGN: This keyword controls the alignment of the text baseline for
longitude labels. A value of 0.0 left justifies the label,
1.0 right justifies it, and 0.5 centers it.
LONDEL: The spacing in degrees between meridians of longitude in the grid.
If not set, a suitable value is determined from the current map
projection.
LONLAB: The latitude at which to place longitude labels. The default is
the center latitude on the map.
LONS: The desired longitudes to be drawn (and optionally labeled). If
this keyword is omitted, appropriate longitudes will be generated
with consideration of the optional LONDEL keyword. If this
keyword is set to a single value, drawn (and optionally labeled)
longitudes will be automatically generated as
[...,LONS-LONDEL,LONS,LONS+LONDEL,...] over the extent of the map.
The single valued LONS is taken to be the starting point for
labeling (See the LABEL keyword).
LONNAMES: An array specifing the names to be used for the longitude labels.
By default, this array is automatically generated in units of
degrees. This array can be a string array or numeric, but should
not be of mixed type. When LONNAMES is specified, LATS must also
be specified, but the number of elments in the two arrays need not
be equal. Extra LONNAMES are ignored, while LATNAMES not supplied
are automatically reported in degrees. LONNAMES can be used when
LONS is set to a single value. It this case, the LONS used will
start at the specified longitude and progress eastward, wrapping
around the globe if appropriate. Caution should be used when
using LONNAMES in conjunction with a single LONS, since the number
of visible longitude gridlines is dependent on many factors.
MAP_STRUCTURE: Set this keyword to a !MAP structure, as returned from
MAP_PROJ_INIT. If this keyword is set then the gridlines are passed
through MAP_PROJ_FORWARD and the resulting lines are drawn using
Cartesian coordinates. If this keyword is not set then it is assumed
that MAP_SET has been called to set up a map projection.
NO_GRID: Set this keyword if you only want labels but not gridlines.
ORIENTATION: Specifies the clockwise angle in degrees from horizontal
of the text baseline that the labels should be rotated. Note,
that the rotation used in MAP_SET is also clockwise, but XYOUTS
is normally counterclockwise.
T3D: Set this keyword to indicate that the generalized transformation
matrix in !P.T is to be used. If not present, the user-supplied
coordinates are simply scaled to screen coordinates.
ZVALUE: Sets the Z coordinate, in normalized coordinates in the
range of 0 to 1, at which to output the continents.
Note - This keyword has effect only if keyword T3D is set and the
transformation is stored in !P.T
OUTPUTS:
Draws gridlines and labels on the current map.
EXAMPLE:
map_set,10,20,23.5,/cont,/ortho,/horizon ; establish a projection
lats=[-65,-52,-35,-20,-2.59,15,27.6,35,45,55,75,89]
; choose the parallels to draw
map_grid,lats=lats,londel=20,lons=-13,label=2,lonlab=-2.5,latlab=7
;draw the grid
Make a map with a grid surrounded by a box style axis:
map_set, /STEREO, 40, -90,scale=50e6,/CONTINENTS, XMARGIN=3, YMARGIN=3
map_grid, /BOX_AXES, COLOR=3, CHARSIZE=1.5 ;
MODIFICATION HISTORY:
Written by: SVP, May, 23 1996.
DMS, Feb, 1996 Note that this version plots all gridlines
unless a 4 element LIMIT was specified to MAP_SET.
SVP, Nov 1996 Changed over !map1 (new IDL5 maps)
SVP, May 1996 Map_Grid used to live inside of map_set.pro, now
it lives here.
SVP, May 1996 Changed LABEL to determine the skip between labelled
gridlines.
Also, added the LATS and LONS keywords to give complete
control over where the labels go.
SVP, Sept 1996 Added LATNAMS,LONAMES, and ORIENTATION keywords
DMS, Nov, 1996 Rev 2 of maps.
DMS, Jul, 1997 Added Box Axes
CT, Jan 2004: Added MAP_STRUCTURE keyword.
Renamed the function FIXED_MAP_GRID with fixed at lines 555-556 and
664-665 as described here: http://www.dfanning.com/map_tips/missinggrid.html.
This is required to get proper grid output in some applications, but
it breaks other code.
</PRE><P>
<STRONG>(See fixed_map_grid.pro)</STRONG><P>
<HR>
<A NAME="FLOATS_EQUAL">
<H2>FLOATS_EQUAL</H2></A>
<A HREF="#FIXED_MAP_GRID">[Previous Routine]</A>
<A HREF="#FPUFIX">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FLOATS_EQUAL
PURPOSE:
The purpose of this function is to compare two floating-point values or
arrays to determine if the values or arrays are equal. Arrays are equal
if they have the same number of elements, and each element is equal.
To learn why determing if floats are equal is hard (and probably not done
correctly in this program), please read the following article::
http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
result = FLOATS_EQUAL(array_1, array_2)
ARGUMENTS:
array_1 Any single or double precision value or array. Required parameter.
array_2 Any single or double precision value or array. Required parameter.
KEYWORDS:
ULP UNIT in the LAST PLACE. It is the gap or difference between two
floating point numbers in the last digit that can distinguish the
two numbers. Must be a positive integer. Set to 1 by default. Set
to a larger value if you suspect accumulative round-off errors
in your arrays.
RETURN VALUE:
result Set to 1 if the arrays are equal, which means that the arrays have
the same number of elements and each element is equal to the same
element in the other array. Set to 0 if the arrays are not equal.
COMMON BLOCKS:
None.
EXAMPLE:
IDL> a = Findgen(11)
IDL> b = Findgen(11)
IDL> Print, Floats_Equal(a,b)
1
IDL> b[4] = b[4] + 0.0001
IDL> Print, Floats_Equal(a,b)
0
RESTRICTIONS:
None.
MODIFICATION HISTORY:
Written by: David W. Fanning, 29 August 2007.
Fixed a problem when using large numbers with the TOTAL command
by setting the INTEGER keyword. 22 June 2011. DWF.
</PRE><P>
<STRONG>(See floats_equal.pro)</STRONG><P>
<HR>
<A NAME="FPUFIX">
<H2>FPUFIX</H2></A>
<A HREF="#FLOATS_EQUAL">[Previous Routine]</A>
<A HREF="#FSCCLEANUP7">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FPUFIX
PURPOSE:
This is a utility routine to examine a variable and fix problems
that will create floating point underflow errors.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
fixedData = FPUFIX(data)
ARGUMENTS:
data : A numerical variable to be checked for values that will cause
floating point underflow errors. Suspect values are set to 0.
KEYWORDS:
None.
RETURN VALUE:
fixedData: The output is the same as the input, except that any values that
will cause subsequent floating point underflow errors are set to 0.
COMMON BLOCKS:
None.
EXAMPLES:
data = FPTFIX(data)
RESTRICTIONS:
None.
MODIFICATION HISTORY:
Written by David W. Fanning, from Mati Meron's example FPU_FIX. Mati's
program is more robust that this (ftp://cars3.uchicago.edu/midl/),
but this serves my needs and doesn't require other programs from
Mati's library. 24 February 2006.
</PRE><P>
<STRONG>(See fpufix.pro)</STRONG><P>
<HR>
<A NAME="FSCCLEANUP7">
<H2>FSCCLEANUP7</H2></A>
<A HREF="#FPUFIX">[Previous Routine]</A>
<A HREF="#FSCCLEANUP8">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
This procedure cleans up any open graphics windows and widget windows for
versions of IDL prior to IDL 8.
:Categories:
Utility
:Keywords:
all: in, optional, type=boolean, default=1
Set this keyword if you wish to clean up windows of all types.
cg: in, optional, type=boolean, default=0
Set this keyword if you wish to clean up only Coyote Graphics windows.
dg: in, optional, type=boolean, default=0
Set this keyword if you wish to clean up only Direct Graphics windows.
:Examples:
For example, to destroy all windows on the display::
IDL> FSCCleanup7
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Written, 6 October 2012.
:Copyright:
Copyright (c) 2012, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See fsccleanup7.pro)</STRONG><P>
<HR>
<A NAME="FSCCLEANUP8">
<H2>FSCCLEANUP8</H2></A>
<A HREF="#FSCCLEANUP7">[Previous Routine]</A>
<A HREF="#FSC_COLORBAR__DEFINE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
This procedure cleans up any open graphics windows and widget windows for
versions of IDL from IDL 8 onward.
:Categories:
Utility
:Keywords:
all: in, optional, type=boolean, default=1
Set this keyword if you wish to clean up windows of all types.
cg: in, optional, type=boolean, default=0
Set this keyword if you wish to clean up only Coyote Graphics windows.
dg: in, optional, type=boolean, default=0
Set this keyword if you wish to clean up only Direct Graphics windows.
fg: in, optional, type=boolean, default=0
Set this keyword if you wish to clean up only Function Graphics windows.
:Examples:
For example, to destroy all windows on the display::
IDL> FSCCleanup8
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Written, 6 October 2012.
:Copyright:
Copyright (c) 2012, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See fsccleanup8.pro)</STRONG><P>
<HR>
<A NAME="FSC_COLORBAR__DEFINE">
<H2>FSC_COLORBAR__DEFINE</H2></A>
<A HREF="#FSCCLEANUP8">[Previous Routine]</A>
<A HREF="#FSC_COLORSELECT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_COLORBAR__DEFINE
Note: The name of the routine has been changed from COLORBAR__DEFINE
on 25 Sept 2010 to avoid conflicts with an IDL 8.0 routine of the
same name. See the article "IDL 8 Name Conflicts" here:
http://www.idlcoyote.com/ng_tips/idl8_name_conflicts.html
PURPOSE:
The purpose of this routine is to implement a FSC_COLORBAR object
class. The ColorBar is rendered in the direct graphics system.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics.
CALLING SEQUENCE:
colorbar = Obj_New("FSC_COLORBAR")
INPUTS:
All inputs to the program are via keyword parameters.
KEYWORD PARAMETERS:
Background: Background color. This is the color with which the colorbar is
erased. The default color is !P.Background.
Bottom: Bottom color index of colors allocated to colorbar.
Charsize: Character size of annotation. Default is 1.0.
Color: Color of annotation and outline. Default is !P.Color.
Font: Font to use for annotation. Default is -1, Hershey fonts.
Format: Format of annotation. Default is "(F8.2)".
Major: The number of major tick intervals. Default is 5.
Minor: The number of minor tick intervals. Default is 2.
MinusOne: Set this keyword to choose MinusOne keyword on the Congrid command
that resizes the colorbar into the window.
NColors: The number of colors allocated to colorbar. Default is (256 <
!D.N_Colors).
Neighbor: Set to indicate Nearest Neighbor sampling for Congrid. Default is
0 (Bilinear).
Position: The position of colorbar in normalized coordinates. Default for a
horizontal colorbar is [0.15, 0.88, 0.85, 0.95]. Default for a
vertical colorbar is [0.88, 0.15, 0.95, 0.85]. These defaults are
designed for a 400 by 400 window.
Range: The data range on colorbar. Default is [0, 255].
TickLen: The length of tick marks. Default is -0.1
TickV: Locations for the tick marks in data units. This is the same as
the [XY]TickV keyword. Default is to do what IDL would do
normally.
Vertical: Set this keyword if you want a vertical colorbar. Default is
horizontal.
XEraseBox: A five-element vector of X points (normalized) for erasing the
colorbar plot. Normally this keyword will not have to be used.
The program uses the plot REGION for erasing. But larger
character sizes can result in annotation going outside the
region enclosed by the plot. If that is the case, then use this
keyword along with YEraseBox to specify a larger-than-normal
erasure area. The points are sent to the POLYFILL command for
erasing.
POLYFILL, xEraseBox, yEraseBox, /Normal, Color=background
YEraseBox: A five-element vector of Y points (normalized) for erasing the
colorbar plot.
OBJECT METHODS:
Clamp: This procedure method allows the color bar range to be "clamped"
to a particular data range.
Draw: This procedure method draws the colorbar in the display window. The
ERASE keyword to this method will erase the current colorbar (by
calling the ERASE method) before drawing the colorbar in the display
window.
colorbar->Draw
Erase: This procedure method erases the colorbar object in the window. It
accomplishes this by performing a POLYFILL in the background color.
This method is primarily useful for interactive graphics display
devices.
colorbar->Erase
GetProperty: This procedure method allows one to obtain the current state
of the object via the keyword parameters listed above.
colorbar->GetProperty, Range=currentRange, Title=currentTitle
Print, currentRange, currentTitle
SetProperty: This procedure method allows one to set the properties of the
colorbar object via the keywords described above. In addition,
a DRAW and ERASE keyword are provided so that the colorbar can
be immediately drawn when the new property is set.
colorbar->SetProperty, Range=[500, 15000], /Erase, /Draw
COMMON BLOCKS:
None.
SIDE EFFECTS:
The display window is not erased first.
RESTRICTIONS:
None.
EXAMPLE:
To create a colorbar, use it, then destroy it, type:
colorbar = Obj_New("FSC_COLORBAR", Title='Colorbar Values', Range=[0,1000],$
Format='(I4)')
Window
LoadCT, 5
colorbar->Draw
colorbar->SetProperty, Range=[0,500], /Erase, /Draw
Obj_Destroy, colorbar
MODIFICATION HISTORY:
Written by: David Fanning, Fanning Software Consulting,
26 November 1998.
Added Horizontal keyword to SetProperty method and fixed problem in
going from Vertical to Horizontal color bars. 29 Nov 1998. DWF.
Added LoadCT method and current color table index to object.
6 December 1998.
Fixed a bug dealing with nearest neighbor resampling. 30 Mar 1999. DWF.
Fixed a bug with how NCOLORS and BOTTOM keywords interacted.
29 Aug 1999. DWF.
10 Oct 99. Modified the program so that current plot and map coordinates
are saved and restored after the colorbar is drawn. DWF.
26 May 2000 Added {XY}TICKV capability to the draw method. This
required adding TickV to the object data structure, and to the
INIT, GetProperty and SetProperty methods.
Changed default tick length to -0.1. DWF (and Jack Saba)
18 Nov 2001. Added Clamp method. DWF.
25 September 2010. Renamed to FSC_Colorbar__Define to avoid conflict with a
Colorbar__Define program introduced with IDL 8.0. DWF.
</PRE><P>
<STRONG>(See fsc_colorbar__define.pro)</STRONG><P>
<HR>
<A NAME="FSC_COLORSELECT">
<H2>FSC_COLORSELECT</H2></A>
<A HREF="#FSC_COLORBAR__DEFINE">[Previous Routine]</A>
<A HREF="#FSC_DROPLIST">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_COLORSELECT
PURPOSE:
The purpose of this compound widget is to provide a means for selecting
a new color or color table in a widget program. The program consists of
a label, a non-editable text widget, and a button to make a color or
color table selection interactively. (See the example program.)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
objectRef = FSC_COLORSELECT(parent, Title='Annotate Color ", Color='red')
INPUT PARAMETERS:
parent -- The parent widget ID of the compound widget. Required.
INPUT KEYWORDS:
BREWER: Set if you want Brewer color tables, rather than the normal IDL color tables.
This requires the file fsc_brewer.tbl to be in your IDL path.
CFONT: Set to the name of a font to display the color name in.
COLOR: The name of the color to be displayed in the widget. If color
is not used, or if it is set to a null string, then the widget
will allow selection of a color table, instead of a color name.
CT_INDEX: The color table index number you wish to use. The actual name of the
color table will be displayed in the widget.
EVENT_FUNC: Set this keyword to the name of an Event Function. If this
keyword is undefined and the Event_Pro keyword is undefined,
all compound widget events are handled internally and not
passed on to the parent widget.
EVENT_PRO: Set this keyword to the name of an Event Procedure. If this
keyword is undefined and the Event_Func keyword is undefined,
all compound widget events are handled internally and not
passed on to the parent widget.
FRAME: Set this keyword to put a frame around the compound widget.
LABELALIGN: Set this keyword to align label text. [0-center (default), 1-left, 2-right].
LABELFONT: The font name for the text in the Label Widget.
LABELSIZE: The X screen size of the Label Widget.
NAME: A scalar string name of the object. (Default = ''.)
SCR_XSIZE: The X screen size of the compound widget.
SCR_YSIZE: The Y screen size of the compound widget.
STYLE: The "style" of the text in the Text Widget. A value of 0 (the default)
capitalizes the first letter in the name. A style of 1 uses all lowercase.
A style of 2 uses all uppercase.
TITLE: The text to go on the Label Widget.
UVALUE: A user value for any purpose.
XSIZE: The X size of the Text Widget.
In addition, any keyword defined for WIDGET_TEXT, but not defined here (e.g., SENSITIVE), is
passed along without inspection to the text widget. Use of "extra" keywords is discouraged.
COMMON BLOCKS:
None.
RESTRICTIONS:
None.
EVENT STRUCTURE:
All events are handled internally unless either the Event_Pro or Event_Func
keywords are used to assign an event handler to the compound widget.
event = { FSC_ColorSelect_Event, $; The name of the event structure.
ID: 0L, $ ; The ID of the compound widget's top-level base.
TOP: 0L, $ ; The widget ID of the top-level base of the hierarchy.
HANDLER: 0L, $ ; The event handler ID. Filled out by IDL.
Color: "", $ ; The name of the current color or color table.
Index: 0L, $ ; The color table index selected if color tables are used.
Brewer: 0L, $ ; A flag that indicated Brewer color tables are being used.
NColors: 0L, $ ; The number of colors used for the color table.
ObjRef:Obj_New()} ; The "self" object.
GETTING and SETTING VALUES:
Almost all the properties of the widget can be obtained or set via
the object's GetProperty and SetProperty methods (described below).
But since traditional compound widgets have the ability to get and
set the value of the compound widget, this capability is implemented
as special methods: Get_Color/Set_Color and Get_Color_Index/Set_Color_Index.
To get the color of the widget, do this: color = objectRef->Get_Color()
To set the color of the widget, do this: objectRef->Set_Color, 'blue'.
Valid colors are those returned by FSC_Color. Getting and setting the
color table index number works similarly.
EXAMPLE:
An example program is provided at the end of the FSC_COLORSELECT code. To run it,
type these commands:
IDL> .Compile FSC_COLORSELECT
IDL> Example
DEPENDENCIES:
Requires the Coyote Library:
http://www.idlcoyote.com/programs/coyoteprograms.zip
MODIFICATION HISTORY:
Written by: David W. Fanning, 26 JULY 2010.
</PRE><P>
<STRONG>(See fsc_colorselect.pro)</STRONG><P>
<HR>
<A NAME="FSC_DROPLIST">
<H2>FSC_DROPLIST</H2></A>
<A HREF="#FSC_COLORSELECT">[Previous Routine]</A>
<A HREF="#FSC_FIELD">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_DROPLIST
PURPOSE:
The purpose of this compound widget is to provide an alternative
to the DROPLIST widget offered in the IDL distribution. What has
always annoyed me about a droplist is that you can't get the current
"value" of a droplist easily. This compound widget makes this and
other tasks much easier.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
droplistObj = FSC_Droplist(parent, Title='Animals: ", Value=['Dog'. 'Cat', 'Coyote'], Index=2)
The return value of the FSC_Droplist (droplistObj in this example) is
an object reference. Interaction with the droplist will occur through
object methods.
INPUT PARAMETERS:
parent -- The parent widget ID of the compound widget. Required.
INPUT KEYWORDS:
Any keyword that is appropriate for the Widget_Droplist function can be used.
In addition, these keywords are explicitly defined.
EVENT_FUNC -- Set this keyword to the name of an Event Handler Function.
EVENT_PRO -- Set this keyword to the name of an Event Handler Procedure.
FORMAT -- A format specifier for the "format" of the values in the droplist.
INDEX -- The index number of the current selection.
SPACES -- A two-element array that indicates the number of blank spaces to be added
to the the beginning and end of the formatted values. If a single number
is provided, this number of blank spaces is added to both the beginning
and the end of the value.
TITLE -- The title of the droplist widget.
UNAME -- The user name of the droplist widget. (Only available in IDL 5.2 and higher.)
UVALUE -- The normal "user value" of the droplist.
VALUE -- An array of the droplist "selections". May be any data type.
COMMON BLOCKS:
None.
EVENT STRUCTURE:
An event is returned each time the droplist value is changed. The event structure
is defined like this:
event = { FSC_DROPLIST_EVENT, $ ; The name of the event structure.
ID: 0L, $ ; The ID of the compound widget's top-level base.
TOP: 0L, $ ; The widget ID of the top-level base of the hierarchy.
HANDLER: 0L, $ ; The event handler ID. Filled out by IDL.
INDEX: 0L, $ ; The index number of the current selection.
SELECTION:Ptr_New() $ ; A pointer to the current selection "value".
SELF:Obj_New() } ; The object reference of the compound widget.
PUBLIC OBJECT METHODS:
GetID -- A function with no arguments that returns the widget identifier
of the droplist widget.
droplistID = droplistObj->GetID()
GetIndex -- A function with no arguments that returns the index
number of the current droplist selection.
currentIndex = droplistObj->GetIndex()
GetSelection -- A function with no arguments that returns the current
droplist selection.
currentSelection = droplistObj->GetSelection()
GetUValue -- A function with no arguments that returns the "user value"
of the compound widget i.e., the value set with the UVALUE keyword).
myUValue = droplistObj->GetUValue()
GetValues -- A function with no arguments that returns the "values" or
"selections" for the droplist.
possibleSelections = droplistObj->GetValues()
Resize -- A procedure that sets the X screen size of the droplist. It is
defined like this:
PRO Resize, newSize, ParentSize=parentSize
The "newSize" keyword is the new X screen size. If this argument is
missing, the screen X size of the compound widget's parent is used.
The parentSize keyword is an output keyword that returns the X screen
size of the compound widget's parent.
droplistObj->Resize, 400
Note that not all devices (e.g., X Windows devices) support droplist resizing.
SetIndex -- A procedure that sets the current droplist selection based on
the given index. This is equivalent to Widget_Control, droplistID, Set_Droplist_Select=newIndex
droplistObj->SetIndex, newIndex
SetSelection -- Whereas a regular droplist widget can only be set by index
number, this compound widget can also be set by a "selection". The new selection
can be any data type and corresponds to one of the "values" of the droplist.
droplistObj->SetSelection, newSelection
SetValues -- Sets the possible selections of the droplist widget. The CurrentIndex keyword
will allow the current index of the selection to be changed to:
newChoices = ['dog', 'cat', 'coyote']
droplistObj->SetValues, newChoices, CurrentIndex=2
EXAMPLE:
An example program is provided at the end of the FSC_DROPLIST code. To run it,
type these commands:
IDL> .Compile FSC_DROPLIST
IDL> Example
MODIFICATION HISTORY:
Written by: David W Fanning, 17 Jan 2000. DWF.
Added FORMAT and SPACES keywords 28 April 2000. DWF.
Fixed a small problem with event processing when the EVENT_FUNC keyword
was used. 29 Dec 2000. DWF.
Attached the UNAME value to the TLB of the compound widget instead
of to the droplist widget itself. 11 Jan 2001. DWF.
Fixed a problem when the droplist was part of a modal widget and used the
EVENT_PRO keyword. 27 Oct 2003. DWF.
Added a SetValue method for setting all the values in the droplist at once. 12 Nov 2004. DWF.
Fixed type on line 346/ 6 Feb 2008. DWF.
</PRE><P>
<STRONG>(See fsc_droplist.pro)</STRONG><P>
<HR>
<A NAME="FSC_FIELD">
<H2>FSC_FIELD</H2></A>
<A HREF="#FSC_DROPLIST">[Previous Routine]</A>
<A HREF="#FSC_FILESELECT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_FIELD
PURPOSE:
The purpose of this compound widget is to provide an alternative
to the CW_FIELD widget offered in the IDL distribution. One weakness
of the CW_FIELD compound widget is that the text widgets do not
look editable to the users on Windows platforms. This program
corrects that deficiency and adds some features that I think
will be helpful. For example, you can now assign an event handler
to the compound widget, ask for positive numbers only, and limit
the number of digits in a number, or the number of digits to the
right of a decimal point. The program is written as a widget object,
which allows the user to call object methods directly, affording
even more flexibility in use. This program replaces the earlier
programs FSC_INPUTFIELD and COYOTE_FIELD.
The program consists of a label widget next to a one-line text widget.
The "value" of the compound widget is shown in the text widget. If the
value is a number, it will not be possible (generally) to type
alphanumeric values in the text widget. String values behave like
strings in any one-line text widget.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
TYPICAL CALLING SEQUENCE:
fieldID = FSC_FIELD(parent, Title="X Size:", Value=256, Object=fieldObject, Digits=3)
INPUT PARAMETERS:
parent -- The parent widget ID of the compound widget. Required.
INPUT KEYWORDS:
COLUMN Set this keyword to have the Label widget above the Text widget.
The default is to have the Label widget in a row with the Text widget.
CR_ONLY Set this keyword if you only want Carriage Return events returned to
your event handler. If this keyword is not set, all events are returned.
Setting this keyword has no effect unless either the EVENT_PRO or
EVENT_FUNC keyword is used.
DECIMAL Set this keyword to the number of digits to the right of the decimal
point in floating point or double precision numbers. Ignored for STRING values.
DIGITS Set this keyword to the number of digits permitted in integer numbers.
EVENT_FUNC Set this keyword to the name of an event handler function. If this
keyword is undefined and the Event_Pro keyword is undefined,
all compound widget events are handled internally and not
passed on to the parent widget.
EVENT_PRO Set this keyword to the name of an event handler procedure. If this
keyword is undefined and the Event_Func keyword is undefined,
all compound widget events are handled internally and not
passed on to the parent widget.
FIELDFONT The font name for the text in the text widget.
FRAME Set this keyword to put a frame around the compound widget.
FOCUS_EVENTS Set this keyword to enable event generation for keyboard focus
events. Ignored unless EVENT_FUNC or EVENT_PRO keywords are specified.
HIGHLIGHT Set this keyword to highlight the existing text if the widget gain
the keyboard focus. This keyword MUST be set for tabbing to work naturally
in IDL 6.2 and higher.
LABEL_LEFT Set this keyword to align the text on the label to the left.
LABEL_RIGHT Set this keyword to align the text on the label to the right.
LABELFONT The font name for the text in the label widget.
LABELSIZE The X screen size of the label widget.
NAME A string containing the name of the object. The default is ''.
NOEDIT Set this keyword to allow no user editing of the input text widget.
NONSENSITIVE Set this keyword to make the input text widget non-sensitive.
POSITIVE Set this keyword if you want only positive numbers allowed.
SCR_XSIZE The X screen size of the compound widget.
SCR_YSIZE The Y screen size of the compound widget.
TITLE The string text placed on the label widget.
UNDEFINED Set this keyword to the value to use for "undefined" values. If
not set, then !Value.F_NAN is used for numerical fields and a
NULL string is used for string fields. This applies to values
obtained with the GET_VALUE method or the GET_VALUE function.
UVALUE A user value for any purpose.
VALUE The "value" of the compound widget. Any type of integer, floating, or string
variable is allowed. The data "type" is determined automatically from the
value supplied with this keyword. Be sure you set the type appropriately for
your intended use of the value.
XSIZE The X size of the text widget in the usual character units.
OUTPUT KEYWORDS:
OBJECT Set this keyword to a named variable to receive the compound widget's
object reference. This is required if you wish to call methods on the object.
Note that the object reference is also available in the event structure
generated by the widget object. Note that the object reference will be
necessary if you want to get or set values in the compound widget.
COMMON BLOCKS:
None.
RESTRICTIONS:
Requires cgDblToStr from the Coyote Library:
http://www.idlcoyote.com/programs/cgdbltostr.pro
EVENT STRUCTURE:
All events are handled internally unless either the Event_Pro or Event_Func
keywords are used to assign an event handler to the compound widget. By
default all events generated by the text widget are passed to the assigned
event handler. If you wish to receive only Carriage Return events, set the
CR_Only keyword.
event = { FSC_FIELD_EVENT, $ ; The name of the event structure.
ID: 0L, $ ; The ID of the compound widget's top-level base.
TOP: 0L, $ ; The widget ID of the top-level base of the hierarchy.
HANDLER: 0L, $ ; The event handler ID. Filled out by IDL.
OBJECT: Obj_New(), $ ; The "self" object reference. Provided so you can call methods.
VALUE: Ptr_New(), $ ; A pointer to the widget value.
TYPE:"" ; A string indicating the type of data in the VALUE field.
}
Note that if the field is "empty", the VALUE will be a pointer
to an undefined variable. You should check this value before you
use it. You code will look something like this:
IF N_Elements(*event.value) EQ 0 THEN $
Print, 'Current Value UNDEFINED.' ELSE $
Print, 'Current Value: ', *event.value
GETTING and SETTING VALUES:
Almost all the properties of the widget can be obtained or set via
the object's GetProperty and SetProperty methods (described below).
Traditional compound widgets have the ability to get and set the "value"
of the compound widget identifier (e.g., fieldID in the calling
sequence above). Unfortunately, it is impossible to retreive a variable
in this way when the variable is undefined. In practical terms, this
means that the undefined variable must be set to *something*. You can
determine what that something is with the UNDEFINED keyword, or I will set
it to !VALUES.F_NAN for numerical fields and to the null string for string
fields. In any case, you will have to check for undefined variables before
you try to do something with the value. For a numerical field, the code
might look something like this:
fieldID = FSC_FIELD(parent, Title="X Size:", Value=256, Object=fieldObject, Digits=3)
currentValue = fieldObject->Get_Value()
IF Finite(currentValue) EQ 0 THEN Print, 'Value is Undefined' ELSE Print, currentValue
Additional examples are provided in the numerical example fields in Example Program below.
Setting the value of the compound widget is the same as calling the Set_Value
method on the object reference. In other words, these two statements are equivalent.
fieldObject->Set_Value, 45.4
Widget_Control, fieldID, Set_Value=45.4
The data type of the value is determined from the value itself. Be sure you set it appropriately.
OBJECT PROCEDURE METHODS:
GetProperty -- This method allows various properties of the widget to be
returned via output keywords. The keywords that are available are:
CR_Only -- A flag, if set, means only report carriage return events.
DataType -- The data type of the field variable.
Decimal -- Set this keyword to the number of digits to the right of the decimal
point in FLOATVALUE and DOUBLEVALUE numbers.
Digits -- Set this keyword to the number of digits permitted in INTERGERVALUE and LONGVALUE numbers.
Event_Func -- The name of the event handler function.
Event_Pro -- The name of the event handler function.
Has_Focus -- Set to 1 if the text widget currently has the keyboard focus.
Highlight -- The highlight flag.
NoEdit -- The NoEdit flag.
NonSensitive -- The NonSensitive flag.
Undefined -- The "value" of any undefined value.
UValue -- The user value assigned to the compound widget.
Value -- The "value" of the compound widget.
Name -- A scalar string name of the object.
Resize -- This method allows you to resize the compound widget's text field.
The value parameter is an X screen size for the entire widget. The text
widget is sized by using the value obtained from this value minus the
X screen size of the label widget.
objectRef->Resize, screen_xsize_value
Set_Value -- This method allows you to set the "value" of the field. It takes
one positional parameter, which is the value.
objectRef->Set_Value, 5
SetProperty -- This method allows various properties of the widget to be
set via input keywords. The keywords that are available are:
CR_Only -- Set this keyword if you only want Carriage Return events.
Decimal -- Set this keyword to the number of digits to the right of the decimal
point in FLOAT and DOUBLE numbers.
Digits -- Set this keyword to the number of digits permitted in INTERGER and LONG numbers.
Event_Func -- Set this keyword to the name of an Event Function.
Event_Pro -- Set this keyword to the name of an Event Procedure.
Highlight -- Set this keyword to highlight the existing text
when the widget gets the keyboard focus
LabelSize -- The X screen size of the Label Widget.
Name -- A scalar string name of the object. (default = '')
NoEdit -- Set this keyword to make the text widget uneditable
NonSensitive -- Set this keyword to make the widget nonsensitive
Scr_XSize -- The X screen size of the text widget.
Scr_YSize -- The Y screen size of the text widget.
Title -- The text to go on the Label Widget.
UValue -- A user value for any purpose.
Value -- The "value" of the compound widget.
XSize -- The X size of the Text Widget.
SetTabNext -- This method allows you to specify which field to go to when a TAB character
is typed in the text widget. See the Example program below for an example of how to
use this method.
OBJECT FUNCTIONS METHODS:
Get_Value -- Returns the "value" of the field. No parameters. Will be undefined
if a "number" field is blank. Should be checked before using:
IF N_Elements(objectRef->Get_Value()) NE 0 THEN Print, Value is: ', objectRef->Get_Value()
GetID -- Returns the widget identifier of the compound widget's top-level base.
(The first child of the parent widget.) No parameters.
GetLabelSize -- Returns the X screen size of the label widget. No parameters.
GetTextID -- Returns the widget identifier of the compound widget's text widget.
No parameters.
GetTextSize -- Returns the X screen size of the text widget. No parameters.
PRIVATE OBJECT METHODS:
Although there is really no such thing as a "private" method in IDL's
object implementation, some methods are used internally and not meant to
be acessed publicly. Here are a few of those methods. I list them because
it may be these private methods are ones you wish to override in subclassed
objects.
MoveTab -- This method moves the focus to the widget identified in the "next" field,
which must be set with the SetTabNext method. No parameters. Called automatically
when a TAB character is typed in the text widget.
Text_Events -- The main event handler method for the compound widget. All
text widget events are processed here.
ReturnValue -- This function method accepts a string input value and converts
it to the type of data requested by the user.
Validate -- This function method examines all text input and removes unwanted
characters, depending upon the requested data type for the field. It makes it
impossible, for example, to type alphanumeric characters in an INTEGER field.
EXAMPLE:
An example program is provided at the end of the FSC_FIELD code. To run it,
type these commands:
IDL> .Compile FSC_Field
IDL> Example
MODIFICATION HISTORY:
Written by: David W. Fanning, 18 October 2000. Based heavily on an earlier
FSC_INPUTFIELD program and new ideas about the best way to write
widget objects.
Added LABEL_LEFT, LABEL_RIGHT, and UNDEFINED keywords. 29 Dec 2000. DWF.
Modified the way the value is returned in the GET_VALUE method and the
GET_VALUE function. Modified Example program to demonstrate. 30 Dec 2000. DWF.
Added NOEDIT and NONSENSITIVE keywords, with corresponding SETEDIT and SETSENNSITIVE
methods. 19 Jan 2001. DWF.
Actually followed through with the changes I _said_" I made 29 Dec 2000. (Don't ask....) 13 June 2001. DWF.
Added GetTextSize and GetLabelSize methods for obtaining the X screen
size of the text and label widgets, respectively. 21 July 2001. DWF.
Fixed a problem in SetProperty method where I was setting self.xsize, which doesn't exist. 24 April 2002. DWF.
Small modification to the SetEdit method. 6 August 2003. DWF.
Added Highlight keyword. Ported Focus_Events keyword from
fsc_inputfield.pro. Updated documentation. 17 November
2004. DWF and Benjamin Hornberger
Added Has_Focus keyword to the GetProperty method. 18 November
2004. Benjamin Hornberger
Fixed bug in GetProperty method (set value to *self.undefined if
*self.value is undefined. 24 Feb 2004. Benjamin Hornberger
Modified FOCUS_EVENTS keyword handling so that *all* focus events are now
passed to specified event handlers. Check event.select to see if the
widget is gaining or losing focus. 10 August 2005. DWF.
Added new tabbing functionality, introduced in IDL 6.2. To use tabbing
functionality natually, the HIGHTLIGHT keywords must be set.
See included EXAMPLE program for details. 10 August 2005. DWF.
Added functionality to covert double precision values to strings properly. 30 Nov 2005. DWF.
Set the default fonts to be the current widget font, rather than the default widget font. 4 Oct 2008. DWF.
Fixed a problem with validating a float or double value when it was written with
exponential notation. 2 April 2010. DWF.
</PRE><P>
<STRONG>(See fsc_field.pro)</STRONG><P>
<HR>
<A NAME="FSC_FILESELECT">
<H2>FSC_FILESELECT</H2></A>
<A HREF="#FSC_FIELD">[Previous Routine]</A>
<A HREF="#FSC_INPUTFIELD">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_FILESELECT
PURPOSE:
The purpose of this compound widget is to provide a means
by which the user can type or select a file name. The
program is written as an "object widget", meaning that
the guts of the program is an object of class FSC_FILESELECT.
This is meant to be an example of the obvious advantages of
writing compound widget programs as objects.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
filenameID = FSC_FileSelect(parent)
INPUT PARAMETERS:
parent -- The parent widget ID of the compound widget. Required.
INPUT KEYWORDS:
Event_Pro -- The event handler procedure for this compound widget.By default: "".
Event_Func -- The event handler function for this compound widget. By default: "".
If neither EVENT_PRO or EVENT_FUNC is defined, program events are handled internally by the compound widget.
DirectoryName -- The initial name of the directory. By defaut: current directory.
Filename -- The initial file name in the filename text widget.
Filter -- The file filter. By default: "*".
Frame -- Set this keyword for a frame around the compound widget.
LabelFont -- The font for the label widget. By default: "".
LabelName -- The text on the label widgt. By default: "Filename: ".
LabelSize -- The X screen size of the label widget. By default: 0.
MustExist -- A flag that indicates selected files must exist. By default: 0.
NoMaxSize -- A flag to prohibit automatic text widget sizing. By default: 0.
If this keyword is not set, the compound widget will automatically resize itself to
the largest widget in its parent base widget. It will do this by changing the size of
the text widgets holding the file and directory names.
Read -- Set this keyword to have file selection for reading a file. By default: 1.
SelectDirectory -- The default directory for file selection. In other words, this is the
default directory for DIALOG_PICKFILE, which is accessed via the BROWSE buttons.
SelectFont -- The font for the "Browse" button. By default: "".
SelectTitle -- The title bar text on the file selection dialog. By default: "Select a File...".
TextFont -- The font for the filename text widget. By default: "".
UValue -- User value for any purpose.
Write -- Set this keyword to open a file for writing. By default: 0.
XSize -- The X size of the text widget holding the filename. By default: StrLen(filename) * 1.5 > 40.
OUTPUT KEYWORDS:
ObjectRef -- Assign this keyword to an output variable that will hold the internal object reference.
With the object reference you can call object methods to easily change many properties of
the compound widget.
COMMON BLOCKS:
None.
EVENT STRUCTURE:
All events are handled internally unless either the Event_Pro or Event_Func
keywords are used to assign an event handler to the compound widget. All events
generated by the text widgets are passed to the assigned event handler.
event = { CW_FILESELECT, $ ; The name of the event structure.
ID: 0L, $ ; The ID of the compound widget's top-level base.
TOP: 0L, $ ; The widget ID of the top-level base of the hierarchy.
HANDLER: 0L, $ ; The event handler ID. Filled out by IDL.
Basename: "", $ ; The base filename without directory specifiers.
Filename: "", $ ; The fully qualified filename.
Directory: "", $ ; The name of the current file directory.
}
EXAMPLE:
An example program is provided at the end of the FSC_FILESELECT code. To run it,
type these commands:
IDL> .Compile fsc_fileselect
IDL> Example
Or, if you want to obtain the object reference, type this:
IDL> Example, theObject
Now you can call the object's methods. For example:
IDL theObject->SetProperty, XSize=150
GETTING and SETTING VALUES:
So as not to disrupt the accepted paradigm in using compound widgets, you
can use the return value of the FSC_FILESELECT function with WIDGET_CONTROL to
get and set the "value" of the widget.
Widget_Control, filenameID, Set_Value='C:\RSI\IDL52\DATA\cyclone.dat'
The program will automatically separate the file name portion of the value
from the directory portion and put things in the correct text widgets.
Similarly, you can get the "value" of the widget:
Widget_Control, filenameID, Get_Value=theValue
Print, theValue
C:\RSI\IDL52\DATA\cyclone.dat
The return value is the fully qualified file path to the file.
USING OBJECT METHODS to CHANGE PROGRAM PROPERTIES:
If you obtain the object reference, you have a great deal more control
over the properties of the compound widget. You obtain the object reference
by calling the function like this:
filenameID = FSC_FILESELECT(parent, ObjectRef=theObject)
OBJECT PROCEDURE METHODS:
GetProperty -- This method allows various properties of the widget to be
returned via output keywords. The keywords that are available are:
DirectoryName -- The current directory.
Event_Func -- The name of the event handler function for this compound widget.
Event_Pro -- The name of the event handler procedure for this compound widget.
Filename -- The current base filename.
Filter -- The current file filter.
LabelName -- The text on the label widget.
LabelSize -- The X screen size of the label widget.
MustExist -- A flag that indicates selected files must exist to be selected.
Parent -- The parent widget of the compound widget.
Read=read -- The file selection for reading flag.
SelectTitle -- The title bar text on the file selection dialog.
TLB -- The top-level base of the compound widget.
UValue -- The user value of the compound widget.
Write -- The file selection for writing flag.
XSize -- The X size of the text widget holding the filename.
LabelSize -- This method makes sure that the directory name and file name labels
are the same size. Normally, this procedure is called internally. No parameters.
MatchSize -- This method resizes the compound widget so that it is as long as the
the longest widget in the parent base widget. This is done automatically upon
realization unless the NOMAXSIZE keyword is set. The method aids in writing
resizeable widget programs.
SetProperty -- This method allows various properties of the widget to be
set via input keywords. The keywords that are available are:
DirectoryName -- The current directory.
Event_Func -- The name of the event handler function for this compound widget.
Event_Pro -- The name of the event handler procedure for this compound widget.
Filename -- The current base filename.
Filter -- The current file filter.
LabelName -- The text on the label widget.
LabelSize -- The X screen size of the label widget.
MustExist -- A flag that indicates selected files must exist to be selected.
Read -- The file selection for reading flag.
SelectTitle -- The title bar text on the file selection dialog.
UValue -- The user value of the compound widget.
Write -- The file selection for writing flag.
XSize -- The X size of the text widget holding the filename.
TextSelect - Allows you to create a selection in filename text widget. See the
documentation for the SET_TEXT_SELECT keyword to Widget_Control.
selection -- A two-element array containing the starting position and selection length.
OBJECT FUNCTION METHODS:
GetFileName -- Returns the fully qualified filename. No parameters.
GetTLB -- Returns the top-level base ID of the compound widget. No Parameters.
Inspect_DirectoryName -- Inspects the directory name for correctness. Requires one positional parameter.
directoryName -- The name of the directory from the directory text widget.
textSelection -- The current text selection position.
At the moment all this does is remove any blank characters from either
end of the directory name and makes sure the last character of the directory
name does not end in a subdirectory specifier (except for VMS).
Inspect_Filename -- Inspects the file name for correctness. Requires one positional parameter.
filename -- The name of the file from the filename text widget.
textSelection -- The current text selection position.
At the moment all this does is remove any blank characters from either
end of the file name
MODIFICATION HISTORY:
Written by: David W. Fanning, 21 NOV 1999.
Fixed bug in File Name selection button. 18 MAR 2000. DWF.
Fixed an error in which directory the Browse buttons should start
searching. 29 SEP 2000. DWF.
Previously returned events only for typing in text widgets. Now
Browse button events are also returned. 29 SEP 2000. DWF.
Fixed a bug in setting the file filter. 29 SEP 2000. DWF.
Removed the Directory Browse button 10 AUG 2002. DWF.
Added cgErrorMsg to error handling. 10 AUG 2002. DWF.
Changed the ability to specify a file filter as a string array, instead
of just as a scalar string. This required the use of a pointer, which
meant that I had to remove the FILTER field from the CW_FILESELECT
event structure to avoid likely memory leakage. This is a dangerous
change because it means programs that relied on this (I expect there
are very, very few) will break and it goes against my philosopy of
keeping my programs backward compatible. Let me know if you have
problems. In testing, I discoved no problems in my own code. 31 OCT 2002. DWF.
Fixed a problem with DIALOG_PICKFILE that sometimes allowed users to change
directories without selecting a file. 3 Nov 2002. DWF.
Fixed a problem with widget resizing with the help of Bob Portman that had plagued
me from the beginning. Thanks, Bob! 5 August 2003. DWF
Added TEXTSELECT method. 5 Aug 2003. DWF.
Had to add FORWARD_FUNCTION statement to get error handler compiled when using
DIRECTORY keyword. 24 Nov 2003. DWF.
Fixed a problem with too many events going to an event handler specified with
the EVENT_PRO or EVENT_FUNC keyword from the text widget. Now only Carriage
Return events are passed on to the user-specified event handler. 8 July 2004. DWF.
Replace all "\" characters with "/" characters in directory names. 8 Januay 2006. DWF.
Set the default fonts to be the current widget font, rather than the default widget font. 4 Oct 2008. DWF.
</PRE><P>
<STRONG>(See fsc_fileselect.pro)</STRONG><P>
<HR>
<A NAME="FSC_INPUTFIELD">
<H2>FSC_INPUTFIELD</H2></A>
<A HREF="#FSC_FILESELECT">[Previous Routine]</A>
<A HREF="#FSC_PLOTWINDOW">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_INPUTFIELD
PURPOSE:
The purpose of this compound widget is to provide an alternative
to the CW_FIELD widget offered in the IDL distribution. What has
always bothered me about CW_FIELD is that the text widgets do not
look editable to the users on Windows platforms. This program
corrects that deficiency and adds some features that I think
would be helpful. For example, you can now assign an event handler
to the compound widget. The program is written entirely as an object.
A companion program, COYOTE_FIELD, has much the same functionality,
but is written as a traditional compound widget. The point of writing
the same program in two different ways is to give you the opportunity
to compare and contrast the two methods. I personally think there
is no substitute for the power of object programs. :-)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
objectRef = FSC_INPUTFIELD(parent, Title='X Size: ", Value=256, /IntegerValue)
INPUT PARAMETERS:
parent -- The parent widget ID of the compound widget. Required.
INPUT KEYWORDS:
Column -- Set this keyword to have the Label Widget above the Text Widget.
CR_Only -- Set this keyword if you only want Carriage Return events. Note that no
events are returned unless the EVENT_PRO or EVENT_FUNC keywords are also used.
Decimal -- Set this keyword to the number of digits to the right of the decimal
point in FLOATVALUE and DOUBLEVALUE numbers.
Digits -- Set this keyword to the number of digits permitted in INTERGERVALUE and LONGVALUE numbers.
DoubleValue -- Set this keyword if you want DOUBLE values returned.
Event_Func -- Set this keyword to the name of an Event Function. If this
keyword is undefined and the Event_Pro keyword is undefined,
all compound widget events are handled internally and not
passed on to the parent widget.
Event_Pro -- Set this keyword to the name of an Event Procedure. If this
keyword is undefined and the Event_Func keyword is undefined,
all compound widget events are handled internally and not
passed on to the parent widget.
FieldFont -- The font name for the text in the Text Widget.
FloatValue -- Set this keyword for FLOAT values.
Focus_Events -- Set this keyword if you only want text events when the keyboard focus is
moved out of the text widget. Note that no events are returned unless the
EVENT_PRO or EVENT_FUNC keywords are also used.
Frame -- Set this keyword to put a frame around the compound widget.
IntegerValue -- Set this keyword for INTEGER values.
LabelAlign -- Set this keyword to align label text. [0-center (default), 1-left, 2-right].
LabelFont -- The font name for the text in the Label Widget.
LabelSize -- The X screen size of the Label Widget.
LongValue -- Set this keyword for LONG values.
Name -- A scalar string name of the object. (default = '')
Positive -- Set this keyword if you want only positive numbers allowed.
Row=row -- Set this keyword to have the Label beside the Text Widget. (The default.)
Scr_XSize -- The X screen size of the compound widget.
Scr_YSize -- The Y screen size of the compound widget.
StringValue -- Set this keyword for STRING values. (The default.)
Title -- The text to go on the Label Widget.
UValue -- A user value for any purpose.
Value -- The "value" of the compound widget.
XSize -- The X size of the Text Widget.
In addition, any keyword defined for WIDGET_TEXT, but not defined here (e.g., SENSITIVE), is
passed along without inspection to the text widget. Use of "extra" keywords is discouraged.
COMMON BLOCKS:
None.
RESTRICTIONS:
None.
EVENT STRUCTURE:
All events are handled internally unless either the Event_Pro or Event_Func
keywords are used to assign an event handler to the compound widget. By
default all events generated by the text widget are passed to the assigned
event handler. If you wish to receive only Carriage Return events, set the
CR_Only keyword.
event = { FSC_INPUTFIELD_EVENTS, $ ; The name of the event structure.
ID: 0L, $ ; The ID of the compound widget's top-level base.
TOP: 0L, $ ; The widget ID of the top-level base of the hierarchy.
HANDLER: 0L, $ ; The event handler ID. Filled out by IDL.
ObjRef: Obj_New(), $ ; The "self" object reference. Provided so you can call methods.
Value: Ptr_New(), $ ; A pointer to the widget value.
Type:"" ; A string indicating the type of data in the VALUE field.
} ; Values are "INT", "LONG", "FLOAT", "DOUBLE", or "STRING".
GETTING and SETTING VALUES:
Almost all the properties of the widget can be obtained or set via
the object's GetProperty and SetProperty methods (described below).
But since traditional compound widgets have the ability to get and
set the value of the compound widget, this capability is implemented
as special methods.
To get the value of the field, do this: value = objectRef->Get_Value()
To set the value of the field, so this: objectRef->Set_Value, value, /IntegerValue
The proper keyword should be used to set the data type of the value. If a keyword
is not used, the data type is determined from the value itself.
OBJECT PROCEDURE METHODS:
GetProperty -- This method allows various properties of the widget to be
returned via output keywords. The keywords that are available are:
CR_Only -- A flag, if set, means only report carriage return events.
DataType -- The data type of the field variable.
Decimal -- Set this keyword to the number of digits to the right of the decimal
point in FLOATVALUE and DOUBLEVALUE numbers.
Digits -- Set this keyword to the number of digits permitted in INTERGERVALUE and LONGVALUE numbers.
Event_Func -- The name of the event handler function.
Event_Pro -- The name of the event handler function.
Positive -- Indicates if the Positive number flag is set (1) or not (0).
UValue -- The user value assigned to the compound widget.
Value -- The "value" of the compound widget.
Name -- A scalar string name of the object.
Resize -- This method allows you to resize the compound widget's text field.
The value parameter is an X screen size for the entire widget. The text
widget is sized by using the value obtained from this value minus the
X screen size of the label widget.
objectRef->Resize, screen_xsize_value
Set_Value -- This method allows you to set the "value" of the field. It takes
one positional parameter, which is the value.
objectRef->Set_Value, 5
Keywords available are these to set the type of the data. If keywords
are not used, the data type is determined from the value.
DoubleValue -- Set this keyword if you want DOUBLE values returned.
FloatValue -- Set this keyword for FLOAT values.
IntegerValue -- Set this keyword for INTEGER values.
LongValue -- Set this keyword for LONG values.
StringValue -- Set this keyword for STRING values. (The default.)
SetProperty -- This method allows various properties of the widget to be
set via input keywords. The keywords that are available are:
CR_Only -- Set this keyword if you only want Carriage Return events.
Decimal -- Set this keyword to the number of digits to the right of the decimal
point in FLOATVALUE and DOUBLEVALUE numbers.
Digits -- Set this keyword to the number of digits permitted in INTERGERVALUE and LONGVALUE numbers.
DoubleValue -- Set this keyword if you want DOUBLE values returned.
Event_Func -- Set this keyword to the name of an Event Function.
Event_Pro -- Set this keyword to the name of an Event Procedure.
FloatValue -- Set this keyword for FLOAT values.
IntegerValue -- Set this keyword for INTEGER values.
LabelSize -- The X screen size of the Label Widget.
LongValue -- Set this keyword for LONG values.
Name -- A scalar string name of the object. (default = '')
Positive -- Set this keyword to indicate only positive numbers are allowed.
Scr_XSize -- The X screen size of the text widget.
Scr_YSize -- The Y screen size of the text widget.
Sensitive -- Set to 1 to make the widget sensitive, and to 0 to make it insensitive.
StringValue -- Set this keyword for STRING values. (The default.)
Title -- The text to go on the Label Widget.
UValue -- A user value for any purpose.
Value -- The "value" of the compound widget.
XSize -- The X size of the Text Widget.
SetTabNext -- This method allows you to specify which field to go to when a TAB character
is typed in the text widget. See the Example program below for an example of how to
use this method.
OBJECT FUNCTIONS METHODS:
Get_Value -- Returns the "value" of the field. No parameters. Will be undefined
if a "number" field is blank. Should be checked before using:
IF N_Elements(objectRef->Get_Value()) NE 0 THEN Print, Value is: ', objectRef->Get_Value()
GetID -- Returns the widget identifier of the compound widget's top-level base.
(The first child of the parent widget.) No parameters.
GetLabelSize -- Returns the X screen size of the label widget. No parameters.
GetTextID -- Returns the widget identifier of the compound widget's text widget.
No parameters.
GetTextSize -- Returns the X screen size of the text widget. No parameters.
PRIVATE OBJECT METHODS:
Although there is really no such thing as a "private" method in IDL's
object implementation, some methods are used internally and not meant to
be acessed publicly. Here are a few of those methods. I list them because
it may be these private methods are ones you wish to override in subclassed
objects.
MoveTab -- This method moves the focus to the widget identified in the "next" field,
which must be set with the SetTabNext method. No parameters. Called automatically
when a TAB character is typed in the text widget.
Text_Events -- The main event handler method for the compound widget. All
text widget events are processed here.
ReturnValue -- This function method accepts a string input value and converts
it to the type of data requested by the user.
Validate -- This function method examines all text input and removes unwanted
characters, depending upon the requested data type for the field. It makes it
impossible, for example, to type alphanumeric characters in an INTEGER field.
EXAMPLE:
An example program is provided at the end of the FSC_INPUTFIELD code. To run it,
type these commands:
IDL> .Compile FSC_InputField
IDL> Example
NOTES:
IDL 6.2 introduced new TAB behavior, which broke the previous TAB behavior. New TAB behavior
is now supported, but FOCUS_EVENTS *must* be set on the widget for the new TAB events to
behave properly. See the EXAMPLE program for examples.
DEPENDENCIES:
Requires cgDblToStr from the Coyote Library:
http://www.idlcoyote.com/programs/cgdbltostr.pro
MODIFICATION HISTORY:
Written by: David W. Fanning, 23 NOV 1999.
Added DECIMAL and DIGITS keywords, 2 Jan 2000, DWF.
Changed the calling sequence to that of a function rather than an object
creation call. This is more familiar to users of compound widgets. 4 Jan 00. DWF.
Added GetID and Resize methods. 7 Jan 00. DWF.
Added the Positive keyword and functionality. 12 Jan 00. DWF
Modified (slightly) the behavior on deleting characters. 12 Jan 00. DWF.
If a number field is blank, the Get_Value method will now return an undefined variable.
Be sure you check this value before you use it for something! 17 Jan 00. DWF.
Fixed a small typo: "aveDecimal" to "haveDecimal". 10 March 2000. DWF.
Added the ability to tab between FSC_INPUTFIELD widgets with the SetTabNext,
MoveTab, and GetTextID methods. 31 July 2000. DWF.
Added NAME field property, a scalar string name for the object 2 AUG 2000 BT
Added ObjRef field to the FSC_FIELD event structure and added field selection
for the TAB events added 31 July. 7 AUG 2000. DWF
Added GetTextSize and GetLabelSize methods for obtaining the X screen
size of the text and label widgets, respectively. 30 Jan 2001. DWF.
Added FOCUS_EVENTS keyword and fixed a problem with the event structure.
Also added better error handling. 5 January 2003. DWF.
Fixed a small problem in which input values were cast to strings inadvertently. 9 January 2004. DWF.
Fixed a small problem with error messages and using EVENT_FUNC. 14 January 2004. DWF.
Fixed a problem when setting ROW keyword. 23 February 2004. DWF.
IDL 6.2 introduced new TAB behavior, which broke the previous TAB behavior. New TAB behavior
is now supported, but FOCUS_EVENTS *must* be set for the new TAB events to behave properly.
10 August 2005. DWF.
Modified to covert double precision values to strings properly. 30 November 2005. DWF.
Added POSITIVE keyword to SETPROPERTY and GETPROPERTY methods. 25 February 2006. DWF.
Set the DYNAMIC_RESIZE keyword on the label widget. 25 February 2006. DWF.
Added SENSITIVE keyword to SetProperty documentation. 10 November 2006. DWF.
Fixed a small problem in which doubles were not being initialized correctly due
to an inadvertant extra line of code. 3 July 2007. DWF.
Fixed a small problem with input validation when the input is of BYTE type. 1 Oct 2008. DWF.
Set the default fonts to be the current widget font, rather than the default widget font. 4 Oct 2008. DWF.
Fixed a problem with validating a float or double value when it was written with
exponential notation. 2 April 2010. DWF.
</PRE><P>
<STRONG>(See fsc_inputfield.pro)</STRONG><P>
<HR>
<A NAME="FSC_PLOTWINDOW">
<H2>FSC_PLOTWINDOW</H2></A>
<A HREF="#FSC_INPUTFIELD">[Previous Routine]</A>
<A HREF="#FSC_PSCONFIG__DEFINE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_PLOTWINDOW
PURPOSE:
The purpose of this compound widget is to create a resizeable
"plot window" inside a larger "page window". I'm not sure it
has any value except as a utility routine for the PostScript
configuration object FSC_PSCONFIG__DEFINE, but it's a neat
program anyway. :-)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utility routine for FSC_PSCONFIG__DEFINE.
CALLING SEQUENCE:
plotwindowObject = CW_PlotWindow(parent)
REQUIRED INPUT PARAMETERS:
parent - The parent base widget of this compound widget.
RETURN VALUE:
plotwindowObject - The object reference of the compound widget.
KEYWORDS:
COLOR - If set, display the window in "color". This is the default on 24-bit devices.
DEBUG - Set this keyword to turn traceback error handling on in the error handling code.
EVENT_PRO - The event procedure for the widget. Required for events to be generated. Otherwise, all events are handled internally.
LANDSCAPE - If set, display the page in landscape mode. Otherwise the page is display in portrait mode.
PAGESIZE - The "pagesize" of the widget. Possible values are: "LETTER", "LEDGER", "LEGAL", "A4", and "DISPLAY".
UNITS - A string indicating INCHES or CENTIMETER units. DEVICE units represented by a null string, "".
UVALUE - A user value for the caller of this program.
WINDOWCOLOR - A three-element array specifying the background window color (RGB).
WINDOWSIZE - The size of the "window" on the page. A four-element array of normalized coordinates in the form [x0, y0, x1, y1].
EVENT STRUCTURE:
The event structure that is returned from this compound widget is defined like this,
where the sizes and offsets locate the target "window" on the page in normalized units:
event = {ID:0L, TOP:0L, HANDLER:0L, XSize:0.0, YSize:0.0, XOffset:0.0, YOffset:0.0}
MODIFICATIONS:
Written by David Fanning, 31 January 2000.
Fixed a small bug that prevented it working on Macintosh computers. 26 Sept 2000. DWF.
Added a "DISPLAY" page size, so the program can be used to position
plots and other graphics in a display window. The "page area" will
have the same aspect ratio is the current graphics window. 17 March 2001. DWF.
Changed some of the tolerances for "closeness" from 0.1 to 0.025 to allow smaller
sizing for colorbars and other small objects. 6 July 2005. DWF.
</PRE><P>
<STRONG>(See fsc_plotwindow.pro)</STRONG><P>
<HR>
<A NAME="FSC_PSCONFIG__DEFINE">
<H2>FSC_PSCONFIG__DEFINE</H2></A>
<A HREF="#FSC_PLOTWINDOW">[Previous Routine]</A>
<A HREF="#GAUSSSCL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
FSC_PSCONFIG__DEFINE
PURPOSE:
The purpose of this program is to implement an object that
can keep track of--and allow the user to change--the current
configuration of the PostScript device.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
DOCUMENTATION:
Complete documentation for the FSC_PSCONFIG object, including
keyword and method descriptions, and example programs using the object
can be found on the Coyote's Guide to IDL Programming web page:
http://www.idlcoyote.com/programs/docs/fsc_psconfig.html
Or, if you would prefer, you can download a self-contained PDF file:
http://www.idlcoyote.com/programs/docs/fsc_psconfig.pdf
KEYWORDS:
Any keyword accepted by the FSC_PSCONFIG object can be used with
this program. Here are a few of the most popular keywords.
Bits_per_Pixel - The number of image bits saved for each image pixel: 2, 4, or 8. The default is 8.
Color - Set this keyword to select Color PostScript output. Turned on by default.
Decomposed - Set this keyword to 0 to select indexed color and to 1 to select decomposed color.
DefaultSetup - Set this keyword to the "name" of a default style. Current styles (you can easily
create and add your own to the source code) are the following:
"System (Portrait)" - The normal "default" system set-up. Also, "System".
"System (Landscape)" - The normal "default" landscape system set-up.
"Centered (Portrait)" - The window centered on the page. Also, "Center" or "Centered".
"Centered (Landscape)" - The window centered on the landscape page. Also, "Landscape".
"Square (Portrait)" - A square plot, centered on the page.
"Square (Landscape)" - A square plot, centered on the landscape page.
"Figure (Small)" - A small encapsulated figure size, centered on page. Also, "Encapsulated" or "Encapsulate".
"Figure (Large)" - A larger encapsulated figure size, centered on page. Also, "Figure".
"Color (Portrait)" - A "centered" plot, with color turned on. Also, "Color".
"Color (Landscape)" - A "centered" landscape plot, with color turned on.
Directory - Set this keyword to the name of the starting directory. The current directory is used by default.
Encapsulated - Set this keyword to select Encapsulated PostScript output. Turned off by default.
European - This keyword has been depreciated in favor of METRIC.
Filename - Set thie keyword to the name of the PostScript file. The default is "idl.ps".
Inches - Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. Set by Metric keyword by default.
Landscape - Set this keyword to select Landscape page output. Portrait page output is the default.
Language_Level - Set this keyword to select the Language Level interpreter. Default is 1.
Metric - Set this keyword to indicate metric mode (i.e., A4 page and centimeter units). Turned off by default.
PageType - Set this keyword to the "type" of page. Possible values are:
"Letter" - 8.5 by 11 inches. (Default, unless the Metric keyword is set.)
"Legal" - 8.5 by 14 inches.
"Ledger" - 11 by 17 inches.
"A4" - 21.0 by 29.7 centimeters. (Default, if the Metric keyword is set.)
XOffset - Set this keyword to the X Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.)
XSize - Set this keyword to the X size of the PostScript "window". Uses "System (Portrait)" defaults.
YOffset - Set this keyword to the Y Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.)
YSize - Set this keyword to the Y size of the PostScript "window". Uses "System (Portrait)" defaults.
In addition, the following keywords can be used:
CANCEL -- An output keyword that will be set to 1 if the user
chooses the Cancel button on the form. It will be 0 otherwise.
FONTINFO -- Set this keyword is you wish to have font information
appear on the form. The default is to not include font information.
FONTTYPE -- Set this keyword to a named variable that will indicate
the user's preference for font type. Values will be -1 (Hershey fonts),
0 (hardware fonts), and 1 (true-type fonts). This keyword will always
return -1 unless the FONTINFO keyword has also been set.
GROUP_LEADER -- Set this keyword to a widget identifier of the widget
you wish to be a group leader for this program.
EXAMPLE:
A simple sequence of using the object would look something like this:
psObject = Obj_New("FSC_PSCONFIG")
psObject->GUI
psKeywords = psObject->GetKeywords()
thisDevice = !D.Name
Set_Plot, 'PS'
Device, _Extra=psKeywords
cgImage, image
Device, /Close_File
Set_Plot, thisDevice
Obj_Destroy, psObject
Note that the object can also be called from the cgPS_Config interface:
psKeywords = cgPS_Config()
OTHER PROGRAMS NEEDED:
The following programs are required to run this one:
fsc_droplist.pro
fsc_fileselect.pro
fsc_field.pro
fsc_plotwindow
MODIFICATIONS:
Written by David W. Fanning, 31 January 2000.
Added capability to call GUI methods when the current graphics device
doesn't support windows. Device is restored when the GUI exits. 11 May 2000. DWF.
Changed the default value for the Color keyword to 1. 16 May 2000. DWF.
Fixed a bug where filename changed when switching Setups. 8 AUG 2000. DWF.
Fixed a bug when saving setup in Landscape mode. 8 AUG 2000. DWF.
Added the ability to Get and Set the object's name via the SetProperty
and a very abbreviated GetProperty method. Also added a GetName method. 26 SEP 2000. DWF.
Fixed a problem in which the proper configuration was not restored if in Landscape mode. 20 Nov 2000. DWF.
Made a number of modifications at the request of Martin Schultz. 4 Dec 2000. DWF.
Fixed a bug when setting file and directory names with the SetProperty method. 18 Dec 2000. DWF.
Fixed a small problem in initializing the page size properly. 3 Jan 2001. DWF.
Corrected a problem that resulted from a change to FSC_DROPLIST. 6 Jan 2001. DWF.
Added the ability to restore the font type instead of always reverting to !P.Font. 7 Jan 2001. DWF.
Increased the length of the file/directory name fields. 7 Jan 2001. DWF.
Fixed another problem with Landscape mode interacting with A4 paper size. 7 Jan 2001. DWF.
Seems I only half fixed the previous problem. :-( 26 April 2001. DWF.
Forgot to update program to reflect change in FSC_FIELD. Fixed 26 April 2001. DWF.
Changed BOOKMAN keyword to BKMAN to avoid conflict with BOOKSTYLE keyword. 26 April 2001. DWF.
Modified the System Defaults to say "None" if none is used. Improved documentation. 10 September 2001. DWF.
Added the ability to specify a filename at the same time as a Default Setup. 10 September 2001. DWF.
Fixed a small problem in not setting new page sizes appropriately. 22 May 2002. DWF.
Fixed a problem that occurred when the Accept button was not named "Accept". 6 May 2003.DWF.
Whoops! I was a bit overly agressive on that last fix. :-( 17 July 2003. DWF.
Fixed a problem with setting page types when using the DEFAULTSETUP keyword. 31 July 2003. DWF.
Fixed a problem with turning encapsulation on in the GUI. Renamed ENCAPSULATE keyword ENCAPSULATED
to avoid obvious errors. 31 July 2003. DWF.
Removed obsolete STR_SEP and replaced with STRSPLIT. 27 Oct 2004. DWF.
Now honoring EUROPEAN keyword when setting system default setups in the INIT method. 12 Nov 2004. DWF.
Added CMYK output option 24 August 2007. Assumes LANGUAGE_LEVEL=2 printer. L. Anderson.
Fixed a problem with the filename on WINDOWS computers coming back with forward slashes instead of
backward slashes. 20 May 2008. DWF.
Modified the program to return as the default, ISOLATIN1=1. 18 July 2008. DWF.
Fixed a problem with filenames when a DEFAULTSETUP was used with it. 12 Nov 2008. DWF.
Changed default window size when LANDSCAPE keyword is set. 10 April 2009. DWF.
Changed the default window size for PORTRAIT mode to be a bit larger. 10 April 2009. DWF.
Updated for IDL 7.1 and 24-bit color PostScript support. 24 May 2009. DWF.
Added PAGETYPE field to returned structure to allow PostScript page type to be determined. 8 August 2009. DWF.
Fixed a problem with 24-bit color support that allowed only IDL 7 versions to work correctly. 20 Sept 2009. DWF.
Added a LANGUAGE_LEVEL keyword. 13 Dec 2010. DWF.
Added the FONTYPE value to the keyword return structure. 14 Dec 2010. DWF.
Modified the return structure to turn landscape mode off and set offsets to zero if in
encapsulated mode. 19 Feb 2011. DWF.
Changes to handle inability to create raster files from PS encapsulated files in
landscape mode. Also removed changes of 19 Feb 2011 as no longer needed. 26 Aug 2011. DWF.
The PAGETYPE was not getting set properly in the return keywords when the Metric
option was selected on the GUI. 12 October 2011. DWF.
The program now remembers the last directory you used and will start in that
directory, unless told otherwise. 26 Oct 2011. DWF.
Parsing of full filename failing. Fixed 27 Oct 2011. DWF.
</PRE><P>
<STRONG>(See fsc_psconfig__define.pro)</STRONG><P>
<HR>
<A NAME="GAUSSSCL">
<H2>GAUSSSCL</H2></A>
<A HREF="#FSC_PSCONFIG__DEFINE">[Previous Routine]</A>
<A HREF="#GETIMAGE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
GAUSSSCL
PURPOSE:
This is a utility routine to perform a gaussian gray-level pixel
transformation stretch on a image.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
scaledImage = GAUSSSCL(image)
ARGUMENTS:
image: The image to be scaled. Written for 2D images, but arrays
of any size are treated alike.
KEYWORDS:
SIGMA: The sigma value or width of the Gaussian
function. Set to 1 by default.
MAX: Any value in the input image greater than this value is
set to this value before scaling.
MIN: Any value in the input image less than this value is
set to this value before scaling.
NEGATIVE: If set, the "negative" of the result is returned.
OMAX: The output image is scaled between OMIN and OMAX. The
default value is 255.
OMIN: The output image is scaled between OMIN and OMAX. The
default value is 0.
RETURN VALUE:
scaledImage: The output, scaled into the range OMIN to OMAX. A byte array.
COMMON BLOCKS:
None.
EXAMPLES:
LoadCT, 0 ; Gray-scale colors.
image = cgDemoData(11) ; Load image.
TV, GaussScl(image)
RESTRICTIONS:
Requires cgScaleVector from the Coyote Library:
http://www.idlcoyote.com/programs/cgScaleVector.pro
MODIFICATION HISTORY:
Written by: David W. Fanning, 5 September 2007.
Now setting NAN keyword on all MIN and MAX functions. 2 Dec 2011. DWF.
</PRE><P>
<STRONG>(See gaussscl.pro)</STRONG><P>
<HR>
<A NAME="GETIMAGE">
<H2>GETIMAGE</H2></A>
<A HREF="#GAUSSSCL">[Previous Routine]</A>
<A HREF="#GETPRIMARYSCREENSIZE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
GETIMAGE
PURPOSE:
The purpose of this function is to allow the user to open either
unformmated or XDR binary image files of up to eight dimensions.
CATEGORY:
Widgets, File I/O.
CALLING SEQUENCE:
image = GETIMAGE(filename)
OPTIONAL INPUTS:
filename: The name of the file to open for reading.
OPTIONAL KEYWORD PARAMETERS:
CANCEL: An output variable that can be set to a named variable.
The value of the return variable will be 1 if the user clicked
the "Cancel" button or if there was a problem reading the file.
DATATYPE: The "type" of data you wish to read out of the file.
The data type corresponds to the Size(image, /TYPE) value. Here
are the types supported:
BYTE 1 (default)
INTEGER 2
LONG INTEGER 3
FLOAT 4
DOUBLE 5
UNSIGNED INTEGER 12
UNSIGNED LONG INTEGER 13
64-bit LONG 14
64-bit UNSIGNED LONG 15
DIMENSIONS: A vector of image dimensions. The default value is [256, 256].
DIRECTORY: The name of the directory the file is located in. By
default the program looks in the "coyote" directory under the
main IDL directory, if one exists. Otherwise, it defaults to the
current directory.
ENDIAN: Set this keyword to an integer that indicates the byte
ordering of the data file. If you don't know what byte order means,
or you don't know anything about the byte order of the data, or
if you are sure the data was created on the same type of machine
you are now running IDL on, then just accept the default of 0 or
"native" ordering. If you are wrong, you will soon know it and you
can set the keyword to another value on your next try. :-)
If you know the machine was created on a big endian machine (such
as a Sun or HP workstation), set this value to 1 (Big Endian). If e
you are sur the image data was create on a little endian machine (such
as a Windows PC or laptop running LINUX), set the value to 2 (Little Endian).
HEADER: The size of any header information in the file in BYTES.
Default is 0.
HEADDATA: An optional output keyword that will contain the header
information read from the file.
PARENT: The group leader for this widget program. The PARENT is
required if GETIMAGE is called from another widget program in order
to make this program a MODAL widget program.
XDR: Set this keyword if the binary file is of XDR type. The default
type is "Unformatted".
XOFFSET: This is the X offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
YOFFSET: This is the Y offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A "CANCEL" operation is indicated by a 0 return value.
Any error in reading the file results in a 0 return value.
EXAMPLE:
To load the image "galaxy.dat" in the $IDL/examples/data
directory, type:
image = GETIMAGE('galaxy.dat', DIRECTORY=!DIR + '/examples/data', $
DIMENSIONS=[256,256], Cancel=cancelled, Parent=event.top)
IF NOT cancelled THEN TV, image
MODIFICATION HISTORY:
Written by: David Fanning, 3 February 96.
Fixed bug that prevented reading INTEGER data. 19 Dec 96.
Modifed program for IDL 5 MODAL operation. 19 Oct 97.
Added CANCEL keyword. 27 Oct 97. DWF.
Fixed CANCLE keyword spelling. Sigh... 29 JUN 98. DWF.
Added COYOTE_FIELD, improved appearance. 19 NOV 99. DWF.
Updated with latest version of COYOTE_FIELD. 18 FEB 2000. DWF.
Added CATCH keyword so the program will break when I want
it to. :-) 18 MAR 2000. DWF.
Added GROUP_LEADER keyword, which is synonymous with PARENT. 31 MAR 2000. DWF.
Updated obsolete PICKFILE call to DIALOG_PICKFILE. 17 JAN 2001. DWF.
Extensive update for IDL Programming Techniques, 3rd Edition. 1 November 2006. DWF.
XSIZE, YSIZE, CATCH, and FRAMES keyword made obsolete.
HEADDATA, ENDIAN, DATATYPE, DIMENSIONS keywords added.
Added ability to parse fully qualified file names passed from Dialog_Pickfile. 30 Oct 2010. DWF.
IF a file name is not passed into the program, it asks the user to select one now. 10 Jan 2011. DWF.
Problem with SWAP_ENDIAN keywords fixed. 7 March 2011. DWF.
</PRE><P>
<STRONG>(See getimage.pro)</STRONG><P>
<HR>
<A NAME="GETPRIMARYSCREENSIZE">
<H2>GETPRIMARYSCREENSIZE</H2></A>
<A HREF="#GETIMAGE">[Previous Routine]</A>
<A HREF="#GET_OBJECT_ID">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Provides a way to get the screen size of the primary monitor, especially when
there are several being used.
:Categories:
Graphics
:Params:
none
:Keywords:
exclude_taskbar: in, optional, boolean, default=0
Set this keyword to exclude the taskbar from the monitor size.
This keyword is ignored on all but Windows machines.
:Author:
Dick Jackson, www.dick-jackson.com
:History:
Change History::
Written, 8 March 2011. DJ
Modified to only use IDLsysMonitorInfo for IDL 6.3 and higher. 23 Feb 2012. DWF.
:Copyright:
Copyright (c) 2011, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See getprimaryscreensize.pro)</STRONG><P>
<HR>
<A NAME="GET_OBJECT_ID">
<H2>GET_OBJECT_ID</H2></A>
<A HREF="#GETPRIMARYSCREENSIZE">[Previous Routine]</A>
<A HREF="#CGGMASCL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
GET_OBJECT_ID
PURPOSE:
The purpose of this function is to be able to obtain a unique
object identifier string for a heap variable (object or pointer).
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utility.
CALLING SEQUENCE:
objectID = Get_Object_ID(theObject)
INPUTS:
theObject: The object or pointer for which an identifier is requested. If
this is a null object, the function returns the string
"NullObject". If it is a null pointer, "NullPointer".
OUTPUTS:
objectID: The unique object or pointer identifier.
KEYWORDS:
NUMBER: If this keyword is set, the function returns the unique
number identifier associated with a valid pointer or object.
The number is returned as a STRING variable. The string
"-999" is returned if the pointer or object is invalid and
this keyword is set.
EXAMPLE:
Create a trackball object and obtain its unique object ID.
IDL> theObject = Obj_New('TRACKBALL', [100,100], 50)
IDL> objectID = Get_Object_ID(theObject, NUMBER=number)
IDL> Print, objectID
ObjHeapVar71(TRACKBALL)
IDL> Print, number
71
MODIFICATION HISTORY:
Written by: David W. Fanning, 4 September 2003.
Added NUMBER keyword. DWF, 22 September 2008.
</PRE><P>
<STRONG>(See get_object_id.pro)</STRONG><P>
<HR>
<A NAME="CGGMASCL">
<H2>CGGMASCL</H2></A>
<A HREF="#GET_OBJECT_ID">[Previous Routine]</A>
<A HREF="#HCOLORBAR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
CGGMASCL
PURPOSE:
This is a utility routine to perform basic gray-level pixel
transformations of images. I think of it as BYTSCL on steroids.
It is similar to IMADJUST in _Digital Image Processing with MATLAB_
by Gonzales, Wood, and Eddins. It performs a log scaling of the
image array.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
scaledImage = CGGMASCL(image)
ARGUMENTS:
image: The image to be scaled. Written for 2D images, but arrays
of any size are treated alike.
KEYWORDS:
GAMMA: The exponent in a power-law transformation (image^gamma). A gamma
value of 1 results in a linear distribution of values between
OMIN and OMAX. Gamma values less than 1 map darker image values
into a wider range of output values, and Gamma values
greater than 1 maps lighter image values into a wider
range of output values. The gamma value is constrained to
be greater than 1.0e-6.
MAX: Any value in the input image greater than this value is
set to this value before scaling.
MIN: Any value in the input image less than this value is
set to this value before scaling.
NEGATIVE: If set, the "negative" of the result is returned.
OMAX: The output image is scaled between OMIN and OMAX. The
default value is 255.
OMIN: The output image is scaled between OMIN and OMAX. The
default value is 0.
RETURN VALUE:
scaledImage: The output, scaled into the range OMIN to OMAX. A byte array.
COMMON BLOCKS:
None.
EXAMPLES:
LoadCT, 0 ; Gray-scale colors.
image = cgDemoData(11) ; Load image.
TV, cgGmaScl(image, Min=30, Max=100) ; Similar to BytScl.
TV, cgGmaScl(image, /Negative) ; Produce negative image.
power = Shift(ALog(Abs(FFT(image,-1))), 124, 124) ; Create power spectrum.
TV, cgGmaScl(power, Gamma=2.5) ; View power specturm with gamma correction.
TV, cgGmaScl(power, Gamma=2.5, /Negative) ; Reverse power spectrum.
RESTRICTIONS:
Requires cgScaleVector from the Coyote Library:
http://www.idlcoyote.com/programs/cgScaleVector.pro
MODIFICATION HISTORY:
Written by: David W. Fanning, 17 February 2006.
Fixed a problem with output scaling. 1 July 2009. DWF (with input from Bo Milvang-Jensen).
Now setting NAN keyword on all MIN and MAX functions. 2 Dec 2011. DWF.
</PRE><P>
<STRONG>(See cggmascl.pro)</STRONG><P>
<HR>
<A NAME="HCOLORBAR">
<H2>HCOLORBAR</H2></A>
<A HREF="#CGGMASCL">[Previous Routine]</A>
<A HREF="#HELP_VAR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
HCOLORBAR
FILENAME:
hcolorbar__define.pro
;
PURPOSE:
The purpose of this program is to create a horizontal
colorbar object to be used in conjunction with other
IDL 5 graphics objects.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Object Graphics.
CALLING SEQUENCE:
thisColorBar = Obj_New('HColorBar')
REQUIRED INPUTS:
None.
INIT METHOD KEYWORD PARAMETERS:
COLOR: A three-element array representing the RGB values of a color
for the colorbar axes and annotation. The default value is
white: [255,255,255].
FONTSIZE: A floating value that is the point size of the font
used for the axis and title annotations. Set to 8 point by default.
NAME: The name associated with this object.
NCOLORS: The number of colors associated with the colorbar. The
default is 256.
MAJOR: The number of major tick divisions on the colorbar axes.
The default is 5.
MINOR: The number of minor tick marks on the colorbar axes.
The default is 4.
PALETTE: A palette object for the colorbar. The default palette
is a gray-scale palette object.
POSITION: A four-element array specifying the position of the
colorbar in normalized coordinate space. The default position
is [0.10, 0.90, 0.90, 0.95].
RANGE: The range associated with the colorbar axis. The default
is [0, NCOLORS].
TITLE: A string containing a title for the colorbar axis
annotation. The default is a null string.
OTHER METHODS:
Clamp (Procedure): Given a two-element array in the data range of
the colorbar, the colorbar image is clamped to this range. In
other words, the range of colors is clamped to the specified
range. Values above or below the range in the colorbar are set to
the minimum and maximum range values, respectively.
GetProperty (Procedure): Returns colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
MAJOR
MINOR
NAME
PALETTE
POSITION
RANGE
TEXT
TITLE
TRANSFORM
SetProperty (Procedure): Sets colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
MAJOR
MINOR
NAME
PALETTE
POSITION
RANGE
TEXT
TITLE
TRANSFORM
SIDE EFFECTS:
A HColorBar structure is created. The colorbar INHERITS IDLgrMODEL.
Thus, all IDLgrMODEL methods and keywords can also be used. It is
the model that is selected in a selection event, since the SELECT_TARGET
keyword is set for the model.
EXAMPLE:
To create a colorbar object and add it to a plot view object, type:
thisColorBarObject = Obj_New('HColorBar')
plotView->Add, thisColorBarObject
plotWindow->Draw, plotView
MODIFICATION HISTORY:
Written by David Fanning, from VColorBar code, 20 Sept 98. DWF.
Changed a reference to _Ref_Extra to _Extra. 27 Sept 98. DWF.
Fixed bug when adding a text object via the TEXT keyword. 9 May 99. DWF.
Fixed the same bug when getting the text using the TEXT keyword. :-( 16 Aug 2000. DWF.
Fixed a bug with getting the text object via the TEXT keyword. 16 Aug 2000. DWF.
Added the TRANSFORM keyword to GetProperty and SetProperty methods. 16 Aug 2000. DWF.
Added RECOMPUTE_DIMENSIONS=2 to text objects. 16 Aug 2000. DWF.
Added a polygon object around the image object. This allows rotation in 3D space. 16 Aug 2000. DWF.
Removed TEXT keyword (which was never used) and improved documentation. 15 AUG 2001. DWF.
Added ENABLE_FORMATTING keyword to title objects. 22 October 2001. DWF.
Added a CLAMP method. 18 November 2001. DWF.
Forgot to pass extra keywords along to the text widget. As a result, you couldn't
format tick labels, etc. Fixed this. Any keywords appropriate for IDLgrTick objects
are now available. 26 June 2002. DWF.
Fixed a problem with POSITION keyword in SetProperty method. 23 May 2003. DWF.
Fixed a problem with setting RANGE keyword in SetProperty method. 6 Sept 2003. DWF.
Removed NORMALIZE from source code. 19 November 2005. DWF.
Font sizes have changed. Now using a 12 point font. 6 May 2011. DWF.
Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See hcolorbar__define.pro)</STRONG><P>
<HR>
<A NAME="HELP_VAR">
<H2>HELP_VAR</H2></A>
<A HREF="#HCOLORBAR">[Previous Routine]</A>
<A HREF="#HISTOMATCH">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
HELP_VAR
PURPOSE:
The purpose of this program is to display HELP on just
the variables at the level in which HELP_VAR is called.
It is similar to the HELP command, except that compiled
functions and procedures are not displayed.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities.
CALLING SEQUENCE:
HELP_VAR
REQUIRED INPUTS:
None.
SIDE EFFECTS:
Memory is allocated for each variable, in turn, then deleted.
Uses undefined and unsupported ROUTINE_NAMES function. May not
work in all versions of IDL, including future versions.
EXAMPLE:
PRO HELP_VAR_TEST
a = 4.0
b = Lindgen(11)
HELP_VAR
END
IDL> help_var
A FLOAT = 4.00000
B LONG = Array[11]
MODIFICATION HISTORY:
Written by David W. Fanning, 8 August 2003.
</PRE><P>
<STRONG>(See help_var.pro)</STRONG><P>
<HR>
<A NAME="HISTOMATCH">
<H2>HISTOMATCH</H2></A>
<A HREF="#HELP_VAR">[Previous Routine]</A>
<A HREF="#IMAGESELECT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
HistoMatch
PURPOSE:
This is a function for Histogram Matching, in which an image
is manipulated in such a way that it's final histogram approximates
the histogram of an input image or histogram. Histogram matching
allows the user to specify the shape of the histogram of the final
product.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Image Processing
CALLING SEQUENCE:
output_image = HistoMatch(image, histogram_to_match)
INPUTS:
image - The input image to be manipulated. Assumed to be a 2D byte array.
histogram_to_match - Can be either a 1D long vector of 256 elements specifying
the histogram to match, or a 2D byte array from which the histogram to
match is calculated.
OUTPUTS:
output_image - The manipulated image adjusted to the histogram specifications.
INPUT KEYWORDS:
None.
OUTPUT KEYWORDS:
None.
DEPENDENCIES:
None.
METHOD:
Based on the Histogram Matching method on pages 94-102 of Digital
Image Processing, 2nd Edition, Rafael C. Gonzalez and Richard E. Woods,
ISBN 0-20-118075-8.
EXAMPLE:
There is an example program at the end of this file. It will require cgImage
from the Coyote Library to run. You can also find an explanation of this program
at http://www.idlcoyote.com/ip_tips/histomatch.html.
MODIFICATION HISTORY:
Written by David W. Fanning, January 2003.
</PRE><P>
<STRONG>(See histomatch.pro)</STRONG><P>
<HR>
<A NAME="IMAGESELECT">
<H2>IMAGESELECT</H2></A>
<A HREF="#HISTOMATCH">[Previous Routine]</A>
<A HREF="#IMAGE_BLEND">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
IMAGESELECT
PURPOSE:
The purpose of this program is to allow the user to select a formatted
image file for reading. The image data is returned as the result of the
function. The program allows the user to see a thumbnail version of the
image, along with information about the image, before selection. The
program uses the file extention to determine what kind of image is to
be read. The following image types are supported:
TYPE FILE EXTENSION
BMP *.bmp
DICOM *.dcm
FITS *.fits, *.fts (requires NASA ASTRO library on IDL Path)
GIF *.gif (IDL 6.2 and higher)
JPEG *.jpg, *.jpeg, *.jpe
JPEG2000 *.jpf, *.jpx, *.jp2, *.j2c, *.j2k
PICT *.pict
PNG *.png
TIFF *.tif, *tiff
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
image = ImageSelect()
INPUT PARAMETERS:
None. All input is via keywords.
INPUT KEYWORDS:
BMP -- Set this keyword to select BMP files.
DEMO -- If this keyword is set, the program changes directory to !DIR/examples/data.
DICOM -- Set this keyword to select DICOM files.
DIRECTORY -- The initial input directory name. The current directory by default.
EXCLUDE -- A list of filenames that should excluded from the file selection list.
FILENAME -- The initial filename. If the initial directory has image files of the
correct type, the default is to display the first of these files. Otherwise, blank.
FILTER -- A string, representing the file filter. For example, '*.jpg'.
FITS -- Set the keyword to select FITS files. (Must have NASA Astro Library on path.)
FLIPIMAGE -- Set this keyword if you wish to flip the image from its current orientation. Setting
this keyword reverses the Y dimension of the image.
GIF -- Set this keyword to select GIF files. (IDL versions before 5.4 and after 6.0, only.)
GROUP_LEADER -- Set this keyword to a widget identifier group leader. This keyword MUST be
set when calling this program from another widget program to guarantee modal operation.
J2000 -- Set this keyword to select JPEG2000 files. (May also be set as J2K.) (IDL 6.1 or above.)
J2K -- Set this keyword to select JPEG2000 files. (May also be set as J2000.) (IDL 6.1 or above.)
JPEG -- Set this keyword to select JPEG files.
LISTXSIZE -- Set this keyword to the XSIZE of the list widget. Default is 30 or MAX(StrLen(filenames)), whichever is larger.
OFFSETS -- A two-element array containing the X and Y offsets of the program, from the upper left
corner of the display. On dismissal of the program, if this is a named variable (passed into
the program by reference), then it will contain the last offsets of the program. This is
useful if you want to call ImageSelect again and have it positioned in exactly the same
location it was before.
ONLY2D -- Set this keyword if you only want the user to be able to select 2D images. Note
that the user will be able to browse all images, but the Accept button will only
be sensitive for 2D images.
ONLY3D -- Set this keyword if you only want the user to be able to select 3D or true-color images.
Note that the user will be able to browse all images, but the Accept button will only
be sensitive for 3D or true-color images.
PICT -- Set this keyword to select PICT files.
PGM -- Set this keyword to select PGM files.
PPM -- Set this keyword to select PPM files.
PNG -- Set this keyword to select PNG files.
PREVIEWSIZE -- Set this keyword to the maximum size (in pixels) of the preview window. Default is 150.
SILENT -- Set this keyword to turn off Group_Leader educational message. Use only if you
are sure you know what you are doing. :-)
TIFF -- Set this keyword to select TIFF files. (This is the default filter selection.)
TITLE -- Set this keyword to the text to display as the title of the main image selection window.
NOTE: Any extra keywords passed into the program will collected and passed along to the READ_XXX routines
that actually do the image file reading. Using this keyword inheritance mechanism makes it impossible
to trap misspelled or misused keywords. Please take care when using ANY keyword for this routine!
OUTPUT KEYWORDS:
CANCEL -- This keyword is set to 1 if the user exits the program in any way except hitting the ACCEPT button.
The ACCEPT button will set this keyword to 0.
FHEADER -- Set this keyword to a named variable that will return the FITS header information for a FITS file.
FILEINFO -- This keyword returns information about the selected file. Obtained from the QUERY_**** functions.
GEOTIFF -- If the file is a GeoTIFF file, this keyword will return the GeoTIFF structure containing
the files GeoTags.
OUTDIRECTORY -- The directory where the selected file is found.
OUTFILENAME -- The short filename of the selected file.
PALETTE -- The current color table palette returned as a 256-by-3 byte array.
COMMON BLOCKS:
None.
RESTRICTIONS:
Requires other programs from the Coyote Library.
Note: Keyword inheritance to collect undefined keywords that may be passed into the
program for use in READ_XXX routines, make it impossible to trap keyword useage errors.
Please take care when using keywords.
EXAMPLE:
To read JPEG files from the directory:
IDL> image = ImageSelect(/JPEG)
MODIFICATION HISTORY:
Written by: David W. Fanning, 18 Jan 2001.
Added modification to read both 8-bit and 24-bit BMP files. 27 Jan 2001. DWF.
Fixed a problem with calculating the new size of the draw widget. 5 April 2002. DWF.
Fixed a problem with List Widgets not sizing correctly on UNIX machines. 10 Aug 2002. DWF.
Fixed a problem with the initial file not being selected correctly when you changed
the file type. 10 Aug 2002. DWF.
Added a FLIPIMAGE keyword 10 Aug 2002. DWF.
When user chooses to Flip Image, I now reverse the Y dimension of the image,
rather than set the !Order system variable. 10 Aug 2002. DWF.
Added OUTDIRECTORY and OUTFILENAME keywords. 18 Aug 2002. DWF.
Fairly extensive changes in the way this program works and selects images.
A new version of FSC_FileSelect is also required. Because of interactions
with the operating system with image filters, the program has probably
become more Windows-centric. The default is now to display all image
files the program is capable of reading. 31 October 2002. DWF.
Added ONLY2D keyword to allow the acceptance of 2D images only. 3 Nov 2002. DWF.
Added ability to center itself on the display. 8 Nov 2002. DWF.
Fixed a problem caused by reading old images with short color table vectors. 26 Nov 2002. DWF.
Fixed a problem with specifying a fully-qualified filename. 26 Nov 2002. DWF.
Now highlights the selected file in the directory. 26 Nov 2002. DWF.
Improved error handling. 9 Dec 2002. DWF.
Added PALETTE keyword and improved color operation on 8-bit displays. If the image file
contains a color palette, that palette is now loaded when the image is read from the file.
The current color palette can be obtained with the PALETTE keyword. 4 April 2003. DWF.
Added ONLY3D keyword. 19 April 2003. DWF.
Added ability to read PPM and PGM files. 24 November 2003. DWF.
Added TITLE keyword. 1 December 2003. DWF.
Added EXAMPLES keyword. 22 December 2005. DWF.
Added GIF and JPEG2000 file types. Rearranged and cleaned up code. 3 January 2006. DWF.
Added LISTXSIZE keyword. 3 January 2006. DWF.
Added file type checkmark buttons. Program now compatible with IDL 5.6 and higher. 3 January 2006. DWF.
Improved error handling with invalid file types. 5 January 2006. DWF.
Added OFFSETS and EXCLUDE keywords. 3 March 2006 DWF.
Modified the program to check for FITS unsigned integer data. 3 March 2006. DWF.
Added ability to double-click image name in list to Accept. 10 March 2006. DWF.
Added FHEADER keyword to return FITS header information. 3 April 2006. DWF.
Fixed a problem in which the file type was not set if the user cancelled. 10 July 2006. DWF.
Added a "fit" file extension for FITS images. 1 April 2008. DWF.
Added a FILTER keyword. 1 April 2008. DWF.
Updated for reading transparent images. 13 May 2009. DWF.
Provided check for PNG images with more than 8 bits per channel. 5 August 2009. DWF.
Fixed a problem in which the starting directory was changed on exit. 20 Nov 2010. DWF.
Change EXAMPLES to more easily remembered DEMO keyword. 29 Nov 2010. DWF.
Removed NOINTERPOLATION keywords in going from TVIMAGE to cgImage. 22 Feb 2011. DWF.
Fixed a problem reading 2D Tiff files. 20 Sept 2012. DWF.
</PRE><P>
<STRONG>(See imageselect.pro)</STRONG><P>
<HR>
<A NAME="IMAGE_BLEND">
<H2>IMAGE_BLEND</H2></A>
<A HREF="#IMAGESELECT">[Previous Routine]</A>
<A HREF="#IMAGE_DIMENSIONS">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
IMAGE_BLEND
PURPOSE:
The purpose of this program is to demonstrate how to
use the alpha channel to blend one image into another.
The specific purpose is to see a color image on top of
a gray-scale image, with the gray-scale image showing
through behind the color image.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Widgets, Object Graphics.
CALLING SEQUENCE:
Image_Blend
REQUIRED INPUTS:
None. The images "worldelv.dat" and "ctscan.dat" from the
examples/data directory are used.
OPTIONAL INPUTS:
backgroundImage:: A 2D image variable that will be used for the background image.
foregroundImage: A 2D image variable that will be used for the foreground image.
OPTIONAL KEYWORD PARAMETERS:
COLORTABLE: The number of a color table to use for the foreground image.
Color table 3 (red temperature) is used as a default.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None. The program XCOLORS is required from the Coyote library.
EXAMPLE:
Image_Blend, Colortable=5
MODIFICATION HISTORY:
Written by David Fanning, 30 March 99.
Fixed bug where I redefined the image parameter. Duh... 1 April 99. DWF.
Moved the program into the 21st century. :-) 21 March 2003. DWF.
Added TIFF, GIF (if version supports it), and PS output. 27 December 2006. DWF.
</PRE><P>
<STRONG>(See image_blend.pro)</STRONG><P>
<HR>
<A NAME="IMAGE_DIMENSIONS">
<H2>IMAGE_DIMENSIONS</H2></A>
<A HREF="#IMAGE_BLEND">[Previous Routine]</A>
<A HREF="#INSIDE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
The purpose of this function is to return the various dimensions of the image,
and also to extract relevant image information via output keywords. The
function works only with 2D and 3D (24-bit) images, with or without alpha
channels.
:Categories:
Utilities
:Returns:
A vector containing the size of each dimension of the image. It is equivalent
to calling the SIZE function with the DIMENSIONS keyword set.
:Params:
image: in, optional, type=various
The image variable from which information is to be obtained.
:Keywords:
alphachannel: out, optional, type=boolean
This keyword is set to 1 if there is an alpha channel in the image. Otherwise,
the keyword is set to 0.
trueindex: out, optional, type=integer
The position of the "true color" index in the return value. Is -1 for 2D images.
xindex: out, optional, type=integer
The index (position) of the X dimension in the return value.
xsize: out, optional, type=integer
The X size of the image.
yindex: out, optional, type=integer
The index (position) of the Y dimension in the return value.
ysize: out, optional, type=integer
The Y size of the image.
:Examples:
To load open a window of the appropriate size and display a 24-bit image::
dims = Image_Dimensions(image24, XSize=xsize, YSize=ysize, TrueIndex=trueindex)
Window, XSIZE=xsize, YSIZE=ysize
TV, image24, TRUE=trueindex
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
:History:
Modification History::
Written by: David W. Fanning, 5 March 2003.
Added support for alpha channel images, include ALPHACHANNEL keyword. 13 May 2009. DWF.
:Copyright:
Copyright (c) 2003-2011, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See image_dimensions.pro)</STRONG><P>
<HR>
<A NAME="INSIDE">
<H2>INSIDE</H2></A>
<A HREF="#IMAGE_DIMENSIONS">[Previous Routine]</A>
<A HREF="#JD2TIME">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
INSIDE
PURPOSE:
The purpose of this function is to indicate whether a specified
2D point is inside (returns a 1) a specified 2D polygon or outside
(returns a 0).
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utility.
CALLING SEQUENCE:
result = INSIDE(x, y, xpts, ypts)
INPUTS:
x: A scalar or vector of the x coordinates of the 2D point(s) to check.
y: A scalar or vector of the y coordinates of the 2D point(s) to check.
xpts: The x coordinates of the 2D polygon.
ypts: The y coordinates of the 2D polygon.
OUTPUTS:
result: A scalar or vector set to 1 if the point is inside the polygon and to
0 if the point is outside the polygon.
KEYWORDS:
INDEX: An output keyword. If set to a named variable, will return the indices
of the X and Y points that are inside the polygon.
ALGORITHM:
Based on discussions on the IDL newsgroup (comp.lang.idl-pvwave) and
discussed here:
http://www.idlcoyote.com/tips/point_in_polygon.html
Primarily the work of B�rd Krane and William Connelly.
MODIFICATION HISTORY:
Written by: David W. Fanning, 4 September 2003.
Vectorized the function in accord with William Connelly's suggestions 24 July 2005. DWF.
</PRE><P>
<STRONG>(See inside.pro)</STRONG><P>
<HR>
<A NAME="JD2TIME">
<H2>JD2TIME</H2></A>
<A HREF="#INSIDE">[Previous Routine]</A>
<A HREF="#LEFTJUSTIFY">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
The purpose of this function is to convert a Julian day number into
a time string of the form "16 Mar 2009".
:Categories:
Utilities
:Returns:
A scalar or vector of time strings of the form "16 Mar 2009 15:34:26".
:Params:
jdnumber: in, optional, type=integer
A Julian day number or array of Julian day numbers. If absent,
today's current Julian day number.
jdyear: in, optional, type=integer
The year for which the Julian day number applies. If absent, the current year.
:Keywords:
day: out, optional, type=integer
The day of the month as an integer.
month: out, optional, type=integer
The month as an integer.
year: out, optional, type=integer
The year as an integer.
:Examples:
Used like the IDL AXIS command::
IDL> cgPlot, cgDemoData(1), YStyle=8, Position=[0.1, 0.1, 0.85, 0.9], /Window
IDL> cgAxis, /YAxis, Color='red', YRange=[-500, 500], /Save, /Window
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written by: David W. Fanning, 25 June 2009.
Added DAY, MONTH, and YEAR keywords. 18 Sept 2012. DWF.
:Copyright:
Copyright (c) 2009-2012, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See jd2time.pro)</STRONG><P>
<HR>
<A NAME="LEFTJUSTIFY">
<H2>LEFTJUSTIFY</H2></A>
<A HREF="#JD2TIME">[Previous Routine]</A>
<A HREF="#LINKEDLIST">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
LEFTJUSTIFY
PURPOSE:
This is a utility routine to create a string that is left-justified with
respect to a string width.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
justifiedString = LeftJustify(string, width)
AUGUMENTS:
string: The string that is to be left-justified. If not supplied, a null
string is returned and no error is issued.
width: The final width of the left-justified string. The width must be
longer than the length of the string or an error results. Default: 50.
KEYWORDS:
None.
RETURN VALUE:
justifiedString: A string of WIDTH, with the string left-justified and the rest of the string
filled with blank characters.
MODIFICATION HISTORY:
Written by: David W. Fanning, 26 January 2009.
</PRE><P>
<STRONG>(See leftjustify.pro)</STRONG><P>
<HR>
<A NAME="LINKEDLIST">
<H2>LINKEDLIST</H2></A>
<A HREF="#LEFTJUSTIFY">[Previous Routine]</A>
<A HREF="#LIST_SELECTOR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
LINKEDLIST
FILENAME:
linkedlist__define.pro
PURPOSE:
The purpose of this program is to implement a list that
is linked in both the forward and backward directions. There
is no restriction as to what can be stored in a linked list
node. The linked list is implemented as an object.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
mylist = Obj_New('LINKEDLIST', item)
OPTIONAL INPUTS:
item: The first item added to the list. Items can be any
valid IDL variable type.
COMMON BLOCKS:
Are you kidding?!
RESTRICTIONS:
Be sure to destroy the LINKEDLIST object when you are finished
with it: Obj_Destroy, mylist
Node index numbers start at 0 and go to n-1, where n is the
number of items in the list.
PUBLIC METHODS:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::ADD, item, index, $
AFTER=after, $
BEFORE=before, $
ERROR=error, $
NO_COPY=no_copy, $
REPLACE=replace
The ADD method adds a data item to the list.
Parameters:
item: The data item to be added to the list. Required.
index: The location in the list where the data item is
to be added. If neither the AFTER or BEFORE keyword is
set, the item is added AFTER the item at the index location.
If index is missing, the index points to the last item in
the list. Optional.
Keywords:
AFTER: If this keyword is set, the item is added after the
item at the current index.
BEFORE: If this keyword is set, the item is added before the
item at the current index.
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
NO_COPY: If set, the item is transferred to the internal pointer using
a no copy method. This will cause the item variable to become undefined.
REPLACE: If this keyword is set, the item will replace the current item at
the index location.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::DELETE, index, ALL=all, DESTROY=destroy, ERROR=error
The DELETE method deletes an item from the list.
Parameters:
index: The location in the list where the data item is
to be delete. If index is missing, the index points to
the last item in the list. Optional.
Keywords:
ALL: If this keyword is set, all items in the list are deleted.
DESTROY: If the item at the node is an object or pointer, the
item will be destroyed before the node is deleted. This keyword
is turned on (set to 1) by default. Set to 0 to prevent destruction.
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::GET_COUNT
The GET_COUNT method returns the number of items in the list.
Return Value: The number of items stored in the linked list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::GET_ITEM, index, $
ALL=all, $ ; This ASSUMES all items stored are the same type!!!
Dereference=dereference, $ ; Obsolete. Ignored. Always returns item.
ItemPtr=itemPtr, $ ; The pointer to the item, if needed. Output.
NO_COPY=no_copy, $ ; Copy from location with NO_COPY.
ERROR=errorMsg ; The error message. Null string if no error.
Parameters:
index: The location in the list from which the data item is
to be retrieved. If not present, the last item in the list
is retrieved. Optional.
Keywords:
DEREFERENCE: This keyword obsolete and only provided for backward compatibility.
ALL: Set this keyword to return an n-element array containing all the list
items. This requires that all list items be of the same type, and
if they are arrays, they have 7 dimensions or fewer. If index is passed,
it is ignored.
ITEMPTR: The pointer to the data item.
NO_COPY: If this keyword is set, the item is transferred from the data
pointer using a NO_COPY method. This will undefine the item at that
indexed locaton.
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
Return Value: The data item at this index on the list.
If ALL is set, then an array containing all the data items is returned.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::GET_NODE, index, ERROR=error
The GET_NODE method returns a pointer to the specified node
from the list.
Parameters:
index: The location in the list from which the data node is
to be retrieved. If not present, the last node in the list
is retrieved. The node is a structure with three fields:
Previous is a pointer to the previous node in the list.
Next is a pointer to the next node in the list. A null pointer
in the previous field indicates the first node on the list. A
null pointer in the next field indicates the last node on the
list. The item field is a pointer to the item stored in the
node. Optional.
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
Return Value: A pointer to the specified node structure in
the linked list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::HELP, PRINT=print
The HELP method performs a HELP command on each item
in the linked list.
Keywords:
PRINT: If this keyword is set, the PRINT command is used
instead of the HELP command on the items in the list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::MOVE_NODE, nodeIndex, location, BEFORE=before, ERROR=error
The MOVE_NODE method moves a list node from one location to another.
Parameters:
nodeIndex: The location in the list of the node you are moving.
Required.
location: The location (index) you are moving the node to. If
location is missing, the location points to the node at the
end of the list.
Keywords:
BEFORE: If this keyword is set, the node is added to the
list before the location node. Otherwise, it is added after
the location node.
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::REPLACE_ITEM, newItem, index, ERROR=error
Use this method to replace any item in the list with any other value.
This allows the caller to change an item without stepping through the
process of deleting an item then adding a new one.
Parameters:
index: The location of the node you are replacing
newItem: Any value of any data type.
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::HAVE_ITEM, index, ERROR=error
Use this method to check to see if an item exits at a particular location
on the list. Returns a 1 if the item is there, otherwise a 0.
Parameters:
index: The location of the node you are replacing
ERROR: On return, if this is not a null string, an error occurred
and this value is set equal to the error message.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EXAMPLE:
mylist = Obj_New("LINKEDLIST", 5)
mylist->Add, 10
mylist->Add, 7, 1, /Before
mylist->Add, 12
print, mylist->Get_Item(/All)
mylist->Add, 'Bob', 2, /Replace
mylist->Help
mylist->Delete, 0
mylist->Help, /Print
MODIFICATION HISTORY:
Written by: David Fanning, 25 August 98.
25 August 99. Fixed several errors in various methods dealing with
moving nodes from one place to another. DWF.
13 June 2001. DWF. Added DEREFERENCE to the GET_ITEM method to
return the item itself, instead of the pointer to the item.
27 June 2001 Added REPLACE_ITEM method. Ben Tupper.
7 April 2003. Added DESTROY keyword to DELETE method so that objects
and pointers could be cleaned up properly when they are deleted
from the linked list. DWF.
9 April 2003. Fixed a problem that occurs when deleting the last node. DWF.
3 Feb 2004. Make sure loop index vars are long. Jeff Guerber
30 Jun 2004. Added /ALL to GET_ITEM function. Henry Throop, SWRI.
23 Nov 2004. Fixed GET_ITEM, /ALL to accomodate structures and empty
lists. Henry Throop.
21 February 2011. A complete refurbishing to incorporate changes and to fix bugs
I found in the SolarSoft version of this code. I've tried to make this compatible
with the version distributed with SolarSoft to reduce problems caused by two versions
of the software with the same name.
9 December 2011. Fixed a problem with the ALL keyword on the Get_Item method. DWF.
</PRE><P>
<STRONG>(See linkedlist__define.pro)</STRONG><P>
<HR>
<A NAME="LIST_SELECTOR">
<H2>LIST_SELECTOR</H2></A>
<A HREF="#LINKEDLIST">[Previous Routine]</A>
<A HREF="#LOGSCL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
LIST_SELECTOR
PURPOSE:
The purpose of this function is to implement a pop-up dialog widget
for the purpose of selecting "names". Names can be names of variables,
names of files, etc. Any string array can be used.
CALLING SEQUENCE:
selectedNames = List_Selector(theNames)
ARGUMENTS:
theNames: A string array of potential "names" that can be selected.
KEYWORDS:
ALL: Set this keyword if you wish all the names to be selected
initially.
CANCEL: An output keyword set to 1 if the user cancels or quits the
program without hitting the Accept button. Set to 0 if a proper
selection was made and the use hits the Accept button.
COUNT: An output keyword containing the number of elements in the return array.
GROUP_LEADER: The widget identifier of a widget who will be the group leader
for this dialog. Passing a group leader is the *only* way to
assure the dialog will be a MODAL dialog (as opposed to a blocking
dialog). A GROUP_LEADER is required if you will be using this
function in an IDL Virtual Machine application.
LABEL: A string that will be placed on a label above the selections.
If not used, no label is used in the program.
LIST_COUNTER: If this keyword is set, a number is associated and displayed with
each list item, starting with the number 1.
TITLE: A string that is used for the title of the dialog window. If
undefined, then "Selection Widget" is used.
SELECTED_INDICES: An output vector of the selected indices from theNames array.
RETURN VALUE:
selectedNames: Typically, an array of selected names. If there is only one item
in the selection, the variable will be a scalar string.
EXAMPLE:
See the List_Selector_Test procedure below. I use the program to allow the
user to select the names of scientific data sets in an HDF file for further
reading and processing.
MODIFICATION HISTORY:
Written by David W. Fanning, 11 January 2009, based on Name_Selector program.
Added "Accept on Double-Click" functionality. 14 January 2009. DWF.
Added LIST_COUNTER keyword. 25 May 2009. DWF.
Well, basically a RE-DO of yesterday's work, although done correctly today. 26 May 2009. DWF.
Fixed a problem when the user double-clicks an item in the list. 8 August 2009. DWF.
Double clicks are a problem with UNIX machines because <CR> sets event.clicks = 2
prematurely. Removed double-click functionality from all but Windows machines. 9 Feb 2012. DWF.
</PRE><P>
<STRONG>(See list_selector.pro)</STRONG><P>
<HR>
<A NAME="LOGSCL">
<H2>LOGSCL</H2></A>
<A HREF="#LIST_SELECTOR">[Previous Routine]</A>
<A HREF="#MAXMIN">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
LOGSCL
PURPOSE:
This is a utility routine to perform a log intensity transformation
on an image. For exponent values greater than 1.0, the upper and
lower values of the image are compressed and centered on the mean.
Larger exponent values provide steeper compression. For exponent values
less than 1.0, the compression is similar to gamma compression. (See
IMGSCL.) See pages 68-70 in _Digital Image Processing with MATLAB_
by Gonzales, Wood, and Eddins. The function is used to improve contrast
in images.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
outputImage = LOGSCL(image)
ARGUMENTS:
image: The image to be scaled. Written for 2D images, but arrays
of any size are treated alike.
KEYWORDS:
EXPONENT: The exponent in a log transformation. By default, 4.0.
MEAN: Values on either side of the mean will be compressed by the log.
The value is a normalized value between 0.0 and 1.0. By default, 0.5.
NEGATIVE: If set, the "negative" of the result is returned.
MAX: Any value in the input image greater than this value is
set to this value before scaling.
MIN: Any value in the input image less than this value is
set to this value before scaling.
OMAX: The output image is scaled between OMIN and OMAX. The
default value is 255.
OMIN: The output image is scaled between OMIN and OMAX. The
default value is 0.
RETURN VALUE:
outputImage: The output, scaled into the range OMIN to OMAX. A byte array.
COMMON BLOCKS:
None.
EXAMPLES:
cgLoadCT, 0 ; Gray-scale colors.
image = cgDemoData(22) ; Load image.
cgImage, image ; No contrast.
cgImage, LogScl(image) ; Improved contrast.
cgImage, LogScl(image, Exponent=10, Mean=0.65) ; Even more contrast.
cgImage, LogScl(image, /Negative, Exponent=5) ; A negative image.
RESTRICTIONS:
Requires cgScaleVector from the Coyote Library:
http://www.idlcoyote.com/programs/cgScaleVector.pro
MODIFICATION HISTORY:
Written by: David W. Fanning, 20 February 2006.
Fixed a problem with output scaling. 1 July 2009. DWF (with input from Bo Milvang-Jensen).
</PRE><P>
<STRONG>(See logscl.pro)</STRONG><P>
<HR>
<A NAME="MAXMIN">
<H2>MAXMIN</H2></A>
<A HREF="#LOGSCL">[Previous Routine]</A>
<A HREF="#MAXWINDOWSIZE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Prints the maximum and minimum of an IDL variable.
:Categories:
Utility
:Params:
variable: in, required, type=any
The variable whose minimum and maximum you wish to know.
:Keywords:
NAN: in, optional, type=boolean
Set this keyword to ignore NANs in the variable. Default: 0.
TEXT: in, optional, type=string
Prepend this string to the output of MinMax. Default: "MinMax: ".
:Examples:
The MaxMin routine gives the range of the variable::
IDL> a = Findgen(11)
IDL> MaxMin, a, TEXT='Variable A:'
Variable A: 11 0
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written, 20 Sept 2010.
Changed name of program from MinMax to MaxMin to avoid conflict with
MinMax program in NASA Astronomy Library. 1 Nov 2010. DWF.
:Copyright:
Copyright (c) 2010, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See maxmin.pro)</STRONG><P>
<HR>
<A NAME="MAXWINDOWSIZE">
<H2>MAXWINDOWSIZE</H2></A>
<A HREF="#MAXMIN">[Previous Routine]</A>
<A HREF="#NAME_SELECTOR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Returns the resolution of the largest unobstructed graphics window that can be
created on this particular graphics device. Works properly for Windows and UNIX
computers, excluding Macintosh computers. There is no known way to find the resolution
of the largest unobstructed graphics window on a Macintosh computer, so a fudge factor
of 22 pixels is used to account for the Macintosh "dock".
:Categories:
Utility
:Params:
none:
:Keywords:
monitor_resolution: out, optional, type=long
Set this keyword to a named variable to return the resolution of the
primary display monitor.
:Examples:
To create a window of maximum size::
maxsize = MaxWindowSize()
Window, XSize=maxsize[0], YSize=maxsize[1], /Free
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written, 26 October 2010. DWF.
Misunderstood Macintosh result. Now Mac treated like UNIX. 27 Oct 2010. DWF.
No known method for Macintosh computers. Resorting to a fudge factor
of 22 pixels to account for the Macintosh dock. 27 Oct 2010. DWF.
Code is total reversed for UNIX and Macintosh computers! Fixed. 16 Dec 2011. DWF.
Modified to only use IDLsysMonitorInfo for IDL 6.3 and higher. 23 Feb 2012. DWF.
:Copyright:
Copyright (c) 2010, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See maxwindowsize.pro)</STRONG><P>
<HR>
<A NAME="NAME_SELECTOR">
<H2>NAME_SELECTOR</H2></A>
<A HREF="#MAXWINDOWSIZE">[Previous Routine]</A>
<A HREF="#NCDF_ATTRIBUTE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NAME_SELECTOR
PURPOSE:
The purpose of this function is to implement a pop-up dialog widget
for the purpose of selecting "names". Names can be names of variables,
names of files, etc. Any string array can be used.
CALLING SEQUENCE:
selectedNames = Name_Selector(theNames)
ARGUMENTS:
theNames: A string array of potential "names" that can be selected.
KEYWORDS:
ALL: Set this keyword if you wish all the names to be selected
initially.
CANCEL: An output keyword set to 1 if the user cancels or quits the
program without hitting the Accept button. Set to 0 if a proper
selection was made and the use hits the Accept button.
COUNT: An output keyword containing the number of elements in the return array.
GROUP_LEADER: The widget identifier of a widget who will be the group leader
for this dialog. Passing a group leader is the *only* way to
assure the dialog will be a MODAL dialog (as opposed to a blocking
dialog). A GROUP_LEADER is required if you will be using this
function in an IDL Virtual Machine application.
LABEL: A string that will be placed on a label above the selections.
If not used, no label is used in the program.
NUMCOLS: The number of columns to organize the string array in. The default
is to use one column per approximately 20 strings.
TITLE: A string that is used for the title of the dialog window. If
undefined, then "Selection Widget" is used.
RETURN VALUE:
selectedNames: Typically, an array of selected names. If there is only one item
in the selection, the variable will be a scalar string.
EXAMPLE:
See the Name_Selector_Test procedure below. I use the program to allow the
user to select the names of scientific data sets in an HDF file for further
reading and processing.
MODIFICATION HISTORY:
Written by David W. Fanning, 21 December 2008.
Added a COUNT keyword. DWF. 6 January 2009.
</PRE><P>
<STRONG>(See name_selector.pro)</STRONG><P>
<HR>
<A NAME="NCDF_ATTRIBUTE">
<H2>NCDF_ATTRIBUTE</H2></A>
<A HREF="#NAME_SELECTOR">[Previous Routine]</A>
<A HREF="#NCDF_BROWSER">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_ATTRIBUTE
PURPOSE:
The pupose of this NCDF_Attribute object is to store information about
a netCDF global or variable attribute. The object is principally used
as a utility routine for the NCDF_FILE object. Given the attribute name,
the object will acquire additional information about the attribute from
the netCDF file containing the attribute.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
File I/O
CALLING SEQUENCE:
IDL> attrObj = Obj_New('NCDF_ATTRIBUTE', attrName, parent, VARNAME=varName)
ARGUMENTS:
attrName: The case sensitive name of a netCDF attribute that is stored in the
netCDF file. (Input and required.)
parent: The object reference (NCDF_FILE object) of the netCDF file. In other words, the
object reference of the file that contains this attribute. (Input and required.)
KEYWORD PARAMETERS:
varName: If this is a variable attribute, this is the case sensitive name of the
variable that the attribute is attached to. (Input and required for variable
attributes.) Note that a variable object reference may be used in place of the
variable name.
METHODS:
The following methods are available. Each is documented in front of the method.
attrName = attrObject -> GetName()
propertyValue = attrObject -> GetProperty(attrProperty)
attrValue = attrObject -> GetValue()
attrObject -> ParseAttribute
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 Feb 2010.
</PRE><P>
<STRONG>(See ncdf_attribute__define.pro)</STRONG><P>
<HR>
<A NAME="NCDF_BROWSER">
<H2>NCDF_BROWSER</H2></A>
<A HREF="#NCDF_ATTRIBUTE">[Previous Routine]</A>
<A HREF="#NCDF_CASTDATATYPE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_BROWSER
PURPOSE:
This program is designed to make it easier to browse and read the
data and metadata in netCDF and HDF files. The user can browse files,
and read the data and metadata into main-level IDL variables. New netCDF
and HDF files can be opened at any time. The user interacts with the
program via a browser window (GUI). This program is a wrapper for the
NCDF_DATA object (ncdf_data__define.pro), which must also be downloaded.
Note that only HDF files with scientific datasets (SD) can be read currently.
There is no support for VDATA objects or other objects sometimes found in HDF
files. Also note that when variables are returned from HDF files, they are returned
in a calibrated form, if calibration information about the variable is present in the
file. Calibration information is presented as an extra variable attribute in the
browser.
calibratedData = calData.cal * (uncalibratedData - calData.offset)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
File I/O
CALLING SEQUENCE:
IDL> NCDF_Browser, filename
Arguments:
filename: The name of a netCDF and HDF file to open and browse.
KEYWORD PARAMETERS:
EXTENSION: In general, netCDF and HDF files use *.nc, *.ncf, *.ncdf and *.hdf file extensions to
identify themselves as netCDF and HDF files. Some users have their own file extensions.
You can use this keyword to identify the file extension you wish to use. If
set here, it will be used as the file filter in place of the normal file
extensions in DIALOG_PICKFILE.
obj = ('NCDF_DATA', file, EXTENSION='*.bin')
NO_NEW_FILE: If this keyword is set, then the button that allows a new file to be open
on the browser is not created.
NO_READ_ON_PARSE: Normally, when a file is opened it is parsed for information.
One piece of information is the minimum and maximum values of the variables.
This requires actually reading the variables. This can slow things down
considerably is the variable is large. Setting this keyword will suppress
the reading of the variables during the parsing of the data file, with the
result that no minimum or maximum values will be reported.
TITLE: Set this keyword to a string that is on the title bar of the browser.
XOFFSET: Set this keyword to the X offset in pixels of the top-left corner of the browser.
YOFFSET: Set this keyword to the Y offset in pixels of the top-left corner of the browser.
NOTES:
This program is only a (useful) front-end for a more flexible
object program of class NCDF_DATA. In this front end, the NCDF_DATA
object is created and then destroyed when the GUI is destroyed.
The NCDF_DATA object can be used to read netCDF data in a non-interactive
way, if you prefer not to use a GUI to interact with the data file.
MODIFICATION HISTORY:
Written by: David W. Fanning, 03 Feb 2008. Used ideas from many
people, including Chris Torrence, Ken Bowman, Liam Gumely,
Andrew Slater, and Paul van Delst.
Added Extension keyword. DWF. 04 Feb 2008.
Added error handling and protection for NCDF variables that have a dimension of length zero. 22 April 2009. DWF.
Added NO_READ_ON_PARSE keyword. 22 April 2009. DWF.
Now convert NCDF CHAR type variables to strings on output. 22 April 2009. DWF
Made the default value of NO_READ_ON_PARSE set to 1. 25 June 2009. DWF.
Added NO_NEW_FILE keyword to suppress the Open File button. 3 February 2010. DWF.
Added TITLE, XOFFSET, and YOFFSET keywords. 5 February 2010. DWF.
Fixed a problem with memory leakage when the input file cannot be read. 1 May 2010. DWF.
</PRE><P>
<STRONG>(See ncdf_browser.pro)</STRONG><P>
<HR>
<A NAME="NCDF_CASTDATATYPE">
<H2>NCDF_CASTDATATYPE</H2></A>
<A HREF="#NCDF_BROWSER">[Previous Routine]</A>
<A HREF="#NCDF_CONTAINER">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_CastDataType
PURPOSE:
This is a utility routine to turn IDL data types into the equivalent
netCDF data type. In other words, change 'STRING' to 'CHAR' and so on.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
ncdf_datatype = NCDF_CastDataType(variable)
ARGUMENTS:
variable: The IDL variable for which you want a netCDF data type.
Or, if the TYPE keyword is set, the variable type index you wish
to convert. Or, if the TNAME keyword is set, the variable type
name you wish to convert.
KEYWORDS:
TYPE: If set, the positional argument is an IDL variable type of
the sort returned by the SIZE function with the TYPE keyword set.
type = Size(variable, /TYPE)
TNAME: If set, the positional argument is an IDL variable type of
the sort returned by the SIZE function with the TNAME keyword set.
type = Size(variable, /TNAME)
RETURN VALUE:
ncdf_datatype: The netCDF data type of the variable. Possible values are
'BYTE', 'CHAR', 'SHORT', 'LONG', 'FLOAT' and 'DOUBLE'.
NOTES:
The program is designed to work with the NCDF_FILE object and related programs.
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 February 2010.
Made a UINT data type be cast to LONG, rather than SHORT. 29 April 2010. DWF.
Added TYPE and TNAME keywords. 5 May 2010. DWF.
</PRE><P>
<STRONG>(See ncdf_castdatatype.pro)</STRONG><P>
<HR>
<A NAME="NCDF_CONTAINER">
<H2>NCDF_CONTAINER</H2></A>
<A HREF="#NCDF_CASTDATATYPE">[Previous Routine]</A>
<A HREF="#NCDF_DATA__DEFINE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_Container
PURPOSE:
This is a beefed-up IDL_CONTAINER object written as a utility object
for the NCDF_FILE object and related objects. In particular, two new
container methods have been added. The FindByID method searches container
objects by object ID, and the FindByName method searches container object
by object name. If found, the object reference is returned. This object
is a subclassed IDL_CONTAINER object and uses the IDL_CONTAINER
initialization routine.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
ncdf_container = NCDF_Container()
ARGUMENTS:
Those used in the IDL_CONTAINER method.
RETURN VALUE:
A sub-classed IDL_Container object.
NOTES:
The program is designed to work with the NCDF_FILE object and related programs.
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 February 2010.
</PRE><P>
<STRONG>(See ncdf_container__define.pro)</STRONG><P>
<HR>
<A NAME="NCDF_DATA__DEFINE">
<H2>NCDF_DATA__DEFINE</H2></A>
<A HREF="#NCDF_CONTAINER">[Previous Routine]</A>
<A HREF="#NCDF_DIMENSION">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_DATA__DEFINE
PURPOSE:
This program is designed to make it easier to browse and read the
data and metadata in netCDF and HDF files. The user can browse files,
and read the data and metadata into main-level IDL variables. New netCDF
and HDF files can be opened at any time. The user interacts with the
program via a browser window (GUI) or directly through the methods of
the object. The program implements an IDL object.
Note that only HDF files with scientific datasets (SD) can be read currently.
There is no support for VDATA objects or other objects sometimes found in HDF
files. Also note that when variables are returned from HDF files, they are returned
in a calibrated form, if calibration information about the variable is present in the
file. Calibration information is presented as an extra variable attribute in the
browser.
calibratedData = calData.cal * (uncalibratedData - calData.offset)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
File I/O
CALLING SEQUENCE:
IDL> nCDFObject = Obj_New('NCDF_DATA', filename)
ARGUMENTS:
filename: The name of a netCDF or HDF file to open and browse.
KEYWORD PARAMETERS:
BROWSE: If this keyword is set, the Browse Window is invoked as soon
as the object is initiated.
DESTROY_FROM_BROWSER: As with all objects, this object is persistent until
it is destroyed. However, with this keyword set, the object will
be destroyed when the user closes the Browse Window.
EXTENSION: In general, netCDF and HDF files use *.nc, *.ncf, *.ncdf of *.hdf file extensions to
identify themselves as netCDF or HDF files. Some users have their own file extensions.
You can use this keyword to identify the file extension you wish to use. If
set here, it will be used as the file filter in place of the normal file
extensions in DIALOG_PICKFILE.
obj = ('NCDF_DATA', file, EXTENSION='*.bin')
NO_READ_ON_PARSE: Normally, when a file is opened it is parsed for information.
One piece of information is the minimum and maximum values of the variables.
This requires actually reading the variables. This can slow things down
considerably is the variable is large. Setting this keyword will suppress
the reading of the variables during the parsing of the data file, with the
result that no minimum or maximum values will be reported.
NOTES:
This program is designed to be flexible in how it is used, so it
can be used in both interactive and non-interactive (called directly)
ways. A less flexible way of interacting with the program is via the
NCDF_BROWSER program, which is a front-end to this object.
The netCDF and HDF file formats are thought to be "standards". And to
a large extent, they are. But files are not always created to standards,
and both netCDF and HDF files can be quirky. If you look carefully at the
code you will see places where I work around quirks in the files I typically
use on a daily basis. If you find you can't read a particular file, let me know
about it. I may be able to improve the program in such as way that it can be read.
This program is not meant to be the be-all and end-all of programs. Rather, it is
a tool I use, and improve upon whenever necessary, in my own work with netCDF and HDF
files. It will get better for all of us if you report problems to me directly.
METHODS:
The following methods can be used directly.
ncdfObject -> Browse ; Use GUI to browse file data and metadata.
ncdfObject -> OpenFile, filename ; Opens a new netCDF or HDF file.
globalAttr = ncdfObject -> ReadGlobalAttr() ; Return a structure containing global attributes.
attribute = ncdfObject -> ReadAttribute(attrname); Return an attribute, identified by name.
dim = ncdfObject -> ReadDimension(dimName) ; Return a dimension, identified by name.
variable = ncdfObject -> ReadVariable(varname) ; Return a variable, identified by name.
varstruct = ncdfObject -> ReadVariableWithAttr(varname) ; Return a variable, identified by
; name, along with its attributes.
allData = ncdfObject -> ReadFile(filename) ; Read all the data in the file, into structures.
EXAMPLE:
IDL> filename = 'example.nc'
IDL> ncdfObj = Obj_New('NCDF_DATA', filename)
IDL> ncdfObj -> Browse
IDL> Obj_Destroy, ncdfObj
MODIFICATION HISTORY:
Written by: David W. Fanning, 03 Feb 2008. Used ideas from many
people, including Chris Torrence, Ken Bowman, Liam Gumely,
Andrew Slater, and Paul van Delst.
Added EXTENSION keyword, resizeable TLB, and ability to download
individual global attibutes. DWF. 04 Feb 2008.
Added ReadDimension and ReadVariableWithAttr methods. DWF. 05 Feb 2008.
Ill-formed attribute names giving me fits. Now doing checks with IDL_VALIDNAME
before creating structures. 06 February 2008. DWF.
Same problem. Wide use of IDL_VALIDNAME everywhere it seems wise. 06 Feb 2008. DWF.
Added functionality to read a variable with its attributes from the browser interface,
and fixed a problem with reading CHAR values. 2 March 2008. DWF.
Fixed a problem with changing variable name when reading variable plus attributes. 6 March 2008. DWF.
Fixed a problem with not setting GLOBAL keyword when inquiring about global attribute. 6 March 2008. DWF.
Made sure file was parsed before attempting to read variables and attributes to avoid errors. 7 March 2008. DWF.
Small bug with variable attributes fixed. 18 Dec 2008. DWF.
Added ability to read HDF files containing Scientific Datasets (SD). 21 February 2009. DWF.
Added error handling and protection for NCDF variables that have a dimension of length zero. 22 April 2009. DWF.
Added NO_READ_ON_PARSE keyword. 22 April 2009. DWF.
Now convert NCDF CHAR type variables to strings on output. 22 April 2009. DWF
Fixed a problem with the directory being correct when file name passed in. 11 May 2009. DWF.
Added COUNT, OFFSET, and STRIDE keywords to ReadVariable method. 25 June 2009. DWF.
When reading a netCDF variable by itself (without it's attributes), the program now looks for
a SCALE_FACTOR and ADD_OFFSET attribute, and if found will apply this to the variable before
it is returned to the user. 24 August 2009. DWF.
Added the methods GetAttrNames, GetVarNames, GetVarAttrNames, and ReadVarAttr to retrieve specfic
information from the data files. 16 November 2009. DWF.
Modified the ReadVariableWithAttr method to include the number of dimensions (in the NDIMS field,
and the dimensions (in the DIMS field) in the return structure. For HDF files, the DIMS field
is a vector of the dimensions of the variable. For netCDF files, the DIMS field is a vector
of dimension IDs for the dimensions of the variable. 27 Nov 2009. DWF.
Andy Meigs alerted me to a problem creating a structure when the ncdf variable name
is ill-formed according to IDL structure tag name rules. Fixed in the ReadFile method.
30 November 2009. DWF.
Added NO_NEW_FILE keyword to the BROWSE method. This keyword will suppress the OPEN FILE
button on the browse interface. 3 Feb 2010. DWF.
Made the default browser size a bit larger to accomodate longer variable names. 3 Feb 2010. DWF.
Add a check for HDF/netCDF file type in the INIT method to better accommodate reading data
from the file without first parsing the file. 16 March 2010. DWF.
Changed the ReadVariable for netCDF files to now check for missing data, using either the
depreciated missing_value attribute or the compliant _FillValue attribute. Missing data
is now identified via new output keywords MISSINGINDICES and FILLVALUE, and missing data
is not scaled or offset, if these operations are applied to the data prior to return.
21 March 2010. DWF. Problem with these changes, fixed 23 March 2010. DWF.
Fixed a problem with memory leakage when the input file cannot be read. 1 May 2010. DWF.
Fixed a problem with memory leakage from created structures. 1 May 2010. DWF.
Have done some work on parsing HDF-EOS swath files, but currently unused in code. 15 May 2010. DWF.
Modified the ReadVariable method to check for 0 length dimensions when reading variables
from HDF files. 21 July 2010. DWF.
Modified the global attribute structure so that the "filename" field, which holds the
name of the netCDF of HDF file is now named "ncdf_filename" or "hdf_filename". This
will avoid conflicts with global attributes with "filename". 20 January 2011. DWF.
Typo in the section reading calibration data fixed. 12 March 2013. DWF.
</PRE><P>
<STRONG>(See ncdf_data__define.pro)</STRONG><P>
<HR>
<A NAME="NCDF_DIMENSION">
<H2>NCDF_DIMENSION</H2></A>
<A HREF="#NCDF_DATA__DEFINE">[Previous Routine]</A>
<A HREF="#NCDF_FILE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_DIMENSION
PURPOSE:
The pupose of this NCDF_Dimension object is to store information about
a netCDF dimension. The object is principally used as a utility routine
for the NCDF_FILE object. Given the dimension name, the object will
acquire additional information about the dimension from the netCDF file
containing the dimension.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
File I/O
CALLING SEQUENCE:
IDL> dimObj = Obj_New('NCDF_DIMENSION', dimName, parent)
ARGUMENTS:
dimName: The case sensitive name of a netCDF dimension that is stored in the
netCDF file. (Input and required.)
parent: The object reference (NCDF_FILE object) of the netCDF file. In other words, the
object reference of the file that contains this attribute. (Input and required.)
KEYWORD PARAMETERS:
None.
METHODS:
The following methods are available. Each is documented in front of the method.
dimName = dimObject -> GetID()
dimName = dimObject -> GetName()
dimName = dimObject -> GetSize()
propertyValue = dimObject -> GetProperty(dimProperty)
dimValue = dimObject -> GetValue()
dimName = dimObject -> GetUnlimited()
dimObject -> ParseAttribute
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 Feb 2010.
</PRE><P>
<STRONG>(See ncdf_dimension__define.pro)</STRONG><P>
<HR>
<A NAME="NCDF_FILE">
<H2>NCDF_FILE</H2></A>
<A HREF="#NCDF_DIMENSION">[Previous Routine]</A>
<A HREF="#NCDF_FILE_EXAMPLES">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_FILE
PURPOSE:
The pupose of this NCDF_File object is three-fold. (1) Allow the user to easily
determine what information is inside a netCDF file and allow easy access
to such information. (2) Allow the user to easily create a netCDF file from
scratch. (3) Allow the user to easily copy information from one netCDF
file to another.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
File I/O
CALLING SEQUENCE:
IDL> nCDFObject = Obj_New('NCDF_FILE', filename)
ARGUMENTS:
filename: The name of a netCDF file to read, write to, or browse.
KEYWORD PARAMETERS:
ALERT: Set this keyword if you wish to have alert from the object's error logger.
Input. Default is 1.
BROWSE: If this keyword is set, the Browse Window is invoked as soon
as the object is initiated. Input. Default is 0.
CLOBBER: Set this keyword if you are opening a netCDF file that already exists and
you want to overwrite the existing file. Input. Default is 0.
CREATE: Set this keyword if you wish to create a new netCDF file to write
into. Input. Default is 0, which means the file will be opened as
"read-only".
DELETE_ON_DESTROY: Set this keyword if you wish to delete the error log file when
the ErrorLogger object is destroyed. This will only happen if the ErrorLogger
object is not in an error state. Input. Default is 1.
MODIFY: Set this keyword if you wish to modify (write to) a file you are opening.
If not set, the file will be opened as "read-only".
METHODS:
The following methods are available. Each is documented in front of the method.
ncdfObject -> Browse
ncdfObject -> CopyVarAttrTo, varName, attrName, destObj
ncdfObject -> CopyVarDataTo, varName, destObj, COUNT=count, OFFSET=offset, STRIDE=stride
ncdfObject -> CopyVarDefTo, varName, destObj
ncdfObject -> CopyGlobalAttrTo, attrName, destObj
ncdfObject -> CopyDimTo, dimName, destObj
dimNames = ncdfObject -> GetDimNames(COUNT=dimCount)
dimValue = ncdfObject -> GetDimValue(dimName)
fileID = ncdfObject -> GetFileID()
globalAttrNames = ncdfObject -> GetGlobalAttrNames(COUNT=attrCount)
attrValue = ncdfObject -> GetGlobalAttrValue(attrName, DATATYPE=datatype)
ncdfObject -> GetProperty, ....
property = ncdfObject -> GetProperty(thisProperty)
varAttrNames = ncdfObject -> GetVarAttrNames(varName, COUNT=attrCount)
varAttrValue = ncdfObject -> GetVarAttrValue(varName, varAttrName, COUNT=attrCount)
varNames = ncdfObject -> GetVarNames(COUNT=varCount)
varData = ncdfObject -> GetVarData(varName, COUNT=count, OFFSET=offset, STRIDE=stride)
answer = ncdfObject -> HasGlobalAttr(attrName, OBJECT=object)
answer = ncdfObject -> HasDim(dimName, OBJECT=object)
answer = ncdfObject -> HasVar(varName, OBJECT=object)
answer = ncdfObject -> HasVarAttr(varName, attrName, OBJECT=object)
ncdfObject -> PrintFileInfo
ncdfObject -> ParseFile
ncdfObject -> SetMode, DEFINE=define, DATA=data
ncdfObject -> WriteVarData, varName, data, COUNT=count, OFFSET=offset, STRIDE=stride
ncdfObject -> WriteVarDef, varName, dimNames, DATATYPE=datatype, VAROBJ=varObj
ncdfObject -> WriteDim, dimName, dimSize, UNLIMITED=unlimited
ncdfObject -> WriteGlobalAttr, attrName, attrValue, DATATYPE=datatype
ncdfObject -> WriteVarAttr, attrName, attrValue, varObj, DATATYPE=datatype
NOTES:
Note that all variable, attribute, and dimension names in a netCDF file are CASE SENSITIIVE!!
Thus, it is a good idea to use the methods provided in this object to obtain and examine
information in the file, as these names are handled in a case sensitive manner.
Whenever you are creating a new netCDF file, you should try to create the file in
the following way.
1. Create your global attributes.
2. Create the dimensions you will be using to describe the variables.
3. Define the variables. To do this correctly, dimensions MUST be defined.
4. Define variable attributes.
5. Load your variables with data.
Note that the data type of the _FillValue variable attribute MUST match the
data type of the variable data. Otherwise, you will have MANY problems! This
is a common source of error.
Note that in almost all cases where you see the names "varName", "dimName", or
"attrName" used as input variables, you can substitute the proper object
reference in place of the actual name. In other words, you could get the value
of a variable attribute by doing something like this:
check = ncdfObject -> HasAttr('history', OBJECT=attrObj)
IF check THEN attrValue = ncdfObject -> GetGlobalAttrValue(attrObj)
as opposed to this:
IF check THEN attrValue = ncdfObject -> GetGlobalAttrValue('history')
EXAMPLE:
IDL> filename = 'example.nc'
IDL> ncdfObj = Obj_New('NCDF_FILE', filename)
IDL> ncdfObj -> Browse
IDL> Obj_Destroy, ncdfObj
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 Feb 2010, using (stealing, really) plenty of ideas
from Mark Hadfield's Motley Library. Mark's mghncfile object is terrific, but it
had a number of limitations for my particular application, which I have attemped
to correct in my version of the software. But I wouldn't have even attempted this
had Mark not blazed the trail and Matt Savoie not insisted that I look at Mark's
wonderful library.
Changes in the way dimensions with a zero length are handled. 11 Feb 2010, DWF.
Added GetVarInfo method. 20 March 2010. DWF.
Added MISSINGINIDCES and FILLVALUE output keywords to GetVarData method. 20 March 2010. DWF.
Added output keywords SCALE_FACTOR, ADD_OFFSET, and DATATYPE to GetVarData method
so that these values can be obtained with the data. 29 Apr 2010. DWF.
I changed "missingValue" to "fillValue" some time ago, but I missed one in
the GetVarData method. Fixed. 7 June 2010. DWF.
Used the undefine procedure OBJ_DELETE, rather than OBJ_DESTROY. Sheesh! 18 June 2010. DWF.
Added NETCDF4_FORMAT keyword. 13 Feb 2012. DWF.
Added a bunch of new IDL 8.0 and 8.1 keyword to the WriteVarDef method to allow
access to these keywords in NCDF_VarDef. Also modified the NETCDF4_FORMAT keyword
to apply only in IDL versions 8.0 and higher. 21 Feb 2012. DWF.
Small typo fixed in setting CHAR datatype for IDL 8.1 and higher. 22 May 2013. DWF.
Typo (CONTINUOUS->CONTIGUOUS) fixed in WriteDefVar method. 30 July 2013. DWF.
Modified CopyVarDefTo method to allow new NCDF4 keywords. 30 July 2013. DWF.
Added DelGlobalAttr method to allow deletion of global attributes. 11 Jan 2014. DWF.
</PRE><P>
<STRONG>(See ncdf_file__define.pro)</STRONG><P>
<HR>
<A NAME="NCDF_FILE_EXAMPLES">
<H2>NCDF_FILE_EXAMPLES</H2></A>
<A HREF="#NCDF_FILE">[Previous Routine]</A>
<A HREF="#NCDF_ISVALIDFILE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_FILE_EXAMPLES
PURPOSE:
This is a utility routine demonstrates the several ways it is possible
to use the NCDF_FILE object to create netCDF files, copy information
from one netCDF file to another, and to read information from a netCDF
file.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
NCDF_File_Examples
ARGUMENTS:
None.
KEYWORDS:
None.
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 February 2010.
Updated to use a time variable for the frame number. 29 Oct 2011.
</PRE><P>
<STRONG>(See ncdf_file_examples.pro)</STRONG><P>
<HR>
<A NAME="NCDF_ISVALIDFILE">
<H2>NCDF_ISVALIDFILE</H2></A>
<A HREF="#NCDF_FILE_EXAMPLES">[Previous Routine]</A>
<A HREF="#NCDF_VARIABLE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_ISVALIDFILE
PURPOSE:
Utility routine to determine if a file is a valid netCDF file or not.
Returns a 1 if the file is valid and a 0 otherwise.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utility.
CALLING SEQUENCE:
result = NCDF_IsValidFile(filename)
INPUTS:
filename: The name of a filename to open to see if it is a valid netCDF file.
RETURN VALUE:
result: A 1 if the file can be opened as a netCDF file. A 0 otherwise.
KEYWORDS:
None.
ALGORITHM:
Try to open the file. If you fail, it is not an netCDF file.
MODIFICATION HISTORY:
Written by: David W. Fanning, 21 February 2010.
</PRE><P>
<STRONG>(See ncdf_isvalidfile.pro)</STRONG><P>
<HR>
<A NAME="NCDF_VARIABLE">
<H2>NCDF_VARIABLE</H2></A>
<A HREF="#NCDF_ISVALIDFILE">[Previous Routine]</A>
<A HREF="#PICKCOLOR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
NCDF_VARIABLE
PURPOSE:
The pupose of this NCDF_Variable object is to store information about
a netCDF variable. The object is principally used as a utility routine
for the NCDF_FILE object. Given the variable name, the object will acquire
additional information about the variable from the netCDF file containing
the variable.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
File I/O
CALLING SEQUENCE:
IDL> varObj = Obj_New('NCDF_VARIABLE', varName, parent)
ARGUMENTS:
varName: The case sensitive name of a netCDF variable that is stored in the
netCDF file. (Input and required.)
parent: The object reference (NCDF_FILE object) of the netCDF file. In other words, the
object reference of the file that contains this attribute. (Input and required.)
KEYWORD PARAMETERS:
None.
METHODS:
The following methods are available. Each is documented in front of the method.
varObject -> AddAttr
varAttrNames = varObject -> GetAttrNames()
dimIDs = varObject -> GetDimIDs()
dimNames = varObject -> GetDimNames()
varAttrValue = varObject -> GetAttrValue()
varID = varObject -> GetID()
varName = varObject -> GetName()
propertyValue = varObject -> GetProperty(attrProperty)
varValue = varObject -> GetValue()
varObject -> ParseVariable
MODIFICATION HISTORY:
Written by: David W. Fanning, 3 Feb 2010.
Changes to the way dimensions of length 0 are handled. 11 Feb 2010. DWF.
Added GetInfo method. 20 Mar 2010. DWF.
Added MISSINGINDICES and FILLVALUE keywords to GetValue method to return the indices
and the value of missing data. 20 Mar 2010. DWF.
Modified the GetValue method so that if the data returned is scaled and/or offset
then the "missing" data value is preserved, although its data type may change.
In other words, the "missing" data is not scaled or offset. 20 Mar 2010. DWF.
Added output keywords SCALE_FACTOR, ADD_OFFSET, and DATATYPE to the GetValue method
so that these values can be returned to the caller at run-time. 29 April 2010. DWF.
Modified AddAttr method to allow for additional data types in attributes, specifically
INT data type. 3 June 2013. DWF.
Had to modify AddAttr method again to allow compatibility with IDL versions below 8.1. 26 July 2013. DWF.
</PRE><P>
<STRONG>(See ncdf_variable__define.pro)</STRONG><P>
<HR>
<A NAME="PICKCOLOR">
<H2>PICKCOLOR</H2></A>
<A HREF="#NCDF_VARIABLE">[Previous Routine]</A>
<A HREF="#PRECIPMAP">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
PICKCOLOR
PURPOSE:
A modal dialog widget allowing the user to select
the RGB color triple specifying a color. The return
value of the function is the color triple specifying the
color or the "name" of the color if the NAME keyword is set.
AUTHOR:
FANNING SOFTWARE CONSULTING:
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Graphics, Color Specification. See related program cgCOLOR.
CALLING SEQUENCE:
color = PickColor(colorindex)
RETURN VALUE:
The return value of the function is a 1-by-3 array containing
the values of the color triple that specifies the selected color.
The color can be loaded, for example, in any color index:
color = PickColor(240)
TVLCT, color, 240
The return value is the original color triple if the user
selects the CANCEL button.
IF the NAMES keyword is set, the return value of the function is
the "name" of the selected color. This would be appropriate for
passing to the cgCOLOR program, for example.
OPTIONAL INPUT POSITIONAL PARAMETERS:
COLORINDEX: The color index of the color to be changed. If not
specified the color index !D.Table_Size - 2 is used.
The Current Color and the Color Sliders are set to the
values of the color at this color index.
OPTIONAL INPUT KEYWORD PARAMETERS:
GROUP_LEADER: The group leader for this widget program. This
keyword is required for MODAL operation. If not supplied
the program is a BLOCKING widget. Be adviced, however, that
the program will NOT work if called from a blocking widget
program, unless a GROUP_LEADER is supplied.
NAMES: Set this keyword to return the "name" of the selected color
rather than its color triple.
STARTINDEX: 88 pre-determined colors are loaded The STARTINDEX
is the index in the color table where these 88 colors will
be loaded. By default, it is !D.Table_Size - 89.
TITLE: The title on the program's top-level base. By default the
title is "Pick a Color".
OPTIONAL INPUT KEYWORD PARAMETERS:
CANCEL: A keyword that is set to 1 if the CANCEL button is selected
and to 0 otherwise.
COMMON BLOCKS:
None.
SIDE EFFECTS:
88 pre-determined colors are loaded in the color table.
In addition, the color index at COLORINDEX is modified while
the program is on the display. When the program exits, the
entry color table is restored. Thus, on 8-bit displays there
might be some color effects in graphics windows while PICKCOLOR
is on the display. Changes in the color table are not noticable
on 16-bit and 24-bit displays.
EXAMPLE:
To specify a color for a plot in color decomposition OFF mode:
Device, Decomposed=0
!P.Color = !P.Color < (!D.Table_Size - 1)
color = PickColor(!P.Color, Cancel=cancelled)
IF NOT cancelled THEN BEGIN
TVLCT, color, !P.Color
Plot, data
ENDIF
To specify a color for a plot in color decomposition ON mode:
Device, Decomposed=1
color = PickColor(Cancel=cancelled)
!P.Color = Color24(color)
IF NOT cancelled THEN Plot, data
To obtain the name of the selected color to pass to GetColor:
selectedColor = PickColor(/Name)
axisColor = cgColor(selectedColor, !D.Table_Size-4)
MODIFICATION HISTORY:
Written by: David Fanning, 28 Oct 99.
Added NAME keyword. 18 March 2000, DWF.
Fixed a small bug when choosing a colorindex less than !D.Table_Size-17. 20 April 2000. DWF.
Added actual color names to label when NAMES keyword selected. 12 May 2000. DWF.
Modified to use 88 colors and cgCOLOR instead of 16 colors and GETCOLOR. 4 Dec 2000. DWF.
Changed FSC_Color to cgColor everywhere. 16 Jan 2013. DWF.
</PRE><P>
<STRONG>(See pickcolor.pro)</STRONG><P>
<HR>
<A NAME="PRECIPMAP">
<H2>PRECIPMAP</H2></A>
<A HREF="#PICKCOLOR">[Previous Routine]</A>
<A HREF="#PRINTWINDOW">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
PrecipMap
PURPOSE:
This is a program that demonstrates how to place an IDL map projection
onto an image that is already in a map projection space. It uses a NOAA
precipitation image that is in a polar stereographic map projection, and
for which the latitudes and longitudes of its four corners are known.
For additional details, see http://www.idlcoyote.com/map_tips/precipmap.html.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Map Projection
CALLING SEQUENCE:
IDL> PrecipMap, filename
INPUTS:
filename: The name of the precipitation file. For demo, download
ST4.2005010112.24h.bin from http://www.idlcoyote.com/data/ST4.2005010112.24h.bin.
KEYWORDS:
DATA: Set this keyword to a named variable that on output will contain the scaled data.
PALETTE: Set this keyword to a named variable that on output will contain the color
palette used to display the data.
RESTRICTIONS:
Requires files from the Coyote Library:
http://www.idlcoyote.com/documents/programs.html
MODIFICATION HISTORY:
Written by David W. Fanning, 28 April 2006 from code and discussion supplied
by James Kuyper in the IDL newsgroup.
Renamed Colorbar procedure to cgColorbar to avoid conflict with IDL 8 Colorbar function.
26 September 2010. DWF.
Got the polar stereo map projection correct. 5 September 2011. DWF.
Added DATA, MAP, and PALETTE output keywords and updated to use more modern Coyote
Library mapping routines. 2 November 2012. DWF.
</PRE><P>
<STRONG>(See precipmap.pro)</STRONG><P>
<HR>
<A NAME="PRINTWINDOW">
<H2>PRINTWINDOW</H2></A>
<A HREF="#PRECIPMAP">[Previous Routine]</A>
<A HREF="#PSWINDOW">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
PRINTWINDOW
This program sends the contents of the specified
window to the default printer. The current window
is used if a window index number is not provided.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics
CALLING SEQUENCE:
IDL> PrintWindow, wid
OPTIONAL POSITIONAL PARAMETERS:
WID The window index number of the window to send to the
printer. !D.Window used by default.
KEYWORD PARAMETERS:
LANDSCAPE If this keyword is set, the output is in Landscape
mode. Otherwise, Portrait mode is used.
PAGESIZE: Set this keyword to a string indicating the type
of PostScript page size you want. Current values are "LETTER",
"LEGAL", and "A4". Default is "LETTER".
RGB_ERROR: Some printers (particularly attached to LINUX machines) cannot
load a 24-bit image. You get this error message:
%Can't set RGB color on an indexed destination.
If this happens to you, set this keyword and the 24-bit image will
be made into a 2D image with color table vectors. Colors are not
quaranteed to be accurate with this method, but in practice it is
not usually too bad.
IDL> PrintWindow, /RGB_Error
MODIFICATION HISTORY:
Written by David W. Fanning based on previous PRINT_IT program. 29 July 2000.
Added RGB_Error keyword. 2 Nov 2004. DWF.
</PRE><P>
<STRONG>(See printwindow.pro)</STRONG><P>
<HR>
<A NAME="PSWINDOW">
<H2>PSWINDOW</H2></A>
<A HREF="#PRINTWINDOW">[Previous Routine]</A>
<A HREF="#PS_BACKGROUND">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
PSWINDOW
PURPOSE:
This function is used to calculate the size of a PostScript
window that has the same aspect ratio (ratio of height to
width) as the current display graphics window. It creates
the largest possible PostScript output window with the
desired aspect ratio. This assures that PostScript output
looks similar, if not identical, to normal graphics output
on the display.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics.
CALLING SEQUENCE:
pageInfo = PSWINDOW()
INPUTS:
None.
KEYWORD PARAMETERS:
ASPECTRATIO: Normally the aspect ratio is matched to the
aspect ratio (ratio of height divided by width) of the current
graphics window. However, this keyword can be used to select
a particular aspect ratio for the PostScript window. This should
be a floating point value.
CM: Normally the structure value that is returned from this
function reports its values in inches. Setting this keyword
causes the return values to be in units of centimeters.
EUROPEAN: This keyword is depreciated in favor of METRIC.
FUDGE: A quick way to set symetrical XFUDGE and YFUDGE factors.
If this keyword is set to a value, XFUDGE and YFUDGE keywords are
set to the same value. Fudge factors are used only with some
printers and generally only when output is being sent to the
PRINTER device. (See the description of the XFUDGE and YFUDGE
keywords for additional information.)
LANDSCAPE: Normally, a landscape page is selected if the current
graphics window is wider than it is tall. If you prefer a landscape
aspect window on a Portrait page, set the LANDSCAPE keywword to 0.
Setting this keyword to 1 will result in a landscape page no
matter the size of the current graphics window.
MARGIN: The margin around the edges of the plot. The value must be
a floating point value between 0.0 and 0.35. It is expressed in
normalized coordinate units. The default margin is 0.05.
METRIC: If this keyword is set, the program defaults change
so that the CM keyword is set to 1 and the PAGESIZE keyword is
set to "A4".
PAGESIZE: Set this keyword to a string indicating the type
of PostScript page size you want. Current values are "LETTER",
"LEGAL", and "A4". Default is "LETTER".
PRINTER: Set this keyword if the output will be used to
configure the PRINTER device, rather than the PS device.
(In the PRINTER device, offsets are always calculated from
the lower-left corner of the page and do not rotate in
Landscape mode, as they do with the PS device.) Note that
the PRINTER device is only able to accept these keywords
in IDL 5.1 and higher.
XFUDGE: Printers calculate the offset point from the printable
edge of the paper (sometimes), rather from the corner of the paper.
For example, on my Lexmark printer, both X and Y offsets are
calculated from a point 0.25 inches in from the edge. This keyword
allows you to set a "fudge" factor that will be subtracted from
the XOFFSET that is returned to the user. This allows you to create
output that is centered on the page. The fudge factor should be in
the same units as the returned size and offset values.
YFUDGE: Printers calculate the offset point from the printable
edge of the paper (sometimes), rather from the corner of the paper.
For example, on my Lexmark printer, both X and Y offsets are
calculated from a point 0.25 inches in from the edge. This keyword
allows you to set a "fudge" factor that will be subtracted from
the YOFFSET that is returned to the user. This allows you to create
output that is centered on the page. The fudge factor should be in
the same units as the returned size and offset values.
OUTPUTS:
pageInfo: The output value is a named structure defined like
this:
pageInfo = {PSWINDOW_STRUCT, XSIZE:0.0, YSIZE:0.0, $
XOFSET:0.0, YOFFSET:0.0, INCHES:0, PORTRAIT:0, LANDSCAPE:0}
The units of the four size fields are inches unless the CM
keyword is set.
The output can be used to immediately configure the PostScript
or Printer device, like this:
Set_Plot, 'PS' ; or 'PRINTER'
Device, _Extra=pageInfo
RESTRICTIONS:
The aspect ratio of the current graphics window is calculated
like this:
aspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE
EXAMPLE:
To create a PostScript output window with the same aspect
ratio as the curently active display window, type:
pageInfo = PSWINDOW()
SET_PLOT, 'PS'
DEVICE, _Extra=pageInfo
To configure the PRINTER device:
pageInfo = PSWINDOW(/Printer, Fudge=0.25)
SET_PLOT, 'PRINTER'
DEVICE, _Extra=pageInfo
MODIFICATION HISTORY:
Written by: David W. Fanning, November 1996.
Fixed a bug in which the YOFFSET was calculated incorrectly
in Landscape mode. 12 Feb 97.
Took out a line of code that wasn't being used. 14 Mar 97.
Added correct units keyword to return structure. 29 JUN 98. DWF
Fixed a bug in how landscape offsets were calculated. 19 JUL 99. DWF.
Fixed a bug in the way margins were used to conform to my
original conception of the program. 19 JUL 99. DWF.
Added Landscape and Portrait fields to the return structure. 19 JUL 99. DWF.
Added PageSize keyword, changed MARGIN keyword, and completely
rewrote most of the intenal code. 9 FEB 2000. DWF.
Fixed a bug in how I calculated the aspect ratio. 1 MAR 2000. DWF.
Added PRINTER keyword to return proper offset values for the
PRINTER device, where the offset location is not rotated. 1 MAR 2000. DWF.
Added PRINTER fudge factors to take into account that printer offsets are
calculated from the printable area of the paper, rather than the corner
of the paper. 8 AUG 2000. DWF.
Changed the default margin to 0.05 from 0.15. 29 Nov 2004, DWF.
Added EUROPEAN keyword and set LANDSCAPE mode if window wider than higher
as the default if LANDSCAPE is not set. 13 Dec 2010. DWF.
Added ASPECTRATIO keyword to allow user-specified window aspect ratio. 13 Dec 2010. DWF.
Depreciated EUROPEAN keyword in favor of METRIC. 31 Jan 2011. DWF.
Now setting LANDSCAPE=0 if aspect GT 1 and not set otherwise. 19 Feb 2013. DWF.
</PRE><P>
<STRONG>(See pswindow.pro)</STRONG><P>
<HR>
<A NAME="PS_BACKGROUND">
<H2>PS_BACKGROUND</H2></A>
<A HREF="#PSWINDOW">[Previous Routine]</A>
<A HREF="#RANDOMNUMBERGENERATOR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Provides a device-independent way to set the background color in the PostScript device.
:Categories:
Graphics, Utilities
:Params:
color: in, required, type=string/integer, default='white'
The color that is used for the PostScript background. A polygon of
this color is written to the PostScript file and fills the PostScript
"window".
:Examples:
IDL> PS_Background, 'rose'
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written, 17 November 2010. DWF.
Modified to use gcColorFill so that color is done with decomposed color. 24 Dec 2010. DWF.
:Copyright:
Copyright (c) 2010, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See ps_background.pro)</STRONG><P>
<HR>
<A NAME="RANDOMNUMBERGENERATOR">
<H2>RANDOMNUMBERGENERATOR</H2></A>
<A HREF="#PS_BACKGROUND">[Previous Routine]</A>
<A HREF="#RANGEOF">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
RANDOMNUMBERGENERATOR
PURPOSE:
Allows the user to obtain a sequence of pseudo-random numbers. The
object maintains the random number generator seed in such a way that
subsequent calls to GetRandomNumbers will guarentee that you don't
get the same random numbers each time you ask for random numbers.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
Generate three random numbers.
IDL> rng = Obj_New('RandomNumberGenerator', initialSeed)
IDL> numberOfNumbersNeeded = 3
IDL> randomNumbers = rng -> GetRandomNumbers(numberOfNumbersNeeded)
IDL> Print, randomNumbers
0.80952855 0.35878432 0.52150406
Generate a sequence of 8 random digits.
IDL> Print, rng -> GetRandomDigits(8)
21855786
INPUT PARAMETERS FOR INIT METHOD:
initialSeed: The initial seed for the random number generator. If undefined
or absent, the number of seconds after 1 January 1970 is used.
METHODS:
randomNumbers -> GetRandomNumbers(d1, d2, d3, d4 d5, d6, d7, d8)
randomDigits = obj -> GetRandomDigits(numDigets)
obj -> SetSeed, seed
MODIFICATION HISTORY:
Written by David W. Fanning, 13 November 2009.
Added GetRandomDigits method. 7 February 2010. DWF.
Incorrect cleanup of the seed pointer fixed in the CLEANUP procedure.
25 February 2010, DWF.
</PRE><P>
<STRONG>(See randomnumbergenerator__define.pro)</STRONG><P>
<HR>
<A NAME="RANGEOF">
<H2>RANGEOF</H2></A>
<A HREF="#RANDOMNUMBERGENERATOR">[Previous Routine]</A>
<A HREF="#REPMAT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
RANGEOF
PURPOSE:
This function returns the range (i.e., the minimum and maximum value)
of its argument.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utilities
CALLING SEQUENCE:
range = RangeOf(variable)
INPUTS:
variable: Any numeric IDL variable, except complex.
KEYWORD PARAMETERS:
None.
OUTPUTS:
range: A two-element vector containing the minimum and maximum value
of the variable.
EXAMPLE:
x = RandomU(3L, 10) * 100
Print, RangeOf(x)
3.78892 98.4703
MODIFICATION HISTORY:
Written by: David W. Fanning, 15 February 2009.
</PRE><P>
<STRONG>(See rangeof.pro)</STRONG><P>
<HR>
<A NAME="REPMAT">
<H2>REPMAT</H2></A>
<A HREF="#RANGEOF">[Previous Routine]</A>
<A HREF="#RESOLVE_OBJECT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
REPMAT
PURPOSE:
This program replicates a matrix or array in the style of
the MATLAB RebMat command. The matrix or array is "tiled"
in some integer number of columns and rows.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
tiledMatrix = RepMat(matrix, ncol, nrow)
AUGUMENTS:
matix: The matrix or array to be tiled.
ncol: The number of columns in the tile.
nrow: The number of rows in the tile.
RETURN_VALUE:
tiledMatrix: If (xdim,ydim) is the size of the original 2D matrix, then the
output matrix is sized (ncol*xdim, nrow*ydim).
KEYWORDS:
None.
EXAMPLE:
IDL> matrix = Reform(Indgen(6) + 1, 3, 2)
IDL> Print, matrix, FORMAT='(3I3)'
1 2 3
4 5 6
IDL> Print, RepMat(matrix, 3, 2), FORMAT='(9I3)'
1 2 3 1 2 3 1 2 3
4 5 6 4 5 6 4 5 6
1 2 3 1 2 3 1 2 3
4 5 6 4 5 6 4 5 6
MODIFICATION HISTORY:
Written by David W. Fanning, 8 May 2009.
Algorithm significantly improved by Ronn Kling, 4 August 2009.
Added line to handle an input matrix with a trailing 1 dimension correctly. DJ 8 March 2011.
</PRE><P>
<STRONG>(See repmat.pro)</STRONG><P>
<HR>
<A NAME="RESOLVE_OBJECT">
<H2>RESOLVE_OBJECT</H2></A>
<A HREF="#REPMAT">[Previous Routine]</A>
<A HREF="#REVERSE_AXES">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
RESOLVE_OBJECT
PURPOSE:
The purpose of this function is to resolve object methods in files that have the object
methods in the same file as the object class definition module (i.e., object__define.pro).
It is particularly useful in restoring object methods for objects that have been saved and
are being restored. Restored objects often do not know about their methods unless an object
of the same object class has been previously compiled in that IDL session.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utilities
CALLING SEQUENCE:
Resolve_Object, obj_or_class
ARGUMENTS:
obj_or_class: Either an IDL object or the class name of an IDL object. Required parameter.
KEYWORDRS:
ROUTINE_INFO: Not strictly used by the user of the program, but this provides a mechanism by which
currently compiled routine names can be checked, so that object code is not being
recompiled unnecessarily. It is actually used internally in the code in a sort of
recursive approach to handling object superclasses.
INFORMATION:
A discussion of this routine, and of the problem the routine was written to address can
be found here:
http://www.idlcoyote.com/tips/saved_objects.html
MODIFICATION HISTORY:
Written by: David W. Fanning, August 20, 2009, and based on code written by JD Smith and
discussed in the article above.
</PRE><P>
<STRONG>(See resolve_object.pro)</STRONG><P>
<HR>
<A NAME="REVERSE_AXES">
<H2>REVERSE_AXES</H2></A>
<A HREF="#RESOLVE_OBJECT">[Previous Routine]</A>
<A HREF="#SAVETOMAIN">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
REVERSE_AXES
PURPOSE:
The purpose of this program is to extend the SIMPLE_SURFACE
program to demonstrate how to create reversible axes in
object graphics.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Widgets, Object Graphics.
CALLING SEQUENCE:
REVERSE_AXES, data, x, y
REQUIRED INPUTS:
None. Fake data will be used if no data is supplied in call.
OPTIONAL INPUTS
data: A 2D array of surface data.
x: A vector of X data values.
y: A vector of Y data values.
OPTIONAL KEYWORD PARAMETERS:
EXACT: Set this keyword to get exact axis scaling.
_EXTRA: This keyword collects otherwise undefined keywords that are
passed to the surface initialization routine.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
LANDSCAPE: Set this keyword if you are printing in landscape mode. The
default is Portrait mode. The Landscape keyword on the PRINTER object
is set, but not all printers will honor this keyword setting. If yours
does not, set Landscape mode in the Printer Setup dialog.
VECTOR: Set this keyword if you want vector printing (as opposed to
the default bitmap printing).
XTITLE: A string used as the X title of the plot.
YTITLE: A string used as the Y title of the plot.
ZTITLE: A string used as the Z title of the plot.
COMMON BLOCKS:
None.
EXAMPLE:
To use this program with your 2D data, type:
IDL> Reverse_Axes, data
MODIFICATION HISTORY:
Written by: David Fanning, October 2001.
Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See reverse_axes.pro)</STRONG><P>
<HR>
<A NAME="SAVETOMAIN">
<H2>SAVETOMAIN</H2></A>
<A HREF="#REVERSE_AXES">[Previous Routine]</A>
<A HREF="#SCALEMODIS">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
SAVETOMAIN
PURPOSE:
This is used primarily in debugging mode to save a variable to
the main IDL level for later inspection.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Utilities
CALLING SEQUENCE:
SaveToMain, variable, nameOfVariable
ARGUMENTS:
variable: The variable you wish to save at the main IDL level.
nameOfVariable: The name of the variable at the main IDL level. If undefined,
the variable will have the same name as the variable that was
used as the variable argument.
KEYWORDRS:
None.
MODIFICATION HISTORY:
Written by: David W. Fanning, 2 July 2009.
</PRE><P>
<STRONG>(See savetomain.pro)</STRONG><P>
<HR>
<A NAME="SCALEMODIS">
<H2>SCALEMODIS</H2></A>
<A HREF="#SAVETOMAIN">[Previous Routine]</A>
<A HREF="#SCROLLWINDOW">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
SCALEMODIS
PURPOSE:
MODIS corrected reflectance images often appear drab when initially processed
and displayed on a computer using BYTSCL. In fact, the resulting true-color
images look nothing like the images you can find on the MODIS Rapid Response
web page (http://rapidfire.sci.gsfc.nasa.gov/gallery/). After poking around on
the Internet for awhile, I discovered that the Rapid Response Team doesn't use
BYTSCL to prepare the images. Rather, they selectively scale portions of the
reflectance image, using a piecewise scaling with different slopes. This program
implements this Rapid Response Team algorithm.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics
CALLING SEQUENCE:
scaledBand = ScaleModis(red, green, blue)
ARGUMENTS:
red: A two-dimensional array representing the corrected reflectance
values of a MODIS image. This is a required parameter. If the
green and blue parameters are also used, this parameter will
represent the red band of a RGB 24-bit scaled image that is returned.
green: If the three parameters--red, green, and blue--are present, the returned
array is a 24-bit true-color image, scaled appropriately. This parameter
is used as the green band in such an image. The parameter is a two-dimensional
array of corrected reflectance values.
blue: If the three parameters--red, green, and blue--are present, the returned
array is a 24-bit true-color image, scaled appropriately. This parameter
is used as the blue band in such an image. The parameter is a two-dimensional
array of corrected reflectance values.
KEYWORD PARAMETERS:
RANGE: A two-dimensional array that the input bands are first scaled into, prior to
the differential scaling using the MODIS Rapid Response algorithm. The default
input range is [-0.01, 1.10]. These values will be used to set the MIN and MAX
keywords for the BYTSCL command in the initial scaling of the input bands.
CLOUD: The MODIS Rapid Response team uses a slightly different scaling algorithm when
the idea is to emphasize clouds in a MODIS scene. Set this keyword to use the
alternate cloud scaling algorithm.
OUTPUTS:
scaledBand: If a single 2D array is passed as the argument, then scaledBand is the scaled
2D output array. If all three arguments are passed to the program, then scaledBand
is a scaled 24-bit image that represents a true-color or false color representation
of the three input bands.
MODIFICATION HISTORY:
Written by: David W. Fanning, July 2009, using the IDL programs MODIS_FALSE_COLOR and
and SCALE_IMAGE for inspiration. I found these programs on the Internet when poking
around MODIS web pages. I suspect, but I am not sure, these programs were originally
written by Liam Gumley.
Minor changes to the ScaleIt function to be sure partitioning is done correctly. 5 Aug 2009. DWF.
</PRE><P>
<STRONG>(See scalemodis.pro)</STRONG><P>
<HR>
<A NAME="SCROLLWINDOW">
<H2>SCROLLWINDOW</H2></A>
<A HREF="#SCALEMODIS">[Previous Routine]</A>
<A HREF="#SDEVSCL">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
SCROLLWINDOW
PURPOSE:
This procedure is more or less a drop-in replacement for the WINDOW
command. The main difference is that if the requested window size
is larger then the current display size, the window is created in a
base widget with scroll bars so the user can scroll around
the larger window. Use the WID keyword to pass in the window
index number of the window you want to create (a small change
from the WINDOW syntax). If the program can create a window with
this window index number, it will. Otherwise, this keyword will
return the window index number of the window that was actually
created.
I use ScrollWindow to create windows that I can view both on
my large monitor at work and on my smaller laptop monitor when
I travel.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics
CALLING SEQUENCE:
ScrollWindow, xsize, ysize
ARGUMENTS:
xsize: The x size of the graphics window. By default, 640.
ysize: The y size of the graphics window. By default, 512.
KEYWORD PARAMETERS:
FREE: Get a window with a free or unused window index number.
This is *always* done with a scrollable window. The window
index number of the window is returned in the WID keyword.
PIXMAP: Set to create a pixmap window. In this case, no scrollable
window is possible. A normal IDL graphics window is
always created.
SIZEFRAC: Make the window this fraction of the screen dimensions.
A number between 0.0 and 1.0
TITLE: The title string that is displayed on the window.
WID: The window index number. If supplied as an IDL variable,
this can be both an input and an output keyword. If a
window with this window index number can be created, it
is. Otherwise, this varible upon exit from the program
contains the window index number of the graphics window
that was created.
XPOS: The x offset of the upper-left corner of the window.
XSIZE: The same as the xsize argument. Provided so ScrollWindow
can be a drop-in replacement for the Window command.
YPOS: The y offset of the upper-left corner of the window.
YSIZE: The same as the ysize argument. Provided so ScrollWindow
can be a drop-in replacement for the Window command.
EXAMPLE:
ScrollWindow, XSIZE=800, YSIZE=400 ; Produces normal IDL graphics window.
ScrollWindow, XSIZE=1800, YSIZE=1200 ; Produces a scrollable graphics window.
MODIFICATION HISTORY:
Written by: David W. Fanning, 25 March 2009
Added SIZEFRACTION keyword, Mats Löfdahl, 25 November 2012.
</PRE><P>
<STRONG>(See scrollwindow.pro)</STRONG><P>
<HR>
<A NAME="SDEVSCL">
<H2>SDEVSCL</H2></A>
<A HREF="#SCROLLWINDOW">[Previous Routine]</A>
<A HREF="#SELECT_OBJECTS">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
This is a utility routine to perform standard deviation scaling
on image arrays. The user defines a multiple of the standard
deviation and this is used with the standard deviation of the
pixels in the image to create a threshold for linear scaling.
Use the EXCLUDE keyword to exclude a particular value from
the standard deviation calculation.
:Categories:
Utilities, Graphics
:Params:
image: in, required, type=numeric
The image array that is to be scaled.
:Keywords:
exclude: in, optional, type=numeric
Set this keyword to a value in the image array that is to be excluded from the
standard deviation calculation. Normally, this would be the backgroud value of
the image, if there is a background.
multiplier: in, optional, type=float, default=2.0
The standard deviation of the image pixels is computed and then
multiplied by the multiplier factor to produce upper and lower
thresholds for the linear scaling of the image by subtracting
or adding this value to the mean value of the image. The image
is linearly scaled between these two threshold values.
negative: in, optional, type=boolean
Set this keyword to return the "negative" or reverse of the image scaling.
omax: in, optional, type=byte, default=255
Normally, the image is scaled into the range of 0 to 255. Setting the
OMIN and OMAX keywords can change this scaling.
omin: in, optional, type=byte, default=0
Normally, the image is scaled into the range of 0 to 255. Setting the
OMIN and OMAX keywords can change this scaling.
threshold: out, optional, type=float
A two-element array that contains the minimum and maximum thresholds, respectively,
that were calculated for the scaling.
:Examples:
To display an image with standard deviation scaling::
image = cgDemoData(5)
cgDisplay, 256*3, 256
!P.Multi = [0,3,1]
cgImage, image
cgImage, SDevScl(image)
cgImage, SDevScl(image, Exclude=0)
!P.Multi = 0
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written by: David W. Fanning, 5 June 2012.
:Copyright:
Copyright (c) 2012, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See sdevscl.pro)</STRONG><P>
<HR>
<A NAME="SELECT_OBJECTS">
<H2>SELECT_OBJECTS</H2></A>
<A HREF="#SDEVSCL">[Previous Routine]</A>
<A HREF="#SETDEFAULTVALUE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
SELECT_OBJECTS
PURPOSE:
The purpose of this program is to demonstrate how to select
and move objects in an object graphics window. Once the objects
appear in the window, use your mouse to select the objects and
move them in the window. The window is resizeable.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Object Graphics.
CALLING SEQUENCE:
SELECT_OBJECTS
REQUIRED INPUTS:
None.
KEYWORD PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Requires VCOLORBAR from the Coyote Library:
http://www.idlcoyote.com/programs/vcolorbar__define.pro.
EXAMPLE:
Select_Objects
MODIFICATION HISTORY:
Written by David Fanning, 21 September 98.
Added the ability to shrink and expand the objects. 27 Sept 98. DWF.
Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See select_objects.pro)</STRONG><P>
<HR>
<A NAME="SETDEFAULTVALUE">
<H2>SETDEFAULTVALUE</H2></A>
<A HREF="#SELECT_OBJECTS">[Previous Routine]</A>
<A HREF="#SHARPEN">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
This procedure sets default values for positional and keyword arguments to
IDL procedures and functions.
:Categories:
Utilities
:Params:
argument: in, required
The augument variable you are setting the default value of. If this variable
is undefined, the `defaultValue` will be assigned to it. Otherwise, the argument
variable will not change.
defaultvalue: in, required
The default value that will be assigned to the argument variable ONLY if the argument
variable is undefined. If this variable is undefined, the argument variable will
be treated as if the BOOLEAN keyword had been set.
:Keywords:
boolean: in, optional, type=integer
If this keyword is set, the argument value will always be forced to return with a
value of 0 or 1.
:Examples:
Here is how to use this program::
FUNCTION Action, arg1, arg2, MULTIPLY=multiply
SetDefaultValue, arg1, 1
SetDefaultValue, arg2, 2
SetDefaultValue, multiply, 1, /BOOLEAN
IF multiply THEN RETURN, arg1 * arg2 ELSE RETURN, arg1 + arg2
END
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written by: David W. Fanning, November 26, 2008, from suggestion by Carsten Lechte on
IDL newsgroup on this date.
Made a change to the way the BOOLEAN keyword works. Now argument is set to BOOLEAN before
return, if required. 3 Dec 2008. DWF.
:Copyright:
Copyright (c) 2008-2014, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See setdefaultvalue.pro)</STRONG><P>
<HR>
<A NAME="SHARPEN">
<H2>SHARPEN</H2></A>
<A HREF="#SETDEFAULTVALUE">[Previous Routine]</A>
<A HREF="#SORT_ND">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
Sharpen
PURPOSE:
This function sharpens an image using a Laplacian kernel.
The final result is color adjusted to match the histogram
of the input image.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Image Processing
CALLING SEQUENCE:
sharp_image = Sharpen(image)
INPUTS:
image - The input image to be sharpened. Assumed to be a 2D byte array.
OUTPUTS:
sharp_image - The sharpened image.
INPUT KEYWORDS:
KERNEL -- By default the image is convolved with this 3-by-3 Laplacian kernel:
[ [-1, -1, -1], [-1, +8, -1], [-1, -1, -1] ]. You can pass in any kernel
of odd width. The filtered image is added back to the original image to provide
the sharpening effect.
DISPLAY -- If this keyword is set a window is opened and the details of the sharpening
process are displayed.
OUTPUT KEYWORDS:
None.
DEPENDENCIES:
None.
METHOD:
This function is based on the Laplacian kernel sharpening method on pages 128-131
of Digital Image Processing, 2nd Edition, Rafael C. Gonzalez and Richard E. Woods,
ISBN 0-20-118075-8.
EXAMPLE:
There is an example program at the end of this file.
MODIFICATION HISTORY:
Written by David W. Fanning, January 2003.
Updated slightly to use Coyote Library routines. 3 Dec. 2010. DWF.
Modified the example to work with cgImage. 29 March 2011. DWF.
</PRE><P>
<STRONG>(See sharpen.pro)</STRONG><P>
<HR>
<A NAME="SORT_ND">
<H2>SORT_ND</H2></A>
<A HREF="#SHARPEN">[Previous Routine]</A>
<A HREF="#STATIONPLOT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
SORT_ND
PURPOSE:
Efficiently perform an N-dimensional sort along any dimension
of an array.
CALLING SEQUENCE:
inds=sort_nd(array,dimension)
INPUTS:
array: An array of at least 2 dimensions to sort.
dimension: The dimension along which to sort, starting at 1
(1:rows, 2:columns, ...).
OUTPUTS:
inds: An index array with the same dimensions as the input
array, containing the (1D) sorted indices. Can be used
directly to index the arary (ala SORT).
EXAMPLE:
a=randomu(sd,5,4,3,2)
sorted=a[sort_nd(a,2)]
SEE ALSO:
HISTOGRAM
MODIFICATION HISTORY:
Tue Aug 22 15:51:12 2006, J.D. Smith <jdsmith@as.arizona.edu>
Written, based on discussion on c.l.i-p, 08/2006.
</PRE><P>
<STRONG>(See sort_nd.pro)</STRONG><P>
<HR>
<A NAME="STATIONPLOT">
<H2>STATIONPLOT</H2></A>
<A HREF="#SORT_ND">[Previous Routine]</A>
<A HREF="#STR_SIZE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
STATIONPLOT
PURPOSE:
This is routine for drawing station plots on a map or other display.
Normally, this routine is used in conjunction with WINDBARB.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics.
CALLING SEQUENCE:
StationPlot, x, y
REQUIRED INPUTS:
x: The X location of the center of the station plot, expressed in data coordinates.
y: The Y location of the center of the station plot, expressed in data coordinates.
KEYWORDS:
COLOR: The name of the color to draw the station plot in. May be a vector
the same length as X. Colors are those available in cgColor.
RADIUS: The radius of the station plot circle in normalized coordinates.
RESTRICTIONS:
Requires cgColor from the Coyote Library:
http://www.idlcoyote.com/programs/cgColor.pro
EXAMPLE:
seed = -3L
lon = Randomu(seed, 20) * 360 - 180
lat = Randomu(seed, 20) * 180 - 90
speed = Randomu(seed, 20) * 100
direction = Randomu(seed, 20) * 180 + 90
Erase, cgColor('Ivory', !P.Background)
Map_Set, /Cylindrical,Position=[0.1, 0.1, 0.9, 0.9], Color=cgColor('Steel Blue'), /NoErase
Map_Grid, Color=cgColor('Charcoal', !D.Table_Size-2)
Map_Continents, Color=cgColor('Sea Green', !D.Table_Size-3)
StationPlot, lon, lat, Color='Indian Red'
MODIFICATION HISTORY:
Written by: David W. Fanning, 20 May 2003, based on TVCircle from the
NASA Astonomy Library.
Added THICK keyword. 23 February 2005. DWF.
</PRE><P>
<STRONG>(See stationplot.pro)</STRONG><P>
<HR>
<A NAME="STR_SIZE">
<H2>STR_SIZE</H2></A>
<A HREF="#STATIONPLOT">[Previous Routine]</A>
<A HREF="#TEXTBOX">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
STR_SIZE
PURPOSE:
The purpose of this function is to return the proper
character size to make a specified string a specifed
width in a window. The width is specified in normalized
coordinates. The function is extremely useful for sizing
strings and labels in resizeable graphics windows.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
Graphics Programs, Widgets.
CALLING SEQUENCE:
thisCharSize = STR_SIZE(thisSting, targetWidth)
INPUTS:
thisString: This is the string that you want to make a specifed
target size or width.
OPTIONAL INPUTS:
targetWidth: This is the target width of the string in normalized
coordinates in the current graphics window. The character
size of the string (returned as thisCharSize) will be
calculated to get the string width as close as possible to
the target width. The default is 0.25.
KEYWORD PARAMETERS:
INITSIZE: This is the initial size of the string. Default is 1.0.
STEP: This is the amount the string size will change in each step
of the interative process of calculating the string size.
The default value is 0.05.
XPOS: X position of the output test string. This can be
used on the Postscript device, where no pixmap windows are
available and where therefore the test strings would appear on
the printable area. Default is 0.5 on most devices. If !D.NAME
is PS, the default is 2.0 to draw the test string out of the
drawable window area.
YPOS: Y position of the output test string. This can be
used on the Postscript device, where no pixmap windows are
available and where therefore the test strings would appear on
the printable area. Default is 0.5 on most devices. If !D.NAME
is PS, the default is 2.0 to draw the test string out of the
drawable window area.
OUTPUTS:
thisCharSize: This is the size the specified string should be set
to if you want to produce output of the specified target
width. The value is in standard character size units where
1.0 is the standard character size.
EXAMPLE:
To make the string "Happy Holidays" take up 30% of the width of
the current graphics window, type this:
XYOUTS, 0.5, 0.5, ALIGN=0.5, "Happy Holidays", $
CHARSIZE=STR_SIZE("Happy Holidays", 0.3)
MODIFICATION HISTORY:
Written by: David Fanning, 17 DEC 96.
Added a scaling factor to take into account the aspect ratio
of the window in determing the character size. 28 Oct 97. DWF
Added check to be sure hardware fonts are not selected. 29 April 2000. DWF.
Added a pixmap to get proper scaling in skinny windows. 16 May 2000. DWF.
Forgot I can't do pixmaps in all devices. :-( Fixed. 7 Aug 2000. DWF.
Added support of PostScript at behest of Benjamin Hornberger. 11 November 2004. DWF.
Cleaned up the code a bit. 28 Feb 2011. DWF.
Fixed non-square window algorithm to reflect my original intentions. 10 June 2011.
</PRE><P>
<STRONG>(See str_size.pro)</STRONG><P>
<HR>
<A NAME="TEXTBOX">
<H2>TEXTBOX</H2></A>
<A HREF="#STR_SIZE">[Previous Routine]</A>
<A HREF="#TEXTLINEFORMAT">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
TEXTBOX
PURPOSE:
This function allows the user to type some text in a
pop-up dialog widget and have it returned to the program.
This is an example of a Pop-Up Dialog Widget.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utility, Widgets
CALLING SEQUENCE:
thetext = TextBox()
INPUTS:
None.
KEYWORD PARAMETERS:
CANCEL: An output parameter. If the user kills the widget or clicks the Cancel
button this keyword is set to 1. It is set to 0 otherwise. It
allows you to determine if the user canceled the dialog without
having to check the validity of the answer.
theText = TextBox(Title='Provide Phone Number...', Label='Number:', Cancel=cancelled)
IF cancelled THEN Return
GROUP_LEADER: The widget ID of the group leader of this pop-up
dialog. This should be provided if you are calling
the program from within a widget program:
thetext = TextBox(Group_Leader=event.top)
If a group leader is not provided, an unmapped top-level base widget
will be created as a group leader.
LABEL: A string the appears to the left of the text box.
TITLE: The title of the top-level base. If not specified, the
string 'Provide Input:' is used by default.
VALUE: A string variable that is the intial value of the textbox. By default, a null string.
XSIZE: The size of the text widget in pixel units. By default, 200.
OUTPUTS:
theText: The string of characters the user typed in the
text widget. No error checking is done.
RESTRICTIONS:
The widget is destroyed if the user clicks on either button or
if they hit a carriage return (CR) in the text widget. The
text is recorded if the user hits the ACCEPT button or hits
a CR in the text widget.
MODIFICATION HISTORY:
Written by: David W. Fanning, December 20, 2001.
Added VALUE keyword to set the initial value of the text box. 4 Nov 2002. DWF.
</PRE><P>
<STRONG>(See textbox.pro)</STRONG><P>
<HR>
<A NAME="TEXTLINEFORMAT">
<H2>TEXTLINEFORMAT</H2></A>
<A HREF="#TEXTBOX">[Previous Routine]</A>
<A HREF="#TEXTURE_SURFACE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
TextLineFormat
PURPOSE:
This is a utility program for taking a line of text and shortening
it to a defined maximum length. The result of the function is a string
array in which no line of text in the string array is longer than the maximum
length. The text is broken into "words" by white space. The algorithm is
modified slightly if there are LF (line feeds) in the text, or if any single
word in the text is too large to fit on a line.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
formattedText = TextLineFormat(theText)
INPUTS:
theText: The line of text that is to be formatted.
KEYWORDS:
LENGTH: The maximum line length allowed in the resulting text array.
Set to 60 characters by default. Lines greater than length
can be permitted if Line Feeds (ASCII 10B) are found
in the text or single words are too large to fit on a line.
MODIFICATION HISTORY:
Written by David Fanning, June 2005.
Fixed a small problem with cumulative total not counting spaces between
words. Changed the default size to 60. DWF. 18 August 2005.
Added check for LF in text to accommodate reading netCDF file attributes.
If LF are present, I break on these, and return. 15 Feb 2008. DWF.
Better handling of lines with no white space in them for breaking. 23 March 2009. DWF.
</PRE><P>
<STRONG>(See textlineformat.pro)</STRONG><P>
<HR>
<A NAME="TEXTURE_SURFACE">
<H2>TEXTURE_SURFACE</H2></A>
<A HREF="#TEXTLINEFORMAT">[Previous Routine]</A>
<A HREF="#TRANSFORM_VOLUME">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
TEXTURE_SURFACE
PURPOSE:
The purpose of this program is to demonstrate how to
create a simple surface plot with an image applied as
a texture in object graphics.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Widgets, Object Graphics.
CALLING SEQUENCE:
TEXTURE_SURFACE, data, x, y, Image=image
REQUIRED INPUTS:
None. Fake data will be used if no data is supplied in call.
OPTIONAL INPUTS
data: A 2D array of surface data.
x: A vector of X data values.
y: A vector of Y data values.
OPTIONAL KEYWORD PARAMETERS:
BORDERCOLOR : A three element array [R, G, B] describing the color
used to draw the non-textured part of the surface if POSITION is
specified.
COLORTABLE: The number of an IDL color table to use for the image
texture. Used only if the supplied image is 2D. Ignored otherwise.
EXACT: Set this keyword to get exact axis scaling.
_EXTRA: This keyword collects otherwise undefined keywords that are
passed to the surface initialization routine.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
IMAGE: An 8-bit or 24-bit image you wish to use for the image texture.
LANDSCAPE: Set this keyword if you are printing in landscape mode. The
default is Portrait mode. The Landscape keyword on the PRINTER object
is set, but not all printers will honor this keyword setting. If yours
does not, set Landscape mode in the Printer Setup dialog.
POSITION: A four element array of the form [x1, y1, x2, y2] that will
position the image with its lower-left corner at (x1,y1) and its upper-
right corner at (x2,y2) in the device coordinate system of the surface.
In other words, if my surface is a 41 by 41 array, and I want the image
positioned with lower-left at (5,10) and upper-right at (25,18), then
I call the program like this: Texture_Surface, Position=[5, 10, 25, 18].
VECTOR: Set this keyword if you want vector printing (as opposed to
the default bitmap printing).
XTITLE: A string used as the X title of the plot.
YTITLE: A string used as the Y title of the plot.
ZSCALE: A number larger than or equal to 0.001 and less than or equal to 1.0 that affects Z scaling.
ZTITLE: A string used as the Z title of the plot.
COMMON BLOCKS:
None.
EXAMPLE:
To use this program with your surface data and 2D image, type:
IDL> data = cgDemoData(2)
IDL> image = cgDemoData(7)
IDL> Texture_Surface, data, Image=image, Colortable=33
RESTRICTIONS:
Requires the ASPECT program from the Coyote Library:
http://www.idlcoyote.com/programs/aspect.pro
MODIFICATION HISTORY
Written by David W. Fanning, 1 Nov 2001, from previous Simple_Surface code.
Modifications suggested by Karl Shultz added to allow surface color
specification and improved resolution about image edges when
positioning images. BORDERCOLOR keyword added. DWF. 4 Nov 2001.
The surface now maintains the same X/Y aspect ratio as the surface data. DWF. 8 April 2002.
Added ZSCALE keyword. DWF. 8 April 2002.
Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See texture_surface.pro)</STRONG><P>
<HR>
<A NAME="TRANSFORM_VOLUME">
<H2>TRANSFORM_VOLUME</H2></A>
<A HREF="#TEXTURE_SURFACE">[Previous Routine]</A>
<A HREF="#UNDEFINE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
TRANSFORM_VOLUME
PURPOSE:
The purpose of this program is to transform (e.g., rotate,
scale, and translate) a 3D array or volume.
AUTHOR:
Martin Downing,
Clinical Research Physicist,
Grampian Orthopaedic RSA Research Centre,
Woodend Hospital, Aberdeen, AB15 6LS.
Pnone: 01224 556055 / 07903901612
Fa: 01224 556662
E-mail: m.downing@abdn.ac.uk
CATEGORY:
Mathematics, graphics.
CALLING SEQUENCE:
result = TRANSFORM_VOLUME( volume )
INPUTS:
volume: The 3D array or volume to be transformed.
OPTIONAL KEYWORDS:
BUFFER_SIZE: To reduce memory overhead the routine processes the job in chunks, the number
of elements of which can be set using the BUFFER_SIZE keyword, set this keyword to
0 to force the whole array to be processed at one time. The default value is 128.
MISSING: The value to return for transformed values outside the bounds of
the volume. (Passed to the INTERPOLATE function.) Default is 0.
T3DMAT: The homogeneous transforamtion matrix. If this keyword is not present,
the following keywords can be used to create a homogeneous transformation matrix:
ROTATION - The rotation vector [rx,ry,rz]. The order of rotation is ZYX.
TRANSLATE - The translation vector [tx,ty,tz].
SCALE - The scale vector [sx,sy,sz].
CENTRE_ROTATION - The centre of rotation [cx,cy,cz].
OUTPUTS:
result: The transformed array or volume.
COMMON BLOCKS:
None.
DEPENDENCIES:
The program uses the library INTERPLOLATE routine, which currently (IDL 5.4)
uses linear interpolation. Note that the operation is performed in chunks,
each of which is independant of the result of the others, so the operation
could easiliy be parallelised.
MODIFICATION HISTORY:
Written by: Martin Downing, 16 September 2001.
Added MISSING keyword. Removed INPLACE keyword. 25 Nov 2001. MD
</PRE><P>
<STRONG>(See transform_volume.pro)</STRONG><P>
<HR>
<A NAME="UNDEFINE">
<H2>UNDEFINE</H2></A>
<A HREF="#TRANSFORM_VOLUME">[Previous Routine]</A>
<A HREF="#VCOLORBAR">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
UNDEFINE
PURPOSE:
The purpose of this program is to delete or undefine
an IDL program variable from within an IDL program or
at the IDL command line. It is a more powerful DELVAR.
Pointer and structure variables are traversed recursively
to undefine any variables pointed to in the pointer or in
a structure dereference.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1642 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities.
CALLING SEQUENCE:
UNDEFINE, variable
REQUIRED INPUTS:
variable: The variable to be deleted. Up to 10 variables may be specified as arguments.
SIDE EFFECTS:
The variable no longer exists.
EXAMPLE:
To delete the variable "info", type:
IDL> Undefine, info
IDL> var = ptr_new({a:ptr_New(5), b:findgen(11), c: {d:ptr_New(10), f:findgen(11)}})
IDL> Help, /Heap
Heap Variables:
# Pointer: 3
# Object : 0
<PtrHeapVar3> LONG = 5
<PtrHeapVar4> LONG = 10
<PtrHeapVar5> STRUCT = -> <Anonymous> Array[1]
IDL> Undefine, var
IDL> Help, /Heap
Heap Variables:
# Pointer: 0
# Object : 0
IDL> Help, var
VAR UNDEFINED = <Undefined>
MODIFICATION HISTORY:
Written by David W. Fanning, 8 June 97, from an original program
given to me by Andrew Cool, DSTO, Adelaide, Australia.
Simplified program so you can pass it an undefined variable. :-) 17 May 2000. DWF
Simplified it even more by removing the unnecessary SIZE function. 28 June 2002. DWF.
Added capability to delete up to 10 variables at suggestion of Craig Markwardt. 10 Jan 2008. DWF.
If the variable is a pointer, object or structure reference the variable is recursively traversed
to free up all variables pointed to before the variable is itself destroyed. 10 June 2009. DWF.
Updated to allow undefining of pointer arrays. 8 October 2009. DWF.
Valid pointers that point to undefined variable can cause an infinite loop. Now using
Heap_Free, rather than recursion, with pointers. 30 May 2013. DWF.
</PRE><P>
<STRONG>(See undefine.pro)</STRONG><P>
<HR>
<A NAME="VCOLORBAR">
<H2>VCOLORBAR</H2></A>
<A HREF="#UNDEFINE">[Previous Routine]</A>
<A HREF="#WINDBARB">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
VCOLORBAR
FILENAME:
vcolorbar__define.pro
PURPOSE:
The purpose of this program is to create a vertical
colorbar object to be used in conjunction with other
IDL 5 graphics objects.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
CATEGORY:
IDL Object Graphics.
CALLING SEQUENCE:
thisColorBar = Obj_New('VColorBar')
REQUIRED INPUTS:
None.
INIT METHOD KEYWORD PARAMETERS:
COLOR: A three-element array representing the RGB values of a color
for the colorbar axes and annotation. The default value is
white: [255,255,255].
NAME: The name associated with this object.
NCOLORS: The number of colors associated with the colorbar. The
default is 256.
MAJOR: The number of major tick divisions on the colorbar axes.
The default is 5.
MINOR: The number of minor tick marks on the colorbar axes.
The default is 4.
PALETTE: A palette object for the colorbar. The default palette
is a gray-scale palette object.
POSITION: A four-element array specifying the position of the
colorbar in the arbitary coordinate system of the viewplane
rectangle. The default position is [0.90, 0.10, 0.95, 0.90].
RANGE: The range associated with the colorbar axis. The default
is [0, NCOLORS].
TITLE: A string containing a title for the colorbar axis
annotation. The default is a null string.
OTHER METHODS:
Clamp (Procedure): Given a two-element array in the data range of
the colorbar, the colorbar image is clamped to this range. In
other words, the range of colors is clamped to the specified
range. Values above or below the range in the colorbar are set to
the minimum and maximum range values, respectively.
GetProperty (Procedure): Returns colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
MAJOR
MINOR
NAME
PALETTE
POSITION
RANGE
TITLE
TRANSFORM
SetProperty (Procedure): Sets colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
NAME
MAJOR
MINOR
PALETTE
POSITION
RANGE
TITLE
TRANSFORM
SIDE EFFECTS:
A VCOLORBAR object is created. The colorbar INHERITS IDLgrMODEL.
Thus, all IDLgrMODEL methods and keywords can also be used. It is
the model that is selected in a selection event, since the SELECT_TARGET
keyword is set for the model.
EXAMPLE:
To create a colorbar object and add it to a plot view object, type:
thisColorBarObject = Obj_New('VColorBar')
plotView->Add, thisColorBarObject
plotWindow->Draw, plotView
MODIFICATION HISTORY:
Written by David W. Fanning, 19 June 97.
Changed the optional "colorbarmodel" parameter to an
optional GETMODEL parameter. 26 June 97. DWF.
Fixed bug in the way the color palette was assigned. 13 Aug 97. DWF.
Added missing container object to self structure. 13 Aug 97. DWF.
Removed image model, which was a workaround for
broken 5.0 objects. 5 Oct 97. DWF
Fixed cleanup procedure to clean up ALL objects. 12 Feb 98. DWF.
Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
Modified colorbar to INHERIT an IDLgrModel object. This allows me to
add the colorbar to other models directly. 20 Sept 98. DWF.
Added NAME keyword to give the colorbar a name. 20 Sept 98. DWF.
Changed a reference to _Ref_Extra to _Extra. 27 Sept 98. DWF.
Fixed bug when adding a text object via the TEXT keyword. 9 May 99. DWF.
Fixed a bug with getting the text object via the TEXT keyword. 16 Aug 2000. DWF.
Added the TRANSFORM keyword to GetProperty and SetProperty methods. 16 Aug 2000. DWF.
Added RECOMPUTE_DIMENSIONS=2 to text objects. 16 Aug 2000. DWF.
Added a polygon object around the image object. This allows rotation in 3D space. 16 Aug 2000. DWF.
Removed TEXT keyword (which was never used) and fixed TITLE keyword. 8 Dec 2000. DWF.
Added ENABLE_FORMATTING keyword to title objects. 22 October 2001. DWF.
Added a CLAMP method. 18 November 2001. DWF.
Forgot to pass extra keywords along to the text widget. As a result, you couldn't
format tick labels, etc. Fixed this. Any keywords appropriate for IDLgrTick objects
are now available. 26 June 2002. DWF.
Fixed a problem with POSITION keyword in SetProperty method. 23 May 2003. DWF.
Removed NORMALIZE from source code. 29 Nov 2005. DWF.
Font sizes have changed. Now using a 12 point font. 6 May 2011. DWF.
Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF.
</PRE><P>
<STRONG>(See vcolorbar__define.pro)</STRONG><P>
<HR>
<A NAME="WINDBARB">
<H2>WINDBARB</H2></A>
<A HREF="#VCOLORBAR">[Previous Routine]</A>
<A HREF="#WINDOWAVAILABLE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
WINDBARB
PURPOSE:
This is routine for drawing wind barbs on a map.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Graphics.
CALLING SEQUENCE:
Windbarb, x, y, speed, direction
REQUIRED INPUTS:
x: The X location of the wind barb, expressed in data coordinates.
Positive X is pointing in EAST direction.
y: The Y location of the wind barb, expressed in data coordinates.
Positive Y is pointing in NORTH direction.
speed: The wind speed, expressed in knots.
direction: The wind direction in degrees clockwise from north. Winds from
the NE come at 45 degrees, and the wind "arrow" points in the
direction from which the window is blowing. (The wind arrow
points in the direction of the station circle, with the "barbs"
of the arrow at the end of the arrow from which the wind is coming.)
KEYWORDS:
ASPECT: The aspect ratio of the map or plot in the display window.
CLIP: A four-element array in normalized coordinates [x0,y0,x1,y1] giving
the lower-left and upper-right corner of a cliping rectangle. This
is normally the extent of your plot. See the example below.
COLOR: The name of the color to draw the wind barbs in. May be a vector
the same length as X.
LENGTH: The approximate length of the wind barb in normalized coordinates.
Will be set to 0.066 of the plot distance in the X direction by default.
MAP_ROTATION: The clockwise rotation in degrees of the map North from the
top of the plot. Will be set to 0.0 by default.
SOUTHERN_HEMISPHERE: Windbarb "feathers" are traditionally drawn in the clockwise
direction in the northern hemispere and countercolockwise in the
southern hemisphere. Default is "northern" type feathers. Set this
keyword to select "southern" type feathers.
STATION: Set this keyword if you want to draw the wind barbs with station symbols.
(Requires STATIONPLOT from the Coyote Library.)
RESTRICTIONS:
Requires cgColor and STATIONPLOT from the Coyote Library:
http://www.idlcoyote.com/programs/cgColor.pro
http://www.idlcoyote.com/programs/stationplot.pro
EXAMPLE:
Window, Title='Wind Barbs', /Free
seed = -3L
lon = Randomu(seed, 9) * 360 - 180
lat = Randomu(seed, 9) * 180 - 90
speed = Randomu(seed, 9) * 100 + 5.0
direction = Indgen(9)*45
Erase, Color=cgColor('Ivory', !P.Background)
Polyfill,[0.1, 0.1, 0.9, 0.9, 0.1], [0.1, 0.9, 0.9, 0.1, 0.1], /Normal, Color=cgColor('light gray')
Map_Set, /Cylindrical, Position=[0.1, 0.1, 0.9, 0.9], Color=cgColor('Steel Blue'), /NoErase
Map_Grid, Color=cgColor('Charcoal', !D.Table_Size-2)
Map_Continents, Color=cgColor('Sea Green', !D.Table_Size-3)
Windbarb, lon, lat, speed, direction, /Station, Color='Indian Red', /Southern_Hemisphere
To clip the windbards that fall outside the plot, substitute these two lines
for the last line in the example above:
clip = [0.1, 0.1, 0.9, 0.9]
Windbarb, lon, lat, speed, direction, /Station, Color='Indian Red', Clip=clip
MODIFICATION HISTORY:
Written by: David W. Fanning, 20 May 2003.
It has been called to my attention that the wind barbs are pointing
in *exactly* the wrong direction. Sigh... Rotated by 180 degrees. DWF. 8 June 2004.
Now someone complains that the *corrected* version is off by 180 degrees! Sheesh!
Clearly, I'm no meteorologist. Both lines of code are in the file. Please use the one
you like the best. :-) (Line 177-178) 20 July 2004. DWF.
Added a CLIP keyword so you can clip the output to the extend of your graphics plot. 12 Nov 2004. DWF.
Added THICK keyword 23 February 2005. DWF.
After further research, I've reverted to the direction specified originally.
And I have changed the "feathers" to point clockwise normally, and counterdlockwise
if the SOUTHERN_HEMISPHERE keyword is set. Here are my sources (21 July 2005. DWF):
http://ww2010.atmos.uiuc.edu/(Gh)/guides/maps/sfcobs/wnd.rxml
http://www.al.noaa.gov/WWWHD/pubdocs/windbarb.html
Fixed a small CLIP problem. 21 July 2005. DWF.
</PRE><P>
<STRONG>(See windbarb.pro)</STRONG><P>
<HR>
<A NAME="WINDOWAVAILABLE">
<H2>WINDOWAVAILABLE</H2></A>
<A HREF="#WINDBARB">[Previous Routine]</A>
<A HREF="#WINDOWIMAGE">[Next Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
NAME:
WindowAvailable
PURPOSE:
This function returns a 1 if the specified window index number is
currently open or available. It returns a 0 if the window is currently
closed or unavailable.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY:
Utilities
CALLING SEQUENCE:
available = WindowAvaiable(windowIndexNumber)
INPUTS:
windowIndexNumber: The window index number of the window you wish to
know is available or not.
KEYWORDS:
None.
NOTES:
The window vector obtained from the DEVICE command is not always the same length. It
is normally (on my machine) 65 elements long, but can be much longer if you have lots
of IDL windows open (by calling cgPickColorName, for example). But if no windows with
index numbers greater than 65 are open, IDL shinks the larger vector to the smaller one
as part of its housekeeping operations, which means it happens on their timetable, not yours.
This can result in the user having "stale" index numbers greater than 65, but no larger vector
to check them against. I have modified the code to return a 0 in this case, assuming that
whatever window your index number points to is long gone. I have not experience any ill effects
by doing this, but I STRONGLY advice you to ALWAYS know what window you are drawing into
when you issue a graphics command.
MODIFICATION HISTORY:
Written by David W. Fanning, June 2005.
Modified to return 0 if the window index number is larger than the number of elements
in the WINDOW_STATE array. 25 June 2008. DWF.
</PRE><P>
<STRONG>(See windowavailable.pro)</STRONG><P>
<HR>
<A NAME="WINDOWIMAGE">
<H2>WINDOWIMAGE</H2></A>
<A HREF="#WINDOWAVAILABLE">[Previous Routine]</A>
<A HREF="#ROUTINELIST">[List of Routines]</A>
<PRE>
:Description:
Allows the user to interactively adjust image contrast by means of "windowing and
leveling" the image. Move the cursor vertically in the window to adjust the image
stretch "window". Move the cursor horizontally in the window to adjust the image
"level".
:Categories:
Graphics
:Params:
image: in, required, type=any
Any 2D array that you wish to adjust the contrast of.
:Keywords:
brewer: in, optional, type=boolean, default=0
Set this keyword to indicate a Brewer color table is desired.
colortable: in, optional, type=integer, default=0
The index number of a color table to load with cgLoadCT.
neutralcolor: in, optional, type=string
The name of the color to use for values outside the image "window" in
the color table. If a default grayscale color table is loaded, the default
color is "rose", otherwise the default is "black".
reverse: in, optional, type=boolean, default=0
Set this keyword if you wish to reverse the color table.
:Examples:
To see a demonstation::
IDL> WindowImage
:Author:
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
:History:
Change History::
Written, 29 November 2010. DWF.
Added color protection to the program. 30 Nov 2010. DWF.
Modification of cgImage command to prevent flashing. 27 Feb 2011. DWF.
:Copyright:
Copyright (c) 2010, Fanning Software Consulting, Inc.
</PRE><P>
<STRONG>(See windowimage.pro)</STRONG><P>
<HR>
</body>
</html>
|