Quantcast

Using UnwarpJ in a macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using UnwarpJ in a macro

Paletzki, Ron (NIH/NIMH) [C]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using UnwarpJ in a macro

Herbie
Dear Ron,

I guess the character following "UnwarpJ" is not a blank but an
underscore -- no?

HTH

Herbie

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Am 21.03.17 um 20:33 schrieb Paletzki, Ron (NIH/NIMH) [E]:

> 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using UnwarpJ in a macro

Philippe CARL
In reply to this post by Paletzki, Ron (NIH/NIMH) [C]
Dear Ron,
I modified (= slightly improved and simplified) the UnwarpJ plugin.
And with these modifications, you will be able to launch the transformation from pictures in memory as well as won't need anymore the use of the target picture.
To know a liitle bit more about the modifications and where to download the code, I would suggest you to have a look at the following discussion on the ImageJ forum:
http://forum.imagej.net/t/unwarpj-scripting-documentation/2939/3
My best regards,
Philippe

Le Mardi 21 Mars 2017 20:33 CET, "Paletzki, Ron (NIH/NIMH) [E]" <[hidden email]> a écrit:

> 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





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