Posted by
Kyle Harrington on
Sep 29, 2015; 2:04pm
URL: http://imagej.273.s1.nabble.com/imagej-scripting-using-kawa-can-t-use-plugins-tp5014487p5014490.html
Hi David,
I¹m regularly using Clojure with existing ImageJ/FIJI plugins. We have a
package that allows you to use ImageJ/FIJI functions from Clojure in a
standalone mode (I.e. You can run your scripts as independent Clojure
projects instead of within Clojure):
https://github.com/funimage/funimage. It provides type-hinted wrappers to a large number of ImageJ functions,
some imglib2 functions, and a few extra ones. I admit that the code is
currently a bit messy, but there will be some example documentation
getting posted in conjunction with the BioImage Informatics meeting next
month. Until then, feel free to contact me offline if you have specific
Clojure issues.
If you want to do it yourself, I bootstrapped using the same suggestions
Curtis made. First (2), as FIJI should be managing the classpath for you
already. To get things working a standalone way, both (1) and (2) were
necessary to make an Clojure project that could call IJ functions which
relied on plugins (like ij.IJ/run).
Cheers,
Kyle
--
Kyle I S Harrington, PhD
Postdoctoral Fellow
Bentley Group, Computational Biology Lab
Center for Vascular Biology Research,
Beth Israel Deaconess Medical Center
Harvard Medical School, Boston, MA
web:
http://www.kyleharrington.comOn 9/29/15, 9:41 AM, "Curtis Rueden" <
[hidden email]> wrote:
>Hi David,
>
>> No matter what higher level programing language I use, I am unable to
>> use any plugins, neither using Kawa nor using Clojure.
>
>Some ideas:
>
>1) Try setting the plugins.dir system property to specify your ImageJ
>plugins folder [1].
>
>2) Run your Clojure scripts from within ImageJ using the Script Editor
>[2],
>or from the CLI using the ImageJ launcher [3].
>
>3) Try putting all plugin JARs individually on your classpath.
>
>Regards,
>Curtis
>
>[1]
http://imagej.net/Plugins#Configuring_where_ImageJ_looks_for_plugins>[2]
http://imagej.net/Script_Editor>[3]
http://imagej.net/Launcher>
>On Tue, Sep 29, 2015 at 1:37 AM, David Pirotte <
[hidden email]> wrote:
>
>> Hello,
>>
>> Scripting using higher level languages such as Kawa [an/or
>> Clojure], I
>> can't make things happen so that I can use plugins
>>
>> I am using Kawa (1) but please note that what is described in
>>this
>> report
>> also fails using clojure, since the problem is 'with/within' the
>> ImageJ 'eco
>> system' itself (2), not 'with/within' these higher level
>>languages.
>>
>>
>> 1] Short story:
>>
>> No matter what higher level programing language I use, I am
>>unable
>> to use any
>> plugins, neither using Kawa nor using Clojure.
>>
>> I generally can do most, but not everything, of what is defined in the
>> imagej core
>> jar (3) - but nothing that is defined in plugins.
>>
>> A quick look at the imagej launcher code [note that my java knowledge is
>> close to
>> zero], and it appears that, indeed, an impressive bit of magic occurs at
>> launching
>> time:
>>
>> I wonder if someone else did solve this problem [even if for
>> clojure] and
>> would be happy to share the solution with me?
>>
>>
>> 2] Example - "Non-local Means Denoising" (4)
>>
>> Attached: nlm-small.png a small image to test
>>
>> Code: ij-core.scm a kawa scheme very short
>> snipset
>> ( here -> )
http://paste.lisp.org/+3CB7>>
>> [ see at the end of ij-core.scm for a session example if would
>> like to try
>> [ it, in which case you need kawa of course, then you would
>> compile the
>> [ ij-core.scm file like this:
>>
>> [ kawa -C ij-core.scm
>> [ -> ij$Mncore.class
>>
>> My directory setting is:
>>
>> ~/lpdi/projects/kawa
>> images/
>> nlm-small.png
>> jars/
>> ij-1.49v.jar
>> ij.jar -> ij-1.49v.jar
>> NL_Means_1_3.jar
>> nl-mean.jar -> NL_Means_1_3.jar
>> ij-core.scm
>> ij$Mncore.class
>>
>> Then cd to this location and here a trace of a simple session:
>>
>> export CLASSPATH=.:./jars/ij.jar:./jars/nl-mean.jar
>> kawa
>> (import (ij-core))
>> (define iplus1 (ij-open "nlm-small.png"))
>> (ij-show iplus1)
>> (ij-run iplus1 "Non-local Means Denoising" "sigma=3")
>> ->
>> Unrecognized command: "Non-local Means Denoising"
>> #!null
>>
>> But Kawa sees the classes, here:
>>
>> (module-classes "jars/nl-mean.jar")
>> ->
>> jars/nl-mean.jar:
>> META-INF/
>> META-INF/MANIFEST.MF
>> de/
>> de/biomedical_imaging/
>> de/biomedical_imaging/ij/
>> de/biomedical_imaging/ij/nlMeansPlugin/
>>
>>de/biomedical_imaging/ij/nlMeansPlugin/FastMathStuff.class
>>
>>
>>de/biomedical_imaging/ij/nlMeansPlugin/NLMeansDenoising_$WorkerDouble.cla
>>ss
>>
>> de/biomedical_imaging/ij/nlMeansPlugin/NLMeansDenoising_$WorkerInt.class
>>
>> de/biomedical_imaging/ij/nlMeansPlugin/NLMeansDenoising_.class
>> plugins.config
>>
>> Plugins.config
>> ...
>> Plugins, "Non-local Means Denoising",
>> de.biomedical_imaging.ij.nlMeansPlugin.NLMeansDenoising_
>>
>> Thanks for some usefull hint(s),
>> Cheers,
>> David
>>
>>
>> (1) menu driven, parameterized strings arguments
>> (2)
https://www.gnu.org/software/kawa/>> (3) I'm currently using ij149v.jar
>> (4)
https://github.com/thorstenwagner/ij-nl-means>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>
>--
>ImageJ mailing list:
http://imagej.nih.gov/ij/list.html________________________________
This message is intended for the use of the person(s) to whom it may be addressed. It may contain information that is privileged, confidential, or otherwise protected from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution, copying, or use of this information is prohibited. If you have received this message in error, please permanently delete it and immediately notify the sender. Thank you.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html