Exception error in batch process

Hello,

I’m trying to analyze a great number of image at a time with biovoxxel plugin in ‘‘batch process’’ but I get an exception error message :

java.lang.IllegalArgumentException: Column not defined: 36
	at ij.measure.ResultsTable.getValueAsDouble(ResultsTable.java:354)
	at Extended_Particle_Analyzer.particleAnalysis(Extended_Particle_Analyzer.java:661)
	at Extended_Particle_Analyzer.run(Extended_Particle_Analyzer.java:334)
	at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:265)
	at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:114)
	at ij.IJ.runUserPlugIn(IJ.java:219)
	at ij.IJ.runPlugIn(IJ.java:181)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:63)
	at ij.IJ.run(IJ.java:297)
	at ij.macro.Functions.doRun(Functions.java:601)
	at ij.macro.Functions.doFunction(Functions.java:96)
	at ij.macro.Interpreter.doStatement(Interpreter.java:230)
	at ij.macro.Interpreter.doStatements(Interpreter.java:218)
	at ij.macro.Interpreter.run(Interpreter.java:115)
	at ij.macro.Interpreter.run(Interpreter.java:85)
	at ij.macro.Interpreter.runBatchMacro(Interpreter.java:155)
	at ij.plugin.BatchProcessor.runMacro(BatchProcessor.java:218)
	at ij.plugin.BatchProcessor.processFolder(BatchProcessor.java:195)
	at ij.plugin.BatchProcessor.run(BatchProcessor.java:92)
	at ij.IJ.runPlugIn(IJ.java:187)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:63)
	at java.lang.Thread.run(Thread.java:745)

Can someone help me with this please?

Thanks a lot
Frédérique

The error message suggests that this is a bug in @biovoxxel’s Extended Particle Analyzer: it tries to read all column indices from 0 to resultsTable.getLastColumn(), but a results table can contain a non-continuous set of column indices.

Adding a simple check around line 661 of Extended_Particle_Analyzer.java should fix it:

if (resultsTable.columnExists(column)) {
    outputResultsTable.setValue(column, (row+existingResultsCounter), resultsTable.getValueAsDouble(column, row));
}

Ideally, you’d just loop over resultsTable.getHeadings() instead of special casing the column indices.

1 Like

Hi @imagejan

thanks for the hint. I actually tried to bugfix it by using a try-catch block for the moment but will most likely change it according to your suggestion and cycle through column headings.

@frederiquelagace: could you please update your Fiji and test the extended particle analyzer again let me know if the problem persists or is solved for now. Thanks!

@biovoxxel Thank you very much, it worked!

The only problem I have now is that I not able to obtain a summary result tables with all images analyzed. When I do it with the simple Particles analyzer from ImageJ it work.

I also get this message when I try it on a large number of image (600 images)

Exception in thread "Run$_AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 22
	at ij.text.TextCanvas.paint(TextCanvas.java:66)
	at ij.text.TextCanvas.update(TextCanvas.java:31)
	at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)
	at sun.awt.RepaintArea.paint(RepaintArea.java:232)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:358)
	at java.awt.Component.dispatchEventImpl(Component.java:4967)
	at java.awt.Component.dispatchEvent(Component.java:4713)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "Run$_AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException
Exception in thread "Run$_AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException

Thank you for your help, and sorry I’m new with this as you can see!

Frédérique

Hi @frederiquelagace,

glad, the first problem is solved.

I can actually not reproduce the problem with the summary table.

Did you make sure that “Summarize” is checked in the Extended Particle Analyzers" menu when you recorded the function to apply it as batch processing on all your images?

If “Summarize” is checked then the summary table should also fill with results (even from consecutive images).

The code could look like this

run("Extended Particle Analyzer", "  show=Masks redirect=None keep=None summarize");

I also do not get the error message (I tested this with 14 images using the ►Process►Batch►Macro… function)
Do you also run it with this ImageJ function or are you including it into your own macro code?
If you use your own code, could you post the macro to see where the problem might originate?

What puzzles me :thinking: is that the error message actually does not refer to any line in the Extended Particle Analyzer code but rather showing a problem with the TextCanvas class.

Does this always come up after a specific number of images or random?

one potential problem might also be if you run your macro in batch mode. For some functions ImageJ dislikes the batch mode which then do not run as intended. If you are using a macro, did you use setBatchMode(true);

I tried again on my file with 600 images and I didn’t get the previous error message…So I guess this is all good for that part!

But I still can’t summarize all the results in one table…

I used like you did process>batch>macro with a macro that I made with the record function (macro>record)

run("8-bit");
setAutoThreshold("Default dark");
//run("Threshold...");
setThreshold(206, 255);
//setThreshold(206, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Make Binary");
run("Extended Particle Analyzer", "area=50-Infinity circularity=0.40-1.00 aspect=0-3.5 show=Nothing redirect=None keep=None display summarize  add exclude");
run("ROI Manager...");

Thank you again for your help, it’s very appreciated!

Frédérique

Ok, tested it and can reproduce the problem.

It seems that the “Extended Particle Analyzer” somehow cannot deal with batch processing because the same happens when I add setBatchMode(true); to the macro.

So here is a workaround. This opens the images instead of handling them hidden, but then it will collect all the data.
You just run it from the editor without using the ►Process►Batch function

dir = getDirectory("choose the input folder");
files = getFileList(dir);
outputFolder = getDirectory("choose the output folder");
roiManager("Reset");

for(i=0; i<files.length; i++) {
	open(dir + files[i]);
	run("8-bit");
	setThreshold(206, 255);		//set your threshold
	setOption("BlackBackground", true);
	run("Convert to Mask");
	//run("Make Binary");
	run("Extended Particle Analyzer", "area=50-Infinity circularity=0.40-1.00 aspect=0-3.5 show=Nothing redirect=None keep=None display summarize  add exclude");
	//run("ROI Manager...");
	saveAs("Tiff", outputFolder + files[i] + "_analyzed");
	outputImage = getTitle();
	close(outputImage);
}

If any of the developers here has an answer to the problem what exactly triggers the batch mode problems for some methods and how to circumvent this programming wise, I would be heavily interested in this :wink: