0

screenshot of error message indicating image not found when running JACoP. Also got errors such as ";" expected. I've tried countless combinations of paths to try and get my macro working to analyze a very large set of images using JACoP. Any suggestions on what might be the issue?

this iteration got me closest (I think) to getting it to work. It even loads images, as shown in attached photos, but won't actually analyze the images themselves. Im thinking it might have something to do with me improperly setting up the loop to repeat itself? also maybe I'm designating channels incorrectly? pretty lost on what to do next, and there aren't any answers I've found on the web.

#@ File (label = "Input directory", style = "directory") input
#@ File (label = "Output directory", style = "directory") output
#@ String (label = "File suffix", value = ".nd2") suffix

// See also Process_Folder.py for a version of this code
// in the Python scripting language.

input = "/Users/alexandrapowell/Desktop/221223B31A3/"
output = "/Users/alexandrapowell/Desktop/221223B31A3batchh/"
processFolder(input);

// function to scan folders/subfolders/files to find files with correct suffix
function processFolder(input) {
    list = getFileList(input);
    fileList = Array.sort(list);
    for (i = 0; i < list.length; i++) {
        if(File.isDirectory(input + File.separator + list[i]))
            processFolder(input + File.separator + list[i]);
        if(endsWith(list[i], suffix))
            processFile(input, output, list[i]);
    }
}

function processFile(input, output, file) {
    open(list[i])
    run("JACoP ", "imga=0 imgb=1 thra=15000 thrb=3000 get_pearsons get_manders get_overlap");
    // Do the processing here by adding your own code.
    // Leave the print statements until things work, then remove them.
    print("Processing: " + input + File.separator + file);
    saveAs("Text", output + File.separator + "_coloc.txt")
    print("Saving to: " + output);
    run("Close");
    run("Close All");
    
}
Dragonthoughts
  • 2,180
  • 8
  • 25
  • 28
apowell37
  • 1
  • 1
  • Functions work independently of each other. So in your second function `processFile()` it doesn't know what `list` is, so `open(list[i]);` will not work. It should read `open(file);` Then, on the next line JACoP needs two images (specified in the arguments imga and imgb). You have only opened one, so JACoP will probably give an error here. There looks like a working example posted in an answer over at image.sc https://forum.image.sc/t/imagej-batch-processing-using-jacop-plug-in/49578/3 I recommend trying that and if you run into more problems, post a question there. – quantixed Jan 06 '23 at 09:27
  • Pictures of code are not very helpful, Many people will not be able to access them, either because of disability or the device they are using (how will it appear on a mobile phone). Also, the content is not searchable in a picture, but well done for adding meaningful alt-text to the image. Please edit the question to include the relevant content from the picture. – Dragonthoughts Jan 09 '23 at 09:42

0 Answers0