0

所以这是我第二次发布这样的问题。上次我从一个名为@quantixed 的用户那里得到了很多帮助,但我再次需要帮助。

我的代码不起作用,但这与我试图从堆栈中分离图像有关,因为我需要分别分析每一层并寻找重叠(双阳性和三阳性细胞)。它一直运行,直到我尝试命名每一层。我尝试添加“startsWith”,因为无论堆栈如何,每一层都以 c:1/3、c:2/3 或 c:3 开头。这是代码:

macro "Process My Files" {
    dir1 = getDirectory("C:/Users/laure/OneDrive/Documents/MSc Molecular Biology & Biotechnology/Masters Project - Dombrowski Lab/Project Data/LD005 CX5/CellHealthProfiling.V4_03-06-20_09;46;02/CEM-133432_200229080001/");
    dir2 = getDirectory("C:/Users/laure/OneDrive/Documents/MSc Molecular Biology & Biotechnology/Masters Project - Dombrowski Lab/Project Data/LD005 CX5/CellHealthProfiling.V4_03-06-20_09;46;02/CEM-133432_200229080001/ImageJ Macro Batch Results");
    list = getFileList(dir1);

    // Make an array of C01 files only
    C01list = newArray(0);
    for (i=0; i<list.length; i++) {
        if (endsWith(list[i], ".C01")) {
            C01list = append(C01list, list[i]);
        }
    }
    
x=startsWith("c:1/3")
y=startsWith("c:2/3")
a=startsWith("c:3/3")
b="Result of" + x
c="Result of" + b
d="Drawing of" + x
e="Drawing of" + y
f="Drawing of" + a
g="Drawing of" + b
h="Drawing of" + g

function DAPI() {
    selectWindow(x);
    run("8-bit");
    setThreshold(45, 255);
    run("Convert to Mask");
    run("Analyze Particles...", "size=30-350 show=Outlines clear summarize add");
}

function OLIG2() {
    selectWindow(y);
    run("8-bit");
    setThreshold(25, 255);
    run("Conert to Mask");
    run("Analyze Particles...", "size=30-250 show=Outlines clear summarize add");
}

function MBP() {
    selectWindow(a);
    run("8-bit");
    setThreshold(52, 255);
    run("Convert to Mask");
    run("Analyze Particles...", "size=30.00-250.0 show=Outlines clear summarize add");  
}

function DAPI_Olig2_overlay() {
    imageCalculator("AND create", x, y);
    selectWindow(b);
    run("Analyze Particles...", "size=30-250 show=Outlines clear summarize add");
}

function DAPI_Olig2_MBP_overlay() {
    imageCalculator("AND create", b, a); //overlay DAPI, Olig2 and Ki-67
    selectWindow(d);
    run("Analyze Particles...", "size=30-250 show=Outlines clear summarize add");   
}


    setBatchMode(true);
    for (i=0; i<C01list.length; i++) {
        showProgress(i+1, C01list.length);
        // your code goes here - an example is shown
        s = "open=["+dir1+C01list[i]+"] autoscale color_mode=Composite rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT";
         DAPI();
        OLIG2();
        Ki67orMBP();
        DAPI_Olig2_overlay();
        DAPI_Olig2_Ki67_overlay();
        saveAs("tiff", dir2+replace(C01list[i],".C01",".tif"));
        close();
        // and ends here
    }
    setBatchMode(false);
}

function append(arr, value) {
    arr2 = newArray(arr.length+1);
    for (i=0; i<arr.length; i++)
        arr2[i] = arr[i];
        arr2[arr.length] = value;
    return arr2;
}

我遇到的问题是它达到了x=startsWith("c:1/3"),它不能再进一步了。我知道其余的代码可以工作,只是在选择我希望它分析的堆栈层时遇到问题。每当我点击运行时,我都会收到此错误:

Error:      Number or numeric function expected in line 14:
        x = startsWith ( "c:1/3" <)>

有任何想法吗?

4

0 回答 0