【问题标题】:Setting different thresholds dependent on what filename ends with in ImageJ macro根据 ImageJ 宏中的文件名结尾设置不同的阈值
【发布时间】:2015-12-15 00:34:14
【问题描述】:

我有一个包含许多图像的文件夹。这些被分组为一组三个图像,其中一个文件名以dsRed).tif 结尾,另一个文件名以FITC).tif 结尾,另一个文件名以DAPI).tif 结尾。

我如何告诉 ImageJ 对每个图像执行不同的操作,具体取决于它具有哪个文件名结尾?

我尝试设置宏来运行不同的阈值,例如:

//run("Brightness/Contrast...");
setMinAndMax(0, 20000);
close();

根据此处找到的脚本添加到不同的文件名: http://imagej.1557.x6.nabble.com/open-file-with-specific-partial-name-td5002910.html 和这里: http://rsb.info.nih.gov/ij/macros/Batch_RGB_Merge.txt 但我在格式化时遇到问题,如果其他功能与我的三个文件名结尾一起使用。

【问题讨论】:

    标签: imagej imagej-macro


    【解决方案1】:

    您可以使用随后的if ... else 语句检查文件名:

    if (endsWith(filename,"dsRed).tif") {
        // do dsRed processing here
    } else if (endsWith(filename,"FITC).tif") {
        // do FITC processing here
    } else if (endsWith(filename,"DAPI).tif") {
        // do DAPI processing here
    }
    

    如果您想对包含相同基本名称的文件进行分组,请仅在您的一个频道上循环(例如dsRed)并使用replace

    replace(filename, "dsRed).tif", "FITC).tif");
    

    在每个循环迭代中处理相应的其他通道。

    【讨论】:

    • 非常感谢 Jan. 宏:dir = getDirectory("image");名称=获取标题; if (endsWith(name,"dsRed).tif")) { //运行 dsRed 东西 run("Close"); } else if (endsWith(name,"FITC).tif")) { //运行 FITC 的东西 run("Close"); } else if (endsWith(name,"DAPI).tif")) { //运行 DAPI 的东西 run("Close"); } 工作得很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-08
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多