<?xml version="1.0" encoding="gb2312"?>
<rss version="2.0">
<channel>
<title><![CDATA[HH&#39;s IDL Programming Blog]]></title>
        <image>
        <title>http://hi.baidu.com</title>
        <link>http://hi.baidu.com</link>
        <url>http://img.baidu.com/img/logo-hi.gif</url>
        </image>
<description><![CDATA[---在大同的世界里，创造大不同-------------------------------------------------------]]></description>
<link>http://hi.baidu.com/huxz</link>
<language>zh-cn</language>
<generator>www.baidu.com</generator>
<ttl>5</ttl>


<item>
        <title><![CDATA[[再再续Envi分块机制][转]What are the tile and cache size settings in the ENVI configuration file?]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/f8d9f6c465e58ea38326ac08.html]]></link>
        <description><![CDATA[
		
		<table class="FCK__ShowTableBorders" cellpadding="0" width="500" border="0">
    <tbody>
        <tr>
            <td>
            <p> </p>
            <p><em><strong><font color="#0000ff" size="2">好友DYQ最近琢磨Envi分块问题,研究的很深. 今天LuoLuo让找找ITT官方资料,以下是一点点收获. E文的,勉强看吧~~~</font></strong></em></p>
            <p><strong>Topic:</strong></p>
            </td>
        </tr>
        <tr>
            <td height="5"> </td>
        </tr>
        <tr>
            <td>
            <p>From the main ENVI menu, under File -&gt; Preferences -&gt; Miscellaneous, users are able to set Cache Size and Image Tile Size. This tip discusses what these settings mean.</p>
            </td>
        </tr>
        <tr>
            <td><br>
            <p><strong>Discussion:</strong></p>
            </td>
        </tr>
        <tr>
            <td>
            <p>In order for ENVI to process images that are much larger than the total amount of RAM available on the system, large images are broken into pieces that are small enough for the system to handle. Each piece is called a tile, and when the image is processed, only one tile is read into memory at a time. The Image Tile Size setting in the ENVI configuration file determines the size for the tile, and thus how much of an image is read into RAM and processed at a time. If the entire image is smaller than the Image Tile Size setting, then the entire image is processed in one tile. When processing on one tile is finished, ENVI releases that tile抯 memory, and then reads the next tile for processing. If ENVI tries to read in a tile that is larger than the amount of contiguous RAM available on your machine at the time you start a process, then you will get the error: &quot;unable to allocate memory to make array.&quot; Even if you have a very large amount of RAM, it is important to remember that each tile must fit into a contiguous section of memory. Because RAM quickly becomes fragmented, it is dangerous to have a large tile setting. So, for the tile size, smaller is better. Because the Image Tile Size setting has very little effect on performance, we recommend that it be kept at the default value of 1 MB, and suggest that it never exceed about 4 MB.<br>
            <br>
            There is one case in which ENVI will use a tile size that is different than the Image Tile Size setting in the configuration file. When spectral processing is being performed, the tile size will be equal to the number of samples times the number of bands, regardless of the tile size setting. So, for spectral processing it is possible for the tile to exceed the tile size setting, although this is rarely the case. In fact, spectral tiles are usually smaller than the configuration file抯 tile size setting. <br>
            <br>
            The Cache Size setting in the ENVI configuration file does not directly affect memory allocation, but it helps ENVI keep an eye on how much RAM is likely to be available. The cache size is specified because IDL does not have any way to know how much RAM is available on your machine. When you set the cache size it tells ENVI that when you have used up that much RAM, ENVI should start to remove unnecessary items from RAM to make more available (sometimes ENVI will keep certain kinds of data in RAM to speed performance, although these are not required for ENVI to run and can be released if memory is low). The cache setting is not a fixed upper limit on the amount of RAM that ENVI will use, it is just a benchmark that ENVI uses to gauge whether the amount of RAM you have used up is a little or a lot. It is configurable because of the wide variety of RAM on different machines.<br>
            <br>
            If your Cache Size setting is large, then ENVI will not start cleaning up RAM until that large amount of RAM has been used. This means that less RAM will be left available for further processing. To minimize your chances of starting a process and then running out of RAM in the middle of a process (when ENVI can't clear RAM), you want to have a reasonable amount of RAM available even after your cache is full. On single-user machines, we recommend that the cache be set to 50-75% of the available physical RAM on the system. For example, if you have 80 Mb of RAM, then a reasonable cache size might be 40-60 MB. For multi-user systems (such as UNIX workstations) the cache size should be reduced to reflect the amount of physical RAM that will typically be available. Generally, it is best to err on the side of a smaller cache size.</p>
            <p><strong><font color="#0000ff">看了DYQ回复，觉得有道理，还是总结一下吧：</font></strong></p>
            <p>上边大概就是说，TileSize是分块数据的存储量，要申请连续内存，不宜过大，1M足够，最好不要超过4M，这个参数对Envi执行效率的影响不大。</p>
            <p>Cache是告诉Envi有多少内存可用，一般设置物理内存总数的50%-70%。当Envi要使用的内存超过Cache时，会自动释放不必要的内存占用。如果Cache设置过高，这个机制很难被激活，可能会导致Envi占用内存过多。</p>
            </td>
        </tr>
    </tbody>
</table> <a href="http://hi.baidu.com/huxz/blog/item/f8d9f6c465e58ea38326ac08.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/f8d9f6c465e58ea38326ac08.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-25  18:05</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/f8d9f6c465e58ea38326ac08.html</guid>
</item>

<item>
        <title><![CDATA[System Variables，慎用]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/5218a13e19699bf0838b1343.html]]></link>
        <description><![CDATA[
		
		<p>讨论组大卫的问题：如何删除系统变量？</p>
<p>组里的答案是：除了重置进程，或者重启IDL，自定义的系统变量<font color="#ff0000"><strong>不可能删除</strong></font>。IDL帮助里讲了：IDL的系统变量在系统底层都有预定义的，无法修改的类型。</p>
<p>解决办法：如有必要，自定义指针类型的系统变量。</p>
<p>总结：<font color="#ff0000"><strong>系统变量慎用</strong></font>。最好不要放置大数据的东西。存个路径，参数啥的就够了。</p>
<p>转测试代码：</p>
<p>1：无法删除的系统变量</p>
<p>IDL&gt; DefSysV, '!TESTER', 5 <br>
IDL&gt; DelVar, !TESTER <br>
% DELVAR: Expression must be named variable in this context: &lt;INT <br>
( 5)&gt;.</p>
<p>IDL&gt; Undefine, !Tester <br>
IDL&gt; Help, !Tester <br>
&lt;Expression&gt; INT = 5</p>
<p>2：改指针类型</p>
<p>IDL&gt; defsysv, '!tester', Ptr_New(5) <br>
IDL&gt; help, !tester <br>
&lt;Expression&gt; POINTER = &lt;PtrHeapVar1&gt; <br>
IDL&gt; help, *!tester <br>
&lt;PtrHeapVar1&gt; LONG = 5 <br>
IDL&gt; Ptr_Free, !tester <br>
IDL&gt; !tester = Ptr_New(/Allocate_Heap) ; <strong>重新预分配内存<br>
</strong>IDL&gt; help, !tester <br>
&lt;Expression&gt; POINTER = &lt;PtrHeapVar2&gt; <br>
IDL&gt; help, *!tester <br>
&lt;PtrHeapVar2&gt; UNDEFINED = &lt;Undefined&gt; <br>
IDL&gt; help, /heap <br>
Heap Variables: <br>
# Pointer: 1 ; <strong>因为预分配内存了，所以还是显示有一个有效指针<br>
</strong>&nbsp;&nbsp;&nbsp;  # Object : 0 <br>
&lt;PtrHeapVar2&gt; UNDEFINED = &lt;Undefined&gt; <br>
IDL&gt; Ptr_Free, !tester ; <strong>释放了，就没有了。</strong><br>
IDL&gt; help, /heap <br>
Heap Variables: <br>
# Pointer: 0 <br>
# Object : 0</p> <a href="http://hi.baidu.com/huxz/blog/item/5218a13e19699bf0838b1343.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/5218a13e19699bf0838b1343.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-12  17:09</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/5218a13e19699bf0838b1343.html</guid>
</item>

<item>
        <title><![CDATA[接力：OR 和 ||]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/42e3c054c94c3452d10906a9.html]]></link>
        <description><![CDATA[
		
		<p><font size="3">-----------------------------------------------------------------------------------------------------------------------------------</font></p>
<p><font size="3">看到CG新写一篇 </font><a target="_blank" href="http://hi.baidu.com/danielc/blog/item/a45ff2f0e223f9a5a40f521c%2Ehtml"><font size="3">《OR 和 II》</font></a><font size="3"> ，CQ老大都跟帖了，我也来参合一把。以下是小小心得。仅供讨论~~</font></p>
<p><font size="3">-----------------------------------------------------------------------------------------------------------------------------------</font></p>
<p><font size="3">通常在做&ldquo;或&rdquo;逻辑判断时用到这两个运算符。</font></p>
<p><u><strong><font color="#0000ff" size="4">区别</font></strong>：</u></p>
<font size="3">
<p><strong><font color="#741b47" size="3">1：运算方式，接收参数和返回值。</font></strong></p>
<p><strong><em><font size="5">Or</font></em></strong>&nbsp;&nbsp;&nbsp;  <font color="#ff0000">按位求或</font>，可接收Scalar或者Array，返回值是位运算结果的Scalar或者Array</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  （注意：不一定是0和1）</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  举例：print, 3 or 5 ; = 7&nbsp;&nbsp;  [0011 OR 0101 = 0111 ]</p>
<p><strong><em><font size="5">||</font></em></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  按值求或，可接收Scalar或者单变量的Array，返回值只有真假（1，0）&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  举例：print, 3 || 5 ; 1 [3 和 5 都为真]</p>
</font>
<p><strong><font color="#741b47" size="3">2：运算机制</font></strong></p>
<p><strong><em><font size="5">Or</font></em></strong>&nbsp;&nbsp;  <font size="3">对Or的两边参数，逐位比较。这就<strong><font color="#ff0000">要求两个参数都有效</font></strong>才行。这就是CG文章里下述问题的解释。</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IDL&gt; a=1</font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IDL&gt; print,a or b ; 错误！ B参数无效！<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Variable is undefined: B.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Execution halted at: $MAIN$ </font></p>
<p><strong><em><font size="5">||</font></em></strong>&nbsp;&nbsp;&nbsp;  <font size="3">采用Short-circuiting方式，逐个参数判断真假，只要出现真，就停止。这意味着：</font></p>
<p><font size="3"><strong><font color="#ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  除了第一个参数，其余参数不一定有效都行</font></strong>。这就是CG文章里，下述问题的解释。&nbsp;&nbsp;  </font></p>
<p><font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IDL&gt; a=1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IDL&gt; print,a || b<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ; <strong>正确</strong>！因为第一个参数a有效，而且a为真，本次逻辑判断有结果了！<br>
&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  IDL&gt; print,b || a ; <strong>错误</strong>！因为第一个参数b无效！<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Variable is undefined: B.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Execution halted at: $MAIN$</font></p>
<p><u><font size="4"><strong><font color="#0000ff">总结</font></strong>：</font></u></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong> <font color="#ff0000"><font size="3">Or 比 || 强大，比||较真(CG) ， 但是 || 判断效率更高（因为有<font color="#000000">Short-circuiting</font>）建议IF等逻辑判断时，用||。</font></font></strong></p> <a href="http://hi.baidu.com/huxz/blog/item/42e3c054c94c3452d10906a9.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/42e3c054c94c3452d10906a9.html#comment">查看评论</a>]]></description>
        <pubDate>2009-11-11  20:34</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/42e3c054c94c3452d10906a9.html</guid>
</item>

<item>
        <title><![CDATA[【原】Internet Explorer is currently running with add-ons disabled]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/151f90b103a5305e082302e5.html]]></link>
        <description><![CDATA[
		
		<p>升级到IE8后，发现AddOn用不了了？怎么办？</p>
<p>重装IE8也不管用，查了好多，都说修复吧，修复。难道只能修复？</p>
<p>又找了些老外的坛子，看来有门道：</p>
<p>问题一致：<span name="subject">Internet Explorer is currently running with add-ons disabled，大致描述了他是多么多么的无奈，多么多么的痛苦，就是解决不了，来坛子里讨教来了。</span></p>
<p><span name="subject">回答的有说关杀软，关防火墙，连重装系统也有人说。</span></p>
<p><span name="subject">最后，总算有明白人来了：其实是IE快捷方式的问题。</span></p>
<p><span name="subject"><strong><em><font size="3">解决办法：删除所有IE快捷方式，替换为c:\Program Files\Internet Explorer\iexplore.exe</font></em></strong> </span></p>
<p><span name="subject">以下节选部分重点楼层：</span></p>
<span name="subject">
<p align="left"><font face="Arial" color="#0000ff" size="2">1：ok to fix the problem click on <strong>start</strong> then <strong>IE icon</strong> to open <strong>properties</strong> then <strong>shortcut</strong> click on <strong>find target</strong> click on IE shortcut to open internet if there is not the yellow bar send that shortcut to desktop (the problem was the shortcut)</font></p>
<span name="subject">
<p><font color="#0000ff">2：Thanks! The add-ons were not the problem!!!!!!!!!!!!!!!!!!!!!!! It was a bad target! Thanks! You got it right. It worked immediately.Delete the icon in the start menu. When you start the application/explorer a new fresh icon will appear and it works! Wow!</font></p>
</span>
<p><font color="#0000ff">3：I experienced the same problem.<br>
It seems that IE is launched always from &quot;All Programs&quot;-&gt;&quot;Accessories&quot;-&gt;&quot;System Tools&quot;.<br>
Checking the properties of IE shortcut in this location shows that IE is launched with additional parameter &quot;-extoff&quot; (look at the &quot;Target&quot;). This may mean that switch off all &quot;Add-ons&quot; before start IE. Then even &quot;Manage Add-ons</font><font color="#0000ff"><span><span>&quot; under &quot;Tools&quot; is grayed.</span><br>
The IE shortcut which you used to launch IE must have same situation. Just deleting &quot;-extoff&quot; will give you a normal IE with enabled Add-ons.</span><br>
<br>
I did exactly this, and voila! done. Now I don't get the bar that says add-ons are disabled.</font></p>
<p><font color="#0000ff">【2009-11-30】更新一下：</font></p>
<p><font color="#0000ff">继续IE8问题，症状：IE8突然打不开网页了，一点就死。</font></p>
<p><font color="#0000ff">本次解决：有流氓软件。找到卸载咯。。。。。</font></p>
</span> <a href="http://hi.baidu.com/huxz/blog/item/151f90b103a5305e082302e5.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/%CB%E6%B1%CA">随笔</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/151f90b103a5305e082302e5.html#comment">查看评论</a>]]></description>
        <pubDate>2009-10-27  15:22</pubDate>
        <category><![CDATA[随笔]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/151f90b103a5305e082302e5.html</guid>
</item>

<item>
        <title><![CDATA[ESRI中国用户大会-2009]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/d3e26f0e78b7b9c07acbe16b.html]]></link>
        <description><![CDATA[
		
		<p>回北京晃了一圈。参加Esri的用户大会去了，因为这次有Envi/IDL。</p>
<p>ESRI就是ESRI，老大就是老大。号召力是很强的，很多讲座都人满为患，制图那场，去得有点晚，只能站着听了。。</p>
<p>我很少有兴趣和陌生人合影，但这次见到ITTVIS总裁Richard w.Cooke，这个管理着我年年月月，天天都在使用的Envi/IDL的人，还是有点小激动，和QQZ一起跑上去找人合影，哈哈。 同时还有亚洲区副总裁Sinn。</p>
<p>这次大会，Envi/IDL和Arcgis的互操作，一体化介绍还是比较出彩的。相信很多人都比较感兴趣。看看体验区来咨询的人就知道了。</p>
<p>回公司晃了一下，虽然离开几年了，但一切都很熟悉，一进大门，就把每个楼层逛在脑子里逛了一遍。到了CG的部门，一眼望见一排专业的IDL程序员，专心致志的写着代码，估计这场面，整个中国，不超过两三家公司能有。大部分写IDL的，都是散兵游勇。看着正在辛勤工作的IDLer们，不由得想起了当初在这奋战的日子。。。虽然多是辛苦的记忆，但仍然很怀念。</p>
<p>又和大家(QQZ,CG,DYQ,Baozi,WZC, LL...)聚到一起，详谈甚欢。交流很多东西，收获颇丰。CG，QQZ，DYQ展示了不少好东西，香蕉的Demo不错，可惜有点抠门，拿不到。我给他看了几个Envi的外挂，也没给他。哈哈～～</p>
<p>总结，明确了自己的一些思路。以后要向行业主流方向，主流技术靠拢。</p>
<p>特别鸣谢QQZ，免了我落单之苦。<img src="http://img.baidu.com/hi/jx/j_0018.gif"></p>
<p>照片1：左起，QQZ, HH, Richard, Shin</p>
<p><span><img class="blogimg" border="0" small="0" src="http://hiphotos.baidu.com/huxz/pic/item/9cea7d590d8d1f072934f0ea.jpg"><br>
</span></p>
<p><span>照片2：左起，HH, Richard, Shin</span></p>
<p><span><span><img class="blogimg" border="0" small="0" src="http://hiphotos.baidu.com/huxz/pic/item/e4036431dbf37834eac4aff1.jpg"><br>
</span></span></p> <a href="http://hi.baidu.com/huxz/blog/item/d3e26f0e78b7b9c07acbe16b.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/%CB%E6%B1%CA">随笔</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/d3e26f0e78b7b9c07acbe16b.html#comment">查看评论</a>]]></description>
        <pubDate>2009-10-23  12:53</pubDate>
        <category><![CDATA[随笔]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/d3e26f0e78b7b9c07acbe16b.html</guid>
</item>

<item>
        <title><![CDATA[IDL跳跃读取文本]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/7f5b1e3bc5ce93e014cecb22.html]]></link>
        <description><![CDATA[
		
		<p>今天群里（IDLWay-I: 31907930）问道一个<strong>问题</strong>：</p>
<p><u>文本里有记录以下下一行字符：</u></p>
<p><u><font size="3">1000(H) 272 1567 3120 4333 5725 7348 9327 10539 12012 13866 16378 <br>
</font></u></p>
<p><u>如何分开读取前7个字符和后面所有数字？</u></p>
<p>：：：：：我是分割线：：：：：</p>
<p>IDL读取二进制文件，可以用Point_Lun进行定点读取，但是文本文件就不行了。</p>
<p>上面这个问题，可以先整行读取，然后用字符串操作进行分解。</p>
<p> </p>
<p>但我想试试读取时，就分解了。用<strong>格式化读入</strong>的办法可行。</p>
<p>测试代码：（文件里存的就是上述问题提到的那行字符串）</p>
<p>pro JumpReadTxt<br>
file ='c:\Huxz\Temp\Test.txt' <br>
;open file<br>
openr, lun, file, /get_lun<br>
&nbsp;&nbsp;  fmt = '(a7, 1x, a)' ; <strong>先读7个字符，跳一个字符位，连续读入本行剩下的所有字符<br>
</strong>&nbsp;&nbsp;  record = {head:'', dataS:''}<br>
readf, lun, record, format=fmt<br>
help, record, /stru<br>
dataL = Long(Strsplit(record.dataS, ' ', /extract))<br>
help, dataL<br>
print, dataL<br>
;close input file<br>
free_lun,lun<br>
end</p> <a href="http://hi.baidu.com/huxz/blog/item/7f5b1e3bc5ce93e014cecb22.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/7f5b1e3bc5ce93e014cecb22.html#comment">查看评论</a>]]></description>
        <pubDate>2009-10-16  11:17</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/7f5b1e3bc5ce93e014cecb22.html</guid>
</item>

<item>
        <title><![CDATA[IDL解趣味数学题一道]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/7007823de6f9970abaa1678b.html]]></link>
        <description><![CDATA[
		
		<p>昨日偶然发现一个有趣的数学题。</p>
<p><strong>题目</strong>：1到9，9个数，组成任意4位数，乘于一个一位数，得到的结果，正好是剩下的4个数，条件：9个数必须都用到，但不能重复。</p>
<p>网上有些代码，但据DYQ的调查，有的要10秒左右才能算出来。用了8重循环。但人家肯定也有些更妙的方法，比如用C写，可能要快很多。</p>
<p>我用IDL搞了一个方法，用了5重循环，充分利用了IDL的数组操作优势。最后速度还是可以的。我的破机器上，也就0.5秒左右。套用QQZ的一句：&ldquo;VC想要和IDL比速度，都要掂量掂量自己的水平&rdquo;不过，IDL也不是随便乱写就出效率的。总之所有语言都不错。存在即有理。看怎么用了。</p>
<p>下边是源代码，大家看看能不能把5重循环再减少几个。。。。。</p>
<p><strong>源码：</strong></p>
<p>Function SetDifference, a, b<br>
mina = Min(a, Max=maxa)<br>
minb = Min(b, Max=maxb)<br>
if (minb gt maxa) or (maxb lt mina) then Return, a ;No intersection...<br>
r = Where((Histogram(a, Min=mina, Max=maxa) ne 0) and $<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  (Histogram(b, Min=mina, Max=maxa) eq 0), count)<br>
if count eq 0 Then RETURN, -1 else Return, r + mina<br>
End<br>
;+-------------------------------------------------------------------------------------------------<br>
Pro test<br>
arr = Lindgen(9) + 1<br>
timelabel = Systime(/sec)<br>
for i=0, 8 do begin<br>
&nbsp;&nbsp;  a = arr[i]<br>
&nbsp;&nbsp;  for j=0, 8 do begin<br>
&nbsp;&nbsp;&nbsp;  aa = arr[j]<br>
&nbsp;&nbsp;&nbsp;  if a eq aa then Continue<br>
&nbsp;&nbsp;&nbsp;  for k=0, 8 do begin<br>
&nbsp;&nbsp;&nbsp;&nbsp;  aaa = arr[k]<br>
&nbsp;&nbsp;&nbsp;&nbsp;  if aaa eq a or aaa eq aa then Continue<br>
&nbsp;&nbsp;&nbsp;&nbsp;  for m=0, 8 do begin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  aaaa = arr[m]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  if aaaa eq a or aaaa eq aa or aaaa eq aaa then Continue<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  na = a * 1000 + aa * 100 + aaa * 10 + aaaa<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  for n=0, 8 do begin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  nb = arr[n]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  if nb eq a or nb eq aa or nb eq aaa or nb eq aaaa then Continue<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  used = [a, aa, aaa, aaaa, nb]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  cs = SetDifference(arr, used)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  pu = na * nb<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  parr = [pu/1000, (pu mod 1000) / 100, (pu mod 100) / 10, pu mod 10]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  if ARRAY_EQUAL(parr[sort(parr)], cs[sort(cs)]) then $<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  print, Strtrim(na, 2) + ' * ' + Strtrim(nb, 2) + ' = ', Strtrim(pu, 2)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  endfor<br>
&nbsp;&nbsp;&nbsp;&nbsp;  endfor<br>
&nbsp;&nbsp;&nbsp;  endfor<br>
&nbsp;&nbsp;  endfor<br>
endfor<br>
print, '遍历时间： ', Systime(/sec) - timelabel<br>
End</p> <a href="http://hi.baidu.com/huxz/blog/item/7007823de6f9970abaa1678b.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/7007823de6f9970abaa1678b.html#comment">查看评论</a>]]></description>
        <pubDate>2009-10-08  13:02</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/7007823de6f9970abaa1678b.html</guid>
</item>

<item>
        <title><![CDATA[##]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/917457ed8d5c84deb31cb19e.html]]></link>
        <description><![CDATA[
		
		<p>下午和包子聊：</p>
<p>&ldquo;如何创建一个数组：大小是127×127，每行都由1至127的数字组成？不能用循环。&rdquo;</p>
<p>刚想折腾一下，包子就说到了&ldquo;##&rdquo;操作符.</p>
<p>马上测试，答案如下：</p>
<p>arr = (Intarr(1, 127)+1) ## (Indgen(127)+1)</p>
<p>后来发现，包子对这个早有研究：<img src="http://img.baidu.com/hi/jx/j_0055.gif"></p>
<p><a href="http://hi.baidu.com/bobby730/blog/item/24fa61d8f8bbe63632fa1c1d.html">http://hi.baidu.com/bobby730/blog/item/24fa61d8f8bbe63632fa1c1d.html</a></p>
<p>注：</p>
<p>## 操作符的描述参看帮助。我就秉承懒人作风。不写了。</p> <a href="http://hi.baidu.com/huxz/blog/item/917457ed8d5c84deb31cb19e.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/917457ed8d5c84deb31cb19e.html#comment">查看评论</a>]]></description>
        <pubDate>2009-09-16  17:45</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/917457ed8d5c84deb31cb19e.html</guid>
</item>

<item>
        <title><![CDATA[ENVI_STATS_DOIT和直方图]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/4cc83538a1fd172db9998ffc.html]]></link>
        <description><![CDATA[
		
		<p>问题（来自Esri社区，<a target="_blank" href="http://bbs.esrichina-bj.cn/ESRI/forumdisplay.php?fid=28&amp;pageD1">Envi/IDL版</a>--顺便推荐此版，活跃度极高，高手如云）：</p>
<p>&ldquo;想获取NDVI图像达到某一个百分率的DN值，但是ENVI_STATS_DOIT只能提供hist，是个一维数组，只存了所有DN对应的象元数目。<br>
比如某一个DN值对应的象元数有1000个，我怎么得到这个DN值是多少？&rdquo;</p>
<p>我的回答：</p>
<p>由于直方图是按照DN值从小到大，按组距递增排列的。所以，知道像元个数后，先找到这个个数，是直方图数组的第几个元素，然后通过 (DMin + N * BinSize) 得到DN值。其中，N代表该像元个数在直方图数组的第N个。<br>
<br>
问题来了，<br>
Envi的统计函数：ENVI_STATS_DOIT，可以直接得到DMin，N也可以用Where函数去Hist数组里找。<br>
但是BinSize怎么办？ 这个统计函数，有个隐藏参数：BinSize，专门输出这个值。<br>
例子：<br>
envi_doit, 'envi_stats_doit', fid=fid, pos=pos, $&nbsp;&nbsp;<br>
dims=dims, comp_flag=3, dmin=dmin, hist=hist, BINSIZE=BINSIZE<br>
<br>
留意上述语句的最后一个关键字参数：输出BinSize</p>
<p>；----------------------------------------------------------------------------------------</p>
<p>关于直方图，其实还有一个隐藏参数NBins，指直方图统计时的分组个数。</p>
<p>另外，Envi的隐藏函数，隐藏参数简直数不胜数。绝对一个大宝库。<img src="http://img.baidu.com/hi/jx/j_0047.gif"></p>
<p> </p> <a href="http://hi.baidu.com/huxz/blog/item/4cc83538a1fd172db9998ffc.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/4cc83538a1fd172db9998ffc.html#comment">查看评论</a>]]></description>
        <pubDate>2009-09-10  12:04</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/4cc83538a1fd172db9998ffc.html</guid>
</item>

<item>
        <title><![CDATA[【转】用数字作为线画图的标记]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/72c13c3ffc9da7e555e72339.html]]></link>
        <description><![CDATA[
		
		<center>
<h1 align="left"><font size="2">大卫的网站被和谐后，给很多IDLer带来了不便。不能及时访问到大卫老兄的最新发布。这里转来一些大卫老兄的好东西，分享给大家。不翻译了，懒。。。</font></h1>
<h1>Using Numbers as Symbols</h1>
</center>
<p><strong>QUESTION:</strong> I would like to display a normal IDL line plot, but instead of using a symbol to represent each point, I would like to use a number. Is this possible in IDL? </p>
<p><img height="3" src="http://www.dfanning.com/images/hruler.gif" width="100%" zmxid="zoomXimageId1"></p>
<p><strong>ANSWER:</strong> Yes, it is possible to do this. Here is an example of the kind of code you might have to write. First, let's create some data to plot.</p>
<pre>x = Indgen(50)
   y = RandomU(-3L, 50) * 100</pre>
<p>And now we plot the data. Notice that we are going to create a space for the numbers by first overplotting a blank space where we can write the numbers.</p>
<pre>Plot, x, y, BACKGROUND=FSC_Color('ivory'), COLOR=FSC_Color('navy')
   OPlot, x, y, COLOR=FSC_Color('ivory'), PSYM=SymCat(15), SYMSIZE=2.0
   XYouts, x, y, StrTrim(Sindgen(50)+1, 2), COLOR=FSC_Color('red'), $
        ALIGN=0.5, CHARSIZE=0.75</pre>
<p>You can see the result of the code above in the figure below.</p>
<p><img class="blogimg" border="0" small="0" src="http://hiphotos.baidu.com/huxz/pic/item/4195ae195e5a5e6f42a9adee.jpg"></p>
<p>An IDL plot with numbers used in place of symbols.</p> <a href="http://hi.baidu.com/huxz/blog/item/72c13c3ffc9da7e555e72339.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/72c13c3ffc9da7e555e72339.html#comment">查看评论</a>]]></description>
        <pubDate>2009-08-28  12:18</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/72c13c3ffc9da7e555e72339.html</guid>
</item>

<item>
        <title><![CDATA[Envi外挂写法]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/c6d01ce99b475d36b90e2d74.html]]></link>
        <description><![CDATA[
		
		<p>今天和QQZ讨论Envi外挂的东西，小有收获。</p>
<p>细说：给Envi写外挂是最简单的Envi二次开发方式，怎么操作？</p>
<p>背景知识：<a href="http://hi.baidu.com/dyqwrp/blog/item/5b6c6ac45edbf6a18326ac7a.html">http://hi.baidu.com/dyqwrp/blog/item/5b6c6ac45edbf6a18326ac7a.html</a></p>
<p>Envi&nbsp;&nbsp; 帮助：ENVI_DEFINE_MENU_BUTTON， 看Example</p>
<p><strong><font color="#ff0000" size="3">如何运行Example？</font></strong></p>
<p>直接把Example拷贝到IDLE，保存编译后Save，放到Save_Add，那是啥效果也没有的<img src="http://img.baidu.com/hi/jx/j_0049.gif"></p>
<p>怎么回事？？Envi的帮助里，关于这个ENVI_DEFINE_MENU_BUTTON，在最前面有这么几句：</p>
<p>Use this procedure to add menu items (buttons) to the ENVI menu system from a user-defined procedure in a .pro or .sav file within the save_add directory. The .pro or .sav file must contain a procedure named filename_define_buttons, where filename is the name of that file. For instance, if the file in the save_add directory is named my_process.pro, a procedure named my_process_define_buttons.pro should be in that file to allow you to add buttons to the ENVI menu system. The filename_define_buttons procedure has only one argument and no keywords, as shown in the following example code: <br>
PRO my_process_define_buttons, buttonInfo  <br>
;  <br>
; Define Buttons with ENVI_DEFINE_MENU_BUTTON  <br>
;  <br>
END </p>
<p>这几句详细讲了使用ENVI_DEFINE_MENU_BUTTON的规则。</p>
<p>总结：按钮定义Pro的命名最为关键：为，主程序名 + _define_buttons, buttonInfo</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  解释：主程序：程序的入口，与Pro文件名同名的程序。</p> <a href="http://hi.baidu.com/huxz/blog/item/c6d01ce99b475d36b90e2d74.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/c6d01ce99b475d36b90e2d74.html#comment">查看评论</a>]]></description>
        <pubDate>2009-07-27  15:44</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/c6d01ce99b475d36b90e2d74.html</guid>
</item>

<item>
        <title><![CDATA[【转】土地利用类型转换混淆矩阵]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/7147f450c740c9551138c250.html]]></link>
        <description><![CDATA[
		
		<p>好文转载收藏，原文来自：<a href="http://hi.baidu.com/dengshubin/blog/item/d4e04e4ce8e5d2f0d62afc68.html">http://hi.baidu.com/dengshubin/blog/item/d4e04e4ce8e5d2f0d62afc68.html</a></p>
<p align="center"><font size="6">土地利用类型转换（变化）混淆矩阵</font></p>
<p align="left"><br>
查阅相关的资料，也没有得到土地利用类型转换矩阵确切的定义，我理解为不同时间段内同一区域内土地利用类型的相互转换关系，一般用二维表来表达，从二维表中可以快速查看各个地类间相互转化的具体情况。 比如某一类别的土地有百分之多少（或者面积）分别转化成了其他的土地类型，现在某类型的土地分别是由过去的哪些类别转化而来的等等。还可以生成变化统计栅格图（掩膜图像），它描述了前后两幅土地分类图之间的地类发生转变的位置和类别。<br>
土地利用类型转换矩阵可以从两幅栅格图中计算得到，也可以从两个矢量文件中计算获得。下面介绍在ENVI下从两幅分类结果的栅格图中计算土地利用类型转换矩阵。<br>
1、准备数据<br>
两个时相的土地利用分类结果，它是单波段、专题类型的伪彩色图像（ENVI Classification）。<br>
2、计算转换矩阵<br>
打开两个土地利用分类结果。<br>
（1） 在主菜单中，选择Basic Tools → Change Detection → Change Detection Statistics。<br>
（2）分别在Initial State对话框和final state对话框中选择前一时相和后一时相的土地利用结果。<br>
（3） 在Define Equivalent Classes对话框中（图1），如果两个土地利用分类名称一致，系统自动将Initial State Class和Final State Class对应，否则手动选择，单击Add Pair按钮选择。<br>
（4） 选择对应的地物类型之后，单击OK按钮，出现图2对话框。选择生成图表表示单位（Report Type）：像素（Pixels）、百分比（Percent）和面积（Area）。选择Output Classification Mask Images?为YES，输出掩膜图像，选择输入路径及文件名。<br>
（5） 单击OK，执行土地利用类型转换矩阵计算过程。</p>
<p align="center"><br>
&nbsp;&nbsp;  &nbsp;&nbsp;  <span style="display: none; position: absolute"><img src="http://bbs.esrichina-bj.cn/ESRI/images/default/attachimg.gif" border="0"></span> <img alt="1.JPG" src="http://bbs.esrichina-bj.cn/ESRI/attachments/forumid_28/0906171434ccceed5c99c8cc2b.jpg" width="367" status="2" file="attachments/forumid_28/0906171434ccceed5c99c8cc2b.jpg"></p>
<div class="t_attach" style="display: none; position: absolute"><a title="1.JPG" href="http://bbs.esrichina-bj.cn/ESRI/attachment.php?aid=83139&amp;k=ae3c28c546261785a8b45a065c576cc7&amp;t=1245221345&amp;nothumb=yes&amp;sid=413frHMjAEjFTbCNM%2BYtlB9sDm5pYTe6yHkFmjnGw%2FR3FtM" target="_blank"><strong>下载</strong></a> (31.07 KB)<br>
<div class="t_smallfont"><span title="2009-6-17 14:34">14 分钟前</span></div>
</div>
<p><br>
图1 Define Equivalent Classes对话框<br>
&nbsp;&nbsp;  &nbsp;&nbsp;  <span style="display: none; position: absolute"><img src="http://bbs.esrichina-bj.cn/ESRI/images/default/attachimg.gif" border="0"></span> <img alt="2.JPG" src="http://bbs.esrichina-bj.cn/ESRI/attachments/forumid_28/09061714347187e411aacfda8e.jpg" width="340" unselectable="true" status="2" file="attachments/forumid_28/09061714347187e411aacfda8e.jpg" h="284" w="340" y="1368" x="585" outfunc="null" initialized="true"></p>
<div class="t_attach" style="display: none; z-index: 999; left: 585px; clip: rect(auto auto auto auto); position: absolute; top: 1324px" h="44" w="142" initialized="true" ctrlkey="aimg_83140"><a title="2.JPG" href="http://bbs.esrichina-bj.cn/ESRI/attachment.php?aid=83140&amp;k=d99967365d3c56ba3ba829a71c215e72&amp;t=1245221345&amp;nothumb=yes&amp;sid=413frHMjAEjFTbCNM%2BYtlB9sDm5pYTe6yHkFmjnGw%2FR3FtM" target="_blank"><strong>下载</strong></a> (17.63 KB)<br>
<div class="t_smallfont"><span title="2009-6-17 14:34">14 分钟前</span></div>
</div>
<p><br>
&nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  图2 选择数据参数</p>
<p> </p>
<p align="left"><br>
3、查看结果<br>
&nbsp;&nbsp;&nbsp;  （1）如图3为得到的土地利用类型转换矩阵结果。横字段表示前一时间段（Initial State）的土地利用类别，纵字段为后一时间段（Final State）的土地利用类别。横字段和纵字段交叉处表示变化值，如有2520900平方米林地用地变化为草地。</p>
<p align="center"><br>
&nbsp;&nbsp;  <span style="display: none; position: absolute"><img src="http://bbs.esrichina-bj.cn/ESRI/images/default/attachimg.gif" border="0"></span> <img alt="3.JPG" src="http://bbs.esrichina-bj.cn/ESRI/attachments/forumid_28/09061714343d074747fbbce794.jpg" width="600" status="2" file="attachments/forumid_28/09061714343d074747fbbce794.jpg"></p>
<div class="t_attach" style="display: none; position: absolute"><a title="3.JPG" href="http://bbs.esrichina-bj.cn/ESRI/attachment.php?aid=83141&amp;k=e1dd10f2eb83cd559df19af26a5a6e26&amp;t=1245221345&amp;nothumb=yes&amp;sid=413frHMjAEjFTbCNM%2BYtlB9sDm5pYTe6yHkFmjnGw%2FR3FtM" target="_blank"><strong>下载</strong></a> (40.53 KB)<br>
<div class="t_smallfont"><span title="2009-6-17 14:34">14 分钟前</span></div>
</div>
<p><br>
图3 土地利用类型转换矩阵</p>
<p> </p>
<p align="left"><br>
&nbsp;&nbsp;&nbsp;  （2） 还可以为每一个地类生成一个变换掩膜图像，图4所示为其中一个地类的掩膜图像。掩膜图像的灰度值表示变化类型，如这里的2{草地}表示林地变化为草地的像元。</p>
<p align="center"><br>
<span style="display: none; position: absolute"><img src="http://bbs.esrichina-bj.cn/ESRI/images/default/attachimg.gif" border="0"></span> <img alt="4.JPG" src="http://bbs.esrichina-bj.cn/ESRI/attachments/forumid_28/0906171434cbbcd0049401d945.jpg" width="600" unselectable="true" status="2" file="attachments/forumid_28/0906171434cbbcd0049401d945.jpg" h="416" w="600" y="2152" x="535" outfunc="null" initialized="true"></p>
<div class="t_attach" style="display: none; z-index: 999; left: 535px; clip: rect(auto auto auto auto); position: absolute; top: 2108px" h="44" w="142" initialized="true" ctrlkey="aimg_83142"><a title="4.JPG" href="http://bbs.esrichina-bj.cn/ESRI/attachment.php?aid=83142&amp;k=411bb41441d060f9c3164dd379e4466c&amp;t=1245221345&amp;nothumb=yes&amp;sid=413frHMjAEjFTbCNM%2BYtlB9sDm5pYTe6yHkFmjnGw%2FR3FtM" target="_blank"><strong>下载</strong></a> (78.51 KB)<br>
<div class="t_smallfont"><span title="2009-6-17 14:34">14 分钟前</span></div>
</div>
<p><br>
&nbsp;&nbsp;  图4 变化掩膜图像</p> <a href="http://hi.baidu.com/huxz/blog/item/7147f450c740c9551138c250.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/7147f450c740c9551138c250.html#comment">查看评论</a>]]></description>
        <pubDate>2009-06-18  20:30</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/7147f450c740c9551138c250.html</guid>
</item>

<item>
        <title><![CDATA[【HH】IDL命名结构体和匿名结构体]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/8355cc433b72291b72f05d66.html]]></link>
        <description><![CDATA[
		
		<p>今天和DYQ讨论命名结构体和匿名结构体的区别。以下代码是讨论结果。请愿意往下看的同学留意注释<img src="http://img.baidu.com/hi/jx/j_0052.gif"></p>
<p>大家直接拷贝到IDL编译器看吧。</p>
<p>Pro testStructure<br>
; By Huxz, CUHK, 2009-6<br>
;------------命名结构体--------------------------------------------------------------------------<br>
; 定义结构体,相当于定义一个类。这也是为什么类的__Define过程也必须是一个命名结构体<br>
a = {name1, a:1, b:'a'} ; 其实这些值对之后的实例化，是没有任何用处的。。。<br>
; 将上面定义的类，实例化一个对象：B<br>
b = {name1}<br>
; 查看 B的内容<br>
print, '回到纯真。。。'<br>
help, b, /stru<br>
; 什么？为啥结构体被初始化了？数值变成0，字符串变成'' 了？那是因为没有初始化：<br>
; 再来一例，并给定初始值：2, 3<br>
print, '初始化的效果。。。'<br>
bb = {name1, 3, 'b'}<br>
help, bb<br>
; 总结：定义命名结构体其实和定义一个类是同一原理。<br>
; 一个命名结构体，就是一个只有定义，只有初始化，而没有方法的类<br>
;--------------------------------------------------------------------------------------------------</p>
<p>;------------匿名结构体--------------------------------------------------------------------------<br>
print, '没有名字，无法实例化的匿名结构体。。。'<br>
c = {a: 1, b: 'test'}<br>
help, c, /stru<br>
; 想实例化？没门。匿名结构体只能每次定义，不能一次定义，到处实例化。</p>
<p>; 最后，为什么说一个命名结构体就是一个类的原型？看看下一行代码的报错信息吧！<br>
; 我们用实例化命名结构体的方法来实例化一个根本不存在的命名结构体，看会怎么样？<br>
; 看到Attempt to call undefined procedure/function: 'FBC288__DEFINE'.没？<br>
; 是不是很眼熟？？？ ^_^<br>
print, '看看这个错误信息，是不是证明 初始化一个命名结构体，和初始化一个类是一个原理？'<br>
d = {fbc288}<br>
End</p> <a href="http://hi.baidu.com/huxz/blog/item/8355cc433b72291b72f05d66.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/8355cc433b72291b72f05d66.html#comment">查看评论</a>]]></description>
        <pubDate>2009-06-09  22:42</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/8355cc433b72291b72f05d66.html</guid>
</item>

<item>
        <title><![CDATA[IDL7.1共享下载地址]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/e491eedef83c645c95ee3718.html]]></link>
        <description><![CDATA[
		
		<p>ITT的网站匿名下载出问题了。以下是IDL7.1共享下载地址：</p>
<p><a href="http://www.rayfile.com/files/02970fa8-50b0-11de-92a8-0014221b798a/">http://www.rayfile.com/files/02970fa8-50b0-11de-92a8-0014221b798a/</a></p> 
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%C2%FE%CC%B8">idl漫谈</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/e491eedef83c645c95ee3718.html#comment">查看评论</a>]]></description>
        <pubDate>2009-06-04  10:38</pubDate>
        <category><![CDATA[idl漫谈]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/e491eedef83c645c95ee3718.html</guid>
</item>

<item>
        <title><![CDATA[直接图形法下修改背景色]]></title>
        <link><![CDATA[http://hi.baidu.com/huxz/blog/item/42e3c054090b7450d009066a.html]]></link>
        <description><![CDATA[
		
		<p>最近群里问得比较多的一个问题。</p>
<p><strong>我写的一个小例子</strong>，注意看注释理解。</p>
<p>; 直接图形法下颜色指定<br>
; By HH CUHK<br>
Pro TestDirectColors<br>
; 注意这里：按列看，第一列是黑色，第二列是红色。。<br>
r = [0, 255, 255, 0,&nbsp;&nbsp;  0,&nbsp;&nbsp;  0,&nbsp;&nbsp;  255, 255]<br>
g = [0, 0,&nbsp;&nbsp;  255, 255, 255, 255, 0,&nbsp;&nbsp;  255]<br>
b = [0, 0,&nbsp;&nbsp;  0,&nbsp;&nbsp;  0,&nbsp;&nbsp;  255, 255, 255, 255]<br>
;&nbsp;&nbsp;  载入自定义颜色：从1开始编号。<br>
TVLCT, r, g, b, 1<br>
Erase, COLOR=8 ; 刷新背景色，8号颜色：白色：第8列颜色；背景色也可以直接指定!P.BackGroud = 8<br>
p = [0.15, 0.15, 0.9, 0.9] ; Position of the plot in the window.&nbsp;&nbsp;  <br>
&nbsp;&nbsp;&nbsp;  Plot, findgen(11), COLOR=2, $ ; 线颜色：2号色：红色：第2列颜色<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  POSITION=p, /NOERASE <br>
End</p>
<p><strong>大卫的答案：</strong></p>
<center>
<h1>Adding a Color Background to a Plot</h1>
</center>
<p><strong>QUESTION:</strong> I'd like to have a color background on my plot. I know about using the <strong>Background</strong> keyword to establish the background for the display window, but that's not what I am talking about. I want just the area of the plot enclosed by the axes in a different color. I've tried adding this background with the <strong>Polyfill</strong> command, but then my plot tick marks disappear. Is there a better way to do this?</p>
<p><img height="3" width="100%" zmxid="zoomXimageId1" src="http://www.dfanning.com/images/hruler.gif"></p>
<p><strong>ANSWER:</strong> If you position your plot with the <strong>Position </strong>keyword, then you can draw your background polygon first into that position, then draw your plot with the <strong>NoErase </strong>keyword set. (You might want to erase the window first with the <strong>Erase</strong> command, since with this method you will be losing the <strong>Plot </strong>command's ability to erase whatever is currently in the window before it draws. This would be a good time to get the area outside the polygon the color you want, since you can use the <strong>Color</strong> keyword here as well.) Here is an example of what I mean.</p>
<pre>p = [0.15, 0.15, 0.9, 0.9] ; Position of the plot in the window.
   Erase, COLOR=FSC_COLOR('papaya')
   PolyFill, [p[0],p[0],p[2],p[2],p[0]], $
             [p[1],p[3],p[3],p[1],p[1]], $
             COLOR=FSC_COLOR('tan'), /NORMAL
   Plot, findgen(11), COLOR=FSC_COLOR('dark red'), $
      POSITION=p, /NOERASE
   PlotS, findgen(11), findgen(11), PSYM=2, $
      COLOR=FSC_COLOR('royal blue')</pre>
<p>Executing these command results in the following figure. (You will need the <a href="http://www.dfanning.com/programs/fsc_color.pro">FSC_Color</a> program from the <a href="http://www.dfanning.com/documents/programs.html">Coyote Library</a> to run the code.)</p>
<p>
<table align="center">
    <tbody>
        <tr>
            <td>
            <div forimg="1" align="center"><img class="blogimg" border="0" small="0" src="http://hiphotos.baidu.com/huxz/pic/item/e6f44482639390870df4d26e.jpg"></div>
            </td>
        </tr>
        <tr>
            <td class="caption">A plot with a colored background inside the axes.</td>
        </tr>
    </tbody>
</table>
</p>
<p>Note that direct graphics commands just put pixels on top of pixels, so sometimes you have to &quot;layer&quot; your graphics commands to achieve the results you want. The <strong>NoErase</strong> keyword is a great help when you are re-drawing axis tick marks and the like.</p>
<p><img height="3" width="100%" zmxid="zoomXimageId3" src="http://www.dfanning.com/images/hruler.gif"></p>
<h1>Adding Backgrounds with Multiple Plots</h1>
<p><strong>QUESTION:</strong> Well, sure, this works fine for a single plot. But what if I am drawing multiple plots using <strong>!P.MULTI</strong>? It doesn't work at all then. How can I do the same thing with multiple plots?</p>
<p><img height="3" width="100%" zmxid="zoomXimageId4" src="http://www.dfanning.com/images/hruler.gif"></p>
<p><strong>ANSWER:</strong> Ah, then you have to be a little more clever than you were before. Two pieces of information are required. First, every time you issue a graphics command that would, on its own, erase the window, <strong>!P.MULTI </strong>adjusts the plot positioning system variables so that the plot goes into the new plot space. This makes it hard to &quot;clean up&quot; the plot by the layering method described above. In other words, even if you use a <strong>PLOT </strong>command with a <strong>NOERASE </strong>keyword set, the plot goes into the <em>next </em>space, not the space you are trying to draw it into. So you have to trick <strong>!P.MULTI</strong> into doing the right thing for you.</p>
<p>This brings up the second piece of information you need: the meaning of the first element of the <strong>!P.MULTI</strong> vector. <strong>!P.MULTI[0]</strong> indicates how many plots <em>remain to be plotted</em> on the page. So, if I have four plots on the page, and I draw the first plot, <strong>!P.MULTI[0]</strong> is set to 3, since there are three plots remaining to be plotted on the page.</p>
<pre>IDL&gt; !P.MULTI=[0,2,2] ; Four plots on a page.
   IDL&gt; Plot, Findgen(11)
   IDL&gt; Print, !P.MULTI[0]
 3
   IDL&gt; Plot, Findgen(11)
   IDL&gt; Print, !P.MULTI[0]
 2
   IDL&gt; Plot, Findgen(11)
   IDL&gt; Print, !P.MULTI[0]
 1
   IDL&gt; Plot, Findgen(11)
   IDL&gt; Print, !P.MULTI[0]
 0</pre>
<p>If I am just staring to draw a plot, <strong>!P.MULTI[0]</strong> is set to 4, but since there are four plots to be plotted, this is set internally to 0 (please don't ask). Or, rather, 4 is the equivalent of 0, but it is the 0 that tells <strong>!P.MULTI</strong> to erase the page and start a new set of plots. Clear?</p>
<p>Don't worry about it. Trust me. Think of it like this:</p>
<pre>!P.MULTI[0] = (Number of plots remaining to be drawn) MOD (Total number of plots)</pre>
<p>The point is, we can manipulate <strong>!P.MULTI[0]</strong> to trick <strong>!P.MULTI</strong> into doing things for us that it didn't intend to do. That's what we are going to do to put background colors in multiple plots.</p>
<p>One final point, before I show you the code. You can't use positional parameters like the <strong>POSITION </strong>keyword on your plots when you are using <strong>!P.MULTI</strong>. This is because <strong>!P.MULTI</strong> is manipulating the plot position for you. If you try to do the same, the result is a muddled mess. However, you can tell where <strong>!P.MULTI</strong> positioned your plot (after it is drawn) from the <strong>!X.WINDOW</strong> and <strong>!Y.WINDOW</strong> system variables.</p>
<p>OK, here is the code for producing a 2 by 2 arrangement of four plots.</p>
<pre>; Set up for 2x2 plot sequence
   !P.MULTI=[0,2,2]
   
   ; First plot. Use BACKGROUND keyword to set background for all plots.
   Plot, findgen(11), COLOR=FSC_COLOR('dark red'), BACKGROUND=FSC_COLOR('papaya')

   ; Position of the plot in the window. Fill with POLYFILL.
   p = [!X.Window[0], !Y.Window[0], !X.Window[1], !Y.Window[1]]  
   PolyFill, [p[0],p[0],p[2],p[2],p[0]], $
             [p[1],p[3],p[3],p[1],p[1]], $
             COLOR=FSC_COLOR('tan'), /NORMAL

   ; Rewind plot counter, &quot;fix&quot; the plot, then reset for NEXT plot.
   !P.MULTI[0] = 0
   Plot, findgen(11), COLOR=FSC_COLOR('dark red'), /NOERASE 
   PlotS, findgen(11), findgen(11), PSYM=2, COLOR=FSC_COLOR('royal blue')
   !P.MULTI[0] = 3

   ; Second plot.
   Plot, findgen(11), COLOR=FSC_COLOR('dark red')

   ; Position of the plot in the window. Fill with POLYFILL.
   p = [!X.Window[0], !Y.Window[0], !X.Window[1], !Y.Window[1]] 
   PolyFill, [p[0],p[0],p[2],p[2],p[0]], $
             [p[1],p[3],p[3],p[1],p[1]], $
             COLOR=FSC_COLOR('tan'), /NORMAL
 
   ; Rewind plot counter, &quot;fix&quot; the plot, then reset for NEXT plot.
   !P.MULTI[0] = 3
   Plot, findgen(11), COLOR=FSC_COLOR('dark red'), /NOERASE 
   PlotS, findgen(11), findgen(11), PSYM=2, COLOR=FSC_COLOR('royal blue')
   !P.MULTI[0] = 2

   ; Third plot.
   Plot, findgen(11), COLOR=FSC_COLOR('dark red')

   ; Position of the plot in the window. Fill with POLYFILL.
   p = [!X.Window[0], !Y.Window[0], !X.Window[1], !Y.Window[1]]   
   PolyFill, [p[0],p[0],p[2],p[2],p[0]], $
             [p[1],p[3],p[3],p[1],p[1]], $
             COLOR=FSC_COLOR('tan'), /NORMAL
 
   ; Rewind plot counter, &quot;fix&quot; the plot, then reset for NEXT plot.
   !P.MULTI[0] = 2
   Plot, findgen(11), COLOR=FSC_COLOR('dark red'), /NOERASE 
   PlotS, findgen(11), findgen(11), PSYM=2, $
      COLOR=FSC_COLOR('royal blue')
   !P.MULTI[0] = 1
      
  ; Fourth plot.    
   Plot, findgen(11), COLOR=FSC_COLOR('dark red')

   ; Position of the plot in the window. Fill with POLYFILL.
   p = [!X.Window[0], !Y.Window[0], !X.Window[1], !Y.Window[1]]  
   PolyFill, [p[0],p[0],p[2],p[2],p[0]], $
             [p[1],p[3],p[3],p[1],p[1]], $
             COLOR=FSC_COLOR('tan'), /NORMAL

   ; Rewind plot counter, and &quot;fix&quot; the plot.
   !P.MULTI[0] = 1
   Plot, findgen(11), COLOR=FSC_COLOR('dark red'), /NOERASE 
   PlotS, findgen(11), findgen(11), PSYM=2, $
      COLOR=FSC_COLOR('royal blue')

  ; Set back to single plot.
  !P.MULTI = 0</pre>
<p>You see the result in the figure below.</p>
<p>
<table align="center">
    <tbody>
        <tr>
            <td>
            <div forimg="1" align="center"><img class="blogimg" border="0" small="0" src="http://hiphotos.baidu.com/huxz/pic/item/96044cdabaed79feb7fd486f.jpg"></div>
            </td>
        </tr>
        <tr>
            <td class="caption">A multi-plot with a colored background inside the axes of each plot.</td>
        </tr>
    </tbody>
</table>
</p> <a href="http://hi.baidu.com/huxz/blog/item/42e3c054090b7450d009066a.html">阅读全文</a>
		
		<br/><b>类别：</b><a href="http://hi.baidu.com/huxz/blog/category/idl%CA%B5%D3%C3%B4%F3%C8%AB">idl实用大全</a>&nbsp;<a href="http://hi.baidu.com/huxz/blog/item/42e3c054090b7450d009066a.html#comment">查看评论</a>]]></description>
        <pubDate>2009-06-03  10:45</pubDate>
        <category><![CDATA[idl实用大全]]></category>
        <author><![CDATA[hhuxz]]></author>
		<guid>http://hi.baidu.com/huxz/blog/item/42e3c054090b7450d009066a.html</guid>
</item>


</channel>
</rss>