【问题标题】:ImageJ batch image conversionImageJ 批量图像转换
【发布时间】:2015-11-12 16:12:30
【问题描述】:

我正在尝试使用 ImageJ 中的批处理脚本批量转换 200 多个原始 .img 文件。我的脚本:

//-----------Code starts here--------------------- 
dir1 = getDirectory("path/source"); 
dir2 = getDirectory("path/target"); 
list = getFileList(dir1); 
setBatchMode(true); 

 for (i=0; i<list.length; i++) { 
      showProgress(i+1, list.length); 
      if(endsWith(list[i],".IMG")) 
         run("Raw...", open=["+dir1+list[i]+"] image=[16-bit Unsigned] width=2048 height=2048 offset=359 number=1 gap=0"); 
      else 
         open(dir1+list[i]); 
      saveAs(format, dir2+list[i]); 
      close(); 
   } 

但是,当我尝试运行它时,我收到以下错误:

我不知道为什么,因为我确实有一个 ;关闭线路...

【问题讨论】:

    标签: imagej


    【解决方案1】:

    错误消息具有误导性,因为您在 run() 的第二个参数的开头缺少引号 ("):

    run("Raw...", "open=["+dir1+list[i]+"] image=[16-bit Unsigned] width=2048 height=2048 offset=359 number=1 gap=0");
    

    错误消息中的&lt;&gt; 字符表示解析器发现意外的位置。

    我编辑了您的原始代码以包含语法突出显示,这有助于发现此类错误。斐济的script editor 包括语法高亮,建议在使用 ImageJ 宏时使用。

    一般来说,ImageJ 特定的问题在专用论坛上发布时更有可能得到及时的回答:http://forum.imagej.net/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-22
      • 1970-01-01
      • 2019-10-27
      • 1970-01-01
      • 1970-01-01
      • 2015-05-27
      • 1970-01-01
      相关资源
      最近更新 更多