Login  Register

Using UnwarpJ in a macro

Posted by Paletzki, Ron (NIH/NIMH) [C] on Mar 21, 2017; 7:33pm
URL: http://imagej.273.s1.nabble.com/Using-UnwarpJ-in-a-macro-tp5018342.html

I am trying to register multichannel images and I’ve tried most of the plugins in Fiji’s registration plugins folder.   Using UnwarpJ I can take the channel containing a nissl stain and register it to our reference images (target) and save the transformation which I can then apply individually to the other channels containing different fluorescent signals.  This works but we have 1000 of images so I need to write a macro to automate this task.  So I read the UnwarpJ web page and copied and ran a one line macro to try and align two open images (target_299.tif and source_299.tif).  I get the Exception listed below.  Any ideas or help would be greatly appreciated.

The macro line is
run("UnwarpJ","-align target_299.tif NULL source_299.tif NULL 0 2 0 0 1 output.tif");

By the way on all examples I could find of macros using UnwarpJ, the run(“UnwarpJ “ call always has a space after UnwarpJ right before the quotation mark.  If I run that I get an “Unrecognized command: “UnwarpJ “” error, but if I remove the space it appears to start the command but some other error occurs.

Thanks for any help
Ron

EXCEPTION
(Fiji Is Just) ImageJ 2.0.0-rc-59/1.51j; Java 1.8.0_66 [64-bit]; Mac OS X 10.12.3; 127MB of 17339MB (<1%)

java.lang.NullPointerException
            at UnwarpJ_.alignImagesMacro(UnwarpJ_.java:244)
            at UnwarpJ_.run(UnwarpJ_.java:152)
            at ij.IJ.runUserPlugIn(IJ.java:217)
            at ij.IJ.runPlugIn(IJ.java:181)
            at ij.Executer.runCommand(Executer.java:137)
            at ij.Executer.run(Executer.java:66)
            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.run(Interpreter.java:96)
            at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:155)
            at ij.IJ.runMacro(IJ.java:134)
            at ij.IJ.runMacro(IJ.java:123)
            at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1039)
            at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1035)
            at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:986)
            at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1035)
            at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:97)
            at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:144)
            at org.scijava.script.ScriptModule.run(ScriptModule.java:177)
            at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
            at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
            at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
            at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)






--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html