Exception error Concatenate several macros into one single file

fiji
analyze-particles
imagej
plugin
batch-processing
macro
segmentation
roi

#1

Hello everybody,

I recently produced three different codes as part of a methodology of image analysis of grayscale images containing each multiple objects.The output of the first code is the input of the second code, and the output of the second is the input of the third code.

The single codes run perfectly on their own, but the once together I get an exception error, listed below, and I don’t know why.

As my experience in coding is still limited, I am wondering if there is a specific syntax to concatenate and run several macro codes as a single file. So far I wasn’t able to find anything specific online.

Although I would, I cannot include the code here, as is part of a yet unpublished research project.

I am aware that this might stronglly limit the help, but I was hoping someone could point me on the right direction.

Thanks a lot

 
java.lang.NullPointerException

	at trainableSegmentation.Weka_Segmentation.run(Weka_Segmentation.java:1270)

	at ij.IJ.runUserPlugIn(IJ.java:228)

	at ij.IJ.runPlugIn(IJ.java:192)

	at ij.Executer.runCommand(Executer.java:137)

	at ij.Executer.run(Executer.java:66)

	at ij.IJ.run(IJ.java:308)

	at ij.IJ.run(IJ.java:283)

	at ij.macro.Functions.doRun(Functions.java:626)

	at ij.macro.Functions.doFunction(Functions.java:97)

	at ij.macro.Interpreter.doStatement(Interpreter.java:250)

	at ij.macro.Interpreter.doStatements(Interpreter.java:236)

	at ij.macro.Interpreter.run(Interpreter.java:119)

	at ij.macro.Interpreter.run(Interpreter.java:90)

	at ij.macro.Interpreter.run(Interpreter.java:101)

	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)

	at ij.IJ.runMacro(IJ.java:147)

	at ij.IJ.runMacro(IJ.java:136)

	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1098)

	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1094)

	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1045)

	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1094)

	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:137)

	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)

	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)

	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)

	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)

	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)

	at java.util.concurrent.FutureTask.run(FutureTask.java:266)

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

	at java.lang.Thread.run(Thread.java:748)


#2

Dear @PPgeo,

Sorry for the late answer!

When you say “codes” are you referring to macro or script code? From your post title I assume it is macro code, but It would be very helpful if you post all code here so we can identify the source of the error.


#3

Looking at that line of the original code, it seems your macro tries to get the plugin window before it has been opened. That problem has been commented before and it’s simply solved by adding a small waiting time before calling the next command.