Batch Processing with Filename and NMJ_morphometrics plugin

Hello All,

I am trying to batch process with a plugin that is natively designed to run through all images in a selected folder, however I believe this plugin may have a bug, because it won’t process more than 3 images. So I decided to try putting each image in a subfolder like so

image

When I run this code however
{
mainDir = getDirectory(“D:\NMJ Morphometrics Batch Folders\”);
mainList = getFileList(mainDir);

for (i=0; i<mainList.length; i++)
if(endsWith(mainList[i], “/”))

      subDir = mainDir + mainList[i]; 
      subList = getFileList(subDir); 

       for (j=0; j<subList.length; j++) 
           run("Drosophila NMJ Morphometrics 20160130", "unique=[] stack=stack projection=flatstack roi=roi result=res scale=0 scale=0 find=50 min.=100 rolling=20 brp-puncta=400 brp-puncta=4095 nmj=RenyiEntropy skeleton=Li active=Huang convert define analyze wait choose=[subDir]");

}

the plugin seems to struggle with interpreting the folder name after it has been processed by the getDirectory function and it aborts, to prove this, if I remove all the for loops and if statement and just try to initiate the run command like so
{
mainDir = getDirectory(“D:\NMJ Morphometrics Batch Folders\Synapse1\”);
mainList = getFileList(mainDir);

run(“Drosophila NMJ Morphometrics 20160130”, “unique= stack=stack projection=flatstack roi=roi result=res scale=0 scale=0 find=50 min.=100 rolling=20 brp-puncta=400 brp-puncta=4095 nmj=RenyiEntropy skeleton=Li active=Huang convert define analyze wait choose=[mainDir]”);
}

In the above code the plugin aborts even tho it starts, in the following code the plugin runs fine
run(“Drosophila NMJ Morphometrics 20160130”, “unique= stack=stack projection=flatstack roi=roi result=res scale=0 scale=0 find=50 min.=100 rolling=20 brp-puncta=400 brp-puncta=4095 nmj=RenyiEntropy skeleton=Li active=Huang convert define analyze wait choose=[D:\NMJ Morphometrics Batch Folders\Synapse1\]”);

I hope I have outlined the problem sufficiently to help me solve this. Is there a way to iterate over the run plugin command so that the

choose = [“D:\NMJ Morphometrics Batch Folders\Synapse_\”]

iterates over each Synapse folder by the number that ends the folder title? Or another way to get around these specific limitations with this plugin?

-Thanks so much,
Adama