FW: Directionality plugin - getting Directionality analysis output values

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

FW: Directionality plugin - getting Directionality analysis output values

Jacqueline Ross
Dear Jean-Yves (and other Directionality plugin users!),

My first attempt to send this email to the listserv was rejected so I'm' resending with a JPG instead of PDF so I apologise that you may be receiving it twice.

I'm attempting to help a colleague with the Directionality plugin that you created. He wants to automatically analyse around 2000 images and wants the Directionality analysis output as shown in the attached PDF as well as the Results table.

I had a look on the Fiji website here<http://fiji.sc/Directionality> and tried using the script you have there but I couldn't get it to work. I just kept getting errors. The way I was using it was running the plugin first and then using the macro. Perhaps that's not the way it's intended to be used...

I am not familiar with Python and usually use the standard ImageJ format ijm for macros as I rely fairly heavily on the Macro Recorder. Although I did dig out a guide to Python to see if I could figure out the problem myself - no success as yet.

Would you be able to send me an example macro for this that I can open directly in Fiji?

At the moment, all we do is draw a horizontal line across the image using the line tool and then run the Directionality plugin with the default settings. It would be good to be able to save out the Results table and the other table.

I have CCd the listserv in case other people are also interested in the answer. Any help would be very much appreciated:).

Kind regards,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit
School of Medical Sciences
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/


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

DirectionalityAnalysis.jpg (59K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FW: Directionality plugin - getting Directionality analysis output values

Jean-Yves Tinevez
Hi Jaqui, The Python script you point to should do the work. But you don't have to run it after running the plugin. The python script itself runs the plugin. It would be the base on which you could build something that would allow you to process the 2000 images in batch. The 2nd plugin on the wiki page will show you how to get the analysis results. You mention that you get errors. Would you care to copy/paste them here, with a description on how they occur? But first, try to run it as mention above. Best jy
Reply | Threaded
Open this post in threaded view
|

Re: FW: Directionality plugin - getting Directionality analysis output values

Herbie-4
In reply to this post by Jacqueline Ross
Jacqui,

in case you are also interested in pros & cons of common approaches to
global/regional orientation analysis, here are links to papers

<www.gluender.de/Writings/WritingsTexts/HardText.html#Gl-2013-1>

<www.gluender.de/Writings/WritingsTexts/HardText.html#Gl-1986-2>

Best regards

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 16.03.15 um 00:11 schrieb Jacqui Ross:

> Dear Jean-Yves (and other Directionality plugin users!),
>
> My first attempt to send this email to the listserv was rejected so
> I'm' resending with a JPG instead of PDF so I apologise that you may
> be receiving it twice.
>
> I'm attempting to help a colleague with the Directionality plugin
> that you created. He wants to automatically analyse around 2000
> images and wants the Directionality analysis output as shown in the
> attached PDF as well as the Results table.
>
> I had a look on the Fiji website here<http://fiji.sc/Directionality>
> and tried using the script you have there but I couldn't get it to
> work. I just kept getting errors. The way I was using it was running
> the plugin first and then using the macro. Perhaps that's not the way
> it's intended to be used...
>
> I am not familiar with Python and usually use the standard ImageJ
> format ijm for macros as I rely fairly heavily on the Macro Recorder.
> Although I did dig out a guide to Python to see if I could figure out
> the problem myself - no success as yet.
>
> Would you be able to send me an example macro for this that I can
> open directly in Fiji?
>
> At the moment, all we do is draw a horizontal line across the image
> using the line tool and then run the Directionality plugin with the
> default settings. It would be good to be able to save out the Results
> table and the other table.
>
> I have CCd the listserv in case other people are also interested in
> the answer. Any help would be very much appreciated:).
>
> Kind regards,
>
> Jacqui
>
> Jacqueline Ross Biomedical Imaging Microscopist Biomedical Imaging
> Research Unit School of Medical Sciences Faculty of Medical & Health
> Sciences The University of Auckland Private Bag 92019 Auckland 1142,
> NEW ZEALAND
>
> Tel: 64 9 923 7438 Fax: 64 9 373 7484
>
> http://www.fmhs.auckland.ac.nz/sms/biru/
>
>
> -- 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
|

Re: FW: Directionality plugin - getting Directionality analysis output values

Jacqueline Ross
In reply to this post by Jean-Yves Tinevez
Thanks Jean-Yves,

I tried running the first macro directly and got the errors listed below - something to do with defining the WindowManager..? Is there something else I need to install for this to work?

Traceback (most recent call last):
  File "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py", line 7, in <module>
    dir.setImagePlus(WindowManager.getCurrentImage())
NameError: name 'WindowManager' is not defined

        at org.python.core.PyException.fillInStackTrace(PyException.java:70)
        at java.lang.Throwable.<init>(Throwable.java:181)
        at java.lang.Exception.<init>(Exception.java:29)
        at java.lang.RuntimeException.<init>(RuntimeException.java:32)
        at org.python.core.PyException.<init>(PyException.java:46)
        at org.python.core.PyException.<init>(PyException.java:43)
        at org.python.core.PyException.<init>(PyException.java:61)
        at org.python.core.Py.NameError(Py.java:260)
        at org.python.core.PyFrame.getname(PyFrame.java:257)
        at org.python.pycode._pyx10.f$0(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py:35)
        at org.python.pycode._pyx10.call_function(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1275)
        at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
        at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
        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:164)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

If you have any further suggestions, I'd be very grateful. I've downloaded your example images to use to test the macros.

Thanks to Herbie also for sending me the links to some interesting papers.

Kind regards,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit 
School of Medical Sciences 
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jean-Yves Tinevez
Sent: Monday, 16 March 2015 9:29 p.m.
To: [hidden email]
Subject: Re: FW: Directionality plugin - getting Directionality analysis output values

Hi Jaqui,The Python script you point to should do the work. But you don't have to run it after running the plugin. The python script itself runs the plugin. It would be the base on which you could build something that would allow you to process the 2000 images in batch. The 2nd plugin on the wiki page will show you how to get the analysis results.You mention that you get errors. Would you care to copy/paste them here, with a description on how they occur? But first, try to run it as mention above.Bestjy



--
View this message in context: http://imagej.1557.x6.nabble.com/FW-Directionality-plugin-getting-Directionality-analysis-output-values-tp5011976p5011979.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

Re: FW: Directionality plugin - getting Directionality analysis output values

Kenton Arkill
It is not much help to the discussion:
I did get the same window manager error last time I used this (with the
python script) after about 8months of not using it. However I used the
plugin on a stack without the script and I was able to 'get at' the output
table which I was not able to do previously (hence I used to use the
script). It did the job at the time so I did not worry about it.
Kenton

On 17 March 2015 at 05:06, Jacqui Ross <[hidden email]> wrote:

> Thanks Jean-Yves,
>
> I tried running the first macro directly and got the errors listed below -
> something to do with defining the WindowManager..? Is there something else
> I need to install for this to work?
>
> Traceback (most recent call last):
>   File
> "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py",
> line 7, in <module>
>     dir.setImagePlus(WindowManager.getCurrentImage())
> NameError: name 'WindowManager' is not defined
>
>         at
> org.python.core.PyException.fillInStackTrace(PyException.java:70)
>         at java.lang.Throwable.<init>(Throwable.java:181)
>         at java.lang.Exception.<init>(Exception.java:29)
>         at java.lang.RuntimeException.<init>(RuntimeException.java:32)
>         at org.python.core.PyException.<init>(PyException.java:46)
>         at org.python.core.PyException.<init>(PyException.java:43)
>         at org.python.core.PyException.<init>(PyException.java:61)
>         at org.python.core.Py.NameError(Py.java:260)
>         at org.python.core.PyFrame.getname(PyFrame.java:257)
>         at
> org.python.pycode._pyx10.f$0(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py:35)
>         at
> org.python.pycode._pyx10.call_function(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py)
>         at org.python.core.PyTableCode.call(PyTableCode.java:165)
>         at org.python.core.PyCode.call(PyCode.java:18)
>         at org.python.core.Py.runCode(Py.java:1275)
>         at
> org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
>         at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
>         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:164)
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
>
> If you have any further suggestions, I'd be very grateful. I've downloaded
> your example images to use to test the macros.
>
> Thanks to Herbie also for sending me the links to some interesting papers.
>
> Kind regards,
>
> Jacqui
>
> Jacqueline Ross
> Biomedical Imaging Microscopist
> Biomedical Imaging Research Unit
> School of Medical Sciences
> Faculty of Medical & Health Sciences
> The University of Auckland
> Private Bag 92019
> Auckland 1142, NEW ZEALAND
>
> Tel: 64 9 923 7438
> Fax: 64 9 373 7484
>
> http://www.fmhs.auckland.ac.nz/sms/biru/
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Jean-Yves Tinevez
> Sent: Monday, 16 March 2015 9:29 p.m.
> To: [hidden email]
> Subject: Re: FW: Directionality plugin - getting Directionality analysis
> output values
>
> Hi Jaqui,The Python script you point to should do the work. But you don't
> have to run it after running the plugin. The python script itself runs the
> plugin. It would be the base on which you could build something that would
> allow you to process the 2000 images in batch. The 2nd plugin on the wiki
> page will show you how to get the analysis results.You mention that you get
> errors. Would you care to copy/paste them here, with a description on how
> they occur? But first, try to run it as mention above.Bestjy
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/FW-Directionality-plugin-getting-Directionality-analysis-output-values-tp5011976p5011979.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> 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
|

Re: FW: Directionality plugin - getting Directionality analysis output values

Gabriel Landini
In reply to this post by Jacqueline Ross
On Tuesday 17 Mar 2015 05:06:12 Jacqui Ross wrote:
> I tried running the first macro directly and got the errors listed below -
> something to do with defining the WindowManager..? Is there something else
> I need to install for this to work?

I bet this has to do with Python. Another .py script
(Find_Dimension_of_Raw_Image.py) in Fiji gives the same error. I forgot to
report it because I found in a txt file the dimensions of the raw image I was
dealing with :-)

Cheers

Gabriel

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

Re: FW: Directionality plugin - getting Directionality analysis output values

John Minter
In reply to this post by Jacqueline Ross
Jacqui,

Did you add "from ij import WindowManager" to the top of your python script?

The http://fiji.sc/Jython_Scripting page provides this reminder (that has
burned me more times than I care to admit...):

"Unlike ImageJ 1.x <http://fiji.sc/ImageJ_1.x>, ImageJ2
<http://fiji.sc/ImageJ2> (and therefore Fiji <http://fiji.sc/Fiji>) does
not automatically import any classes. Consequently, scripts written for ImageJ
1.x <http://fiji.sc/ImageJ_1.x> will not run in ImageJ2
<http://fiji.sc/ImageJ2> without adding the proper imports. "

Best regards,
John



On Tue, Mar 17, 2015 at 1:06 AM, Jacqui Ross <[hidden email]>
wrote:

> Thanks Jean-Yves,
>
> I tried running the first macro directly and got the errors listed below -
> something to do with defining the WindowManager..? Is there something else
> I need to install for this to work?
>
> Traceback (most recent call last):
>   File
> "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py",
> line 7, in <module>
>     dir.setImagePlus(WindowManager.getCurrentImage())
> NameError: name 'WindowManager' is not defined
>
>         at
> org.python.core.PyException.fillInStackTrace(PyException.java:70)
>         at java.lang.Throwable.<init>(Throwable.java:181)
>         at java.lang.Exception.<init>(Exception.java:29)
>         at java.lang.RuntimeException.<init>(RuntimeException.java:32)
>         at org.python.core.PyException.<init>(PyException.java:46)
>         at org.python.core.PyException.<init>(PyException.java:43)
>         at org.python.core.PyException.<init>(PyException.java:61)
>         at org.python.core.Py.NameError(Py.java:260)
>         at org.python.core.PyFrame.getname(PyFrame.java:257)
>         at
> org.python.pycode._pyx10.f$0(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py:35)
>         at
> org.python.pycode._pyx10.call_function(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py)
>         at org.python.core.PyTableCode.call(PyTableCode.java:165)
>         at org.python.core.PyCode.call(PyCode.java:18)
>         at org.python.core.Py.runCode(Py.java:1275)
>         at
> org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
>         at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
>         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:164)
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
>
> If you have any further suggestions, I'd be very grateful. I've downloaded
> your example images to use to test the macros.
>
> Thanks to Herbie also for sending me the links to some interesting papers.
>
> Kind regards,
>
> Jacqui
>
> Jacqueline Ross
> Biomedical Imaging Microscopist
> Biomedical Imaging Research Unit
> School of Medical Sciences
> Faculty of Medical & Health Sciences
> The University of Auckland
> Private Bag 92019
> Auckland 1142, NEW ZEALAND
>
> Tel: 64 9 923 7438
> Fax: 64 9 373 7484
>
> http://www.fmhs.auckland.ac.nz/sms/biru/
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Jean-Yves Tinevez
> Sent: Monday, 16 March 2015 9:29 p.m.
> To: [hidden email]
> Subject: Re: FW: Directionality plugin - getting Directionality analysis
> output values
>
> Hi Jaqui,The Python script you point to should do the work. But you don't
> have to run it after running the plugin. The python script itself runs the
> plugin. It would be the base on which you could build something that would
> allow you to process the 2000 images in batch. The 2nd plugin on the wiki
> page will show you how to get the analysis results.You mention that you get
> errors. Would you care to copy/paste them here, with a description on how
> they occur? But first, try to run it as mention above.Bestjy
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/FW-Directionality-plugin-getting-Directionality-analysis-output-values-tp5011976p5011979.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> 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
|

Re: FW: Directionality plugin - getting Directionality analysis output values

Jan Eglinger
Hi all,

you were right, the import statement was missing.
I added the missing imports to the example script on the Fiji/ImageJ wiki:
http://fiji.sc/Directionality#Getting_the_fit_parameters

Cheers,
Jan


Am 17.03.15 um 12:27 schrieb John Minter:

> Jacqui,
>
> Did you add "from ij import WindowManager" to the top of your python script?
>
> The http://fiji.sc/Jython_Scripting page provides this reminder (that has
> burned me more times than I care to admit...):
>
> "Unlike ImageJ 1.x <http://fiji.sc/ImageJ_1.x>, ImageJ2
> <http://fiji.sc/ImageJ2> (and therefore Fiji <http://fiji.sc/Fiji>) does
> not automatically import any classes. Consequently, scripts written for ImageJ
> 1.x <http://fiji.sc/ImageJ_1.x> will not run in ImageJ2
> <http://fiji.sc/ImageJ2> without adding the proper imports. "
>
> Best regards,
> John
>
>
>
> On Tue, Mar 17, 2015 at 1:06 AM, Jacqui Ross <[hidden email]>
> wrote:
>
>> Thanks Jean-Yves,
>>
>> I tried running the first macro directly and got the errors listed below -
>> something to do with defining the WindowManager..? Is there something else
>> I need to install for this to work?
>>
>> Traceback (most recent call last):
>>    File
>> "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py",
>> line 7, in <module>
>>      dir.setImagePlus(WindowManager.getCurrentImage())
>> NameError: name 'WindowManager' is not defined
>>
>>          at
>> org.python.core.PyException.fillInStackTrace(PyException.java:70)
>>          at java.lang.Throwable.<init>(Throwable.java:181)
>>          at java.lang.Exception.<init>(Exception.java:29)
>>          at java.lang.RuntimeException.<init>(RuntimeException.java:32)
>>          at org.python.core.PyException.<init>(PyException.java:46)
>>          at org.python.core.PyException.<init>(PyException.java:43)
>>          at org.python.core.PyException.<init>(PyException.java:61)
>>          at org.python.core.Py.NameError(Py.java:260)
>>          at org.python.core.PyFrame.getname(PyFrame.java:257)
>>          at
>> org.python.pycode._pyx10.f$0(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py:35)
>>          at
>> org.python.pycode._pyx10.call_function(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py)
>>          at org.python.core.PyTableCode.call(PyTableCode.java:165)
>>          at org.python.core.PyCode.call(PyCode.java:18)
>>          at org.python.core.Py.runCode(Py.java:1275)
>>          at
>> org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
>>          at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
>>          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:164)
>>          at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>>          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>          at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>          at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>          at java.lang.Thread.run(Thread.java:662)
>>
>> If you have any further suggestions, I'd be very grateful. I've downloaded
>> your example images to use to test the macros.
>>
>> Thanks to Herbie also for sending me the links to some interesting papers.
>>
>> Kind regards,
>>
>> Jacqui
>>
>> Jacqueline Ross
>> Biomedical Imaging Microscopist
>> Biomedical Imaging Research Unit
>> School of Medical Sciences
>> Faculty of Medical & Health Sciences
>> The University of Auckland
>> Private Bag 92019
>> Auckland 1142, NEW ZEALAND
>>
>> Tel: 64 9 923 7438
>> Fax: 64 9 373 7484
>>
>> http://www.fmhs.auckland.ac.nz/sms/biru/
>>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>> Jean-Yves Tinevez
>> Sent: Monday, 16 March 2015 9:29 p.m.
>> To: [hidden email]
>> Subject: Re: FW: Directionality plugin - getting Directionality analysis
>> output values
>>
>> Hi Jaqui,The Python script you point to should do the work. But you don't
>> have to run it after running the plugin. The python script itself runs the
>> plugin. It would be the base on which you could build something that would
>> allow you to process the 2000 images in batch. The 2nd plugin on the wiki
>> page will show you how to get the analysis results.You mention that you get
>> errors. Would you care to copy/paste them here, with a description on how
>> they occur? But first, try to run it as mention above.Bestjy
>>

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

Re: FW: Directionality plugin - getting Directionality analysis output values

Jacqueline Ross
Hi Jan and John,

Thanks very much for your assistance with the macro and for the explanation of what was going wrong. The macro for the fit parameters is all working well now so I'm very happy. (Thanks to Kenton and Gabriel who confirmed that they also had problems with it as that made me feel a bit better about not being able to work it out myself).

However, I have one further question sorry. The macro above that one, under General Scripting, is also working OK  except for the Orientation map. I don't necessarily need it but it would be good if I could get that macro to work too. It seems to be a similar error related to ImagePlus. If I take the lines out which relate to the orientation map, it all works fine.

The error I get is as follows;

Started Directionality_standard_.py at Wed Mar 18 17:45:47 NZDT 2015
Traceback (most recent call last):
  File "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py", line 35, in <module>
    ImagePlus("Orientation map", stack).show()
NameError: name 'ImagePlus' is not defined

        at org.python.core.PyException.fillInStackTrace(PyException.java:70)
        at java.lang.Throwable.<init>(Throwable.java:181)
        at java.lang.Exception.<init>(Exception.java:29)
        at java.lang.RuntimeException.<init>(RuntimeException.java:32)
        at org.python.core.PyException.<init>(PyException.java:46)
        at org.python.core.PyException.<init>(PyException.java:43)
        at org.python.core.PyException.<init>(PyException.java:61)
        at org.python.core.Py.NameError(Py.java:260)
        at org.python.core.PyFrame.getname(PyFrame.java:257)
        at org.python.pycode._pyx7.f$0(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py:38)
        at org.python.pycode._pyx7.call_function(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1275)
        at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
        at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
        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:164)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

Thanks!

Kind regards,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit 
School of Medical Sciences 
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jan Eglinger
Sent: Wednesday, 18 March 2015 10:10 a.m.
To: [hidden email]
Subject: Re: FW: Directionality plugin - getting Directionality analysis output values

Hi all,

you were right, the import statement was missing.
I added the missing imports to the example script on the Fiji/ImageJ wiki:
http://fiji.sc/Directionality#Getting_the_fit_parameters

Cheers,
Jan


Am 17.03.15 um 12:27 schrieb John Minter:

> Jacqui,
>
> Did you add "from ij import WindowManager" to the top of your python script?
>
> The http://fiji.sc/Jython_Scripting page provides this reminder (that
> has burned me more times than I care to admit...):
>
> "Unlike ImageJ 1.x <http://fiji.sc/ImageJ_1.x>, ImageJ2
> <http://fiji.sc/ImageJ2> (and therefore Fiji <http://fiji.sc/Fiji>)
> does not automatically import any classes. Consequently, scripts
> written for ImageJ 1.x <http://fiji.sc/ImageJ_1.x> will not run in
> ImageJ2 <http://fiji.sc/ImageJ2> without adding the proper imports. "
>
> Best regards,
> John
>
>
>
> On Tue, Mar 17, 2015 at 1:06 AM, Jacqui Ross
> <[hidden email]>
> wrote:
>
>> Thanks Jean-Yves,
>>
>> I tried running the first macro directly and got the errors listed
>> below - something to do with defining the WindowManager..? Is there
>> something else I need to install for this to work?
>>
>> Traceback (most recent call last):
>>    File
>> "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py
>> ",
>> line 7, in <module>
>>      dir.setImagePlus(WindowManager.getCurrentImage())
>> NameError: name 'WindowManager' is not defined
>>
>>          at
>> org.python.core.PyException.fillInStackTrace(PyException.java:70)
>>          at java.lang.Throwable.<init>(Throwable.java:181)
>>          at java.lang.Exception.<init>(Exception.java:29)
>>          at java.lang.RuntimeException.<init>(RuntimeException.java:32)
>>          at org.python.core.PyException.<init>(PyException.java:46)
>>          at org.python.core.PyException.<init>(PyException.java:43)
>>          at org.python.core.PyException.<init>(PyException.java:61)
>>          at org.python.core.Py.NameError(Py.java:260)
>>          at org.python.core.PyFrame.getname(PyFrame.java:257)
>>          at
>> org.python.pycode._pyx10.f$0(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py:35)
>>          at
>> org.python.pycode._pyx10.call_function(C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py)
>>          at org.python.core.PyTableCode.call(PyTableCode.java:165)
>>          at org.python.core.PyCode.call(PyCode.java:18)
>>          at org.python.core.Py.runCode(Py.java:1275)
>>          at
>> org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
>>          at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
>>          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:164)
>>          at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>>          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>          at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>          at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>          at java.lang.Thread.run(Thread.java:662)
>>
>> If you have any further suggestions, I'd be very grateful. I've
>> downloaded your example images to use to test the macros.
>>
>> Thanks to Herbie also for sending me the links to some interesting papers.
>>
>> Kind regards,
>>
>> Jacqui
>>
>> Jacqueline Ross
>> Biomedical Imaging Microscopist
>> Biomedical Imaging Research Unit
>> School of Medical Sciences
>> Faculty of Medical & Health Sciences
>> The University of Auckland
>> Private Bag 92019
>> Auckland 1142, NEW ZEALAND
>>
>> Tel: 64 9 923 7438
>> Fax: 64 9 373 7484
>>
>> http://www.fmhs.auckland.ac.nz/sms/biru/
>>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>> Jean-Yves Tinevez
>> Sent: Monday, 16 March 2015 9:29 p.m.
>> To: [hidden email]
>> Subject: Re: FW: Directionality plugin - getting Directionality
>> analysis output values
>>
>> Hi Jaqui,The Python script you point to should do the work. But you
>> don't have to run it after running the plugin. The python script
>> itself runs the plugin. It would be the base on which you could build
>> something that would allow you to process the 2000 images in batch.
>> The 2nd plugin on the wiki page will show you how to get the analysis
>> results.You mention that you get errors. Would you care to copy/paste
>> them here, with a description on how they occur? But first, try to
>> run it as mention above.Bestjy
>>

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

Re: FW: Directionality plugin - getting Directionality analysis output values

Jean-Yves Tinevez
In reply to this post by Jan Eglinger
Thanks Jan!
I guess that previously the ij.* imports where done on the fly when you launched the script editor, and that now, no.
Thanks for fixing this.
Reply | Threaded
Open this post in threaded view
|

Re: FW: Directionality plugin - getting Directionality analysis output values

John Minter
In reply to this post by Jacqueline Ross
Hi Jacqui,

It is that same "bug" , er, "feature". You need to import every class you
use in Jython. I find the Java Doc really helpful here (see
http://rsb.info.nih.gov/ij/developer/api/index.html). All the classes are
listed in the left hand pane. You will see that the ImagePlus class is
ij.ImagePlus. Since you had already put "from ij import WindowManager" in
the script, you can just change the line to "from ij import WindowManager,
ImagePlus".

Below are some common imports I use. Hope these save you some time on
Google....

# If I want utf8
from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')

# common python imports
# you would then use sys.theFunction(args)
import sys
import os
import glob
import shutil
import time
import math
import csv
from math import sqrt

from colorsys import hsv_to_rgb
from java.awt import Color

# another shorthand. You would use jio.theFunction(args)
import java.io as jio
import java.lang as jl
import java.util as ju

import jarray

from ij import IJ, ImagePlus, WindowManager, Prefs, ImageStack

from ij.io import FileInfo

from ij.gui import Roi, TextRoi, ImageRoi, Overlay, ImageCanvas, ShapeRoi,
PointRoi

from ij.measure import ResultsTable, Calibration, Measurements
from ij.plugin import ImageCalculator, Duplicator, ChannelSplitter
from ij.plugin import MontageMaker
from ij.plugin.filter import ParticleAnalyzer
from ij.plugin.frame import RoiManager

from ij.process import LUT, ImageProcessor, StackProcessor

Best Regards,
John


On Wed, Mar 18, 2015 at 12:52 AM, Jacqui Ross <[hidden email]>
wrote:

> Hi Jan and John,
>
> Thanks very much for your assistance with the macro and for the
> explanation of what was going wrong. The macro for the fit parameters is
> all working well now so I'm very happy. (Thanks to Kenton and Gabriel who
> confirmed that they also had problems with it as that made me feel a bit
> better about not being able to work it out myself).
>
> However, I have one further question sorry. The macro above that one,
> under General Scripting, is also working OK  except for the Orientation
> map. I don't necessarily need it but it would be good if I could get that
> macro to work too. It seems to be a similar error related to ImagePlus. If
> I take the lines out which relate to the orientation map, it all works fine.
>
> The error I get is as follows;
>
> Started Directionality_standard_.py at Wed Mar 18 17:45:47 NZDT 2015
> Traceback (most recent call last):
>   File
> "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py",
> line 35, in <module>
>     ImagePlus("Orientation map", stack).show()
> NameError: name 'ImagePlus' is not defined
>
>
> (more listing deleted...)
>

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

Re: FW: Directionality plugin - getting Directionality analysis output values

Jacqueline Ross
Hi John,

Thanks very much for this information and for the code below. I'll check out the Java Doc. My next step is to try running this macro over a folder of image stacks...

I'm starting to think I might be wise to do a Stage 1 programming course!

Kind regards,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit 
School of Medical Sciences 
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of John Minter
Sent: Thursday, 19 March 2015 12:05 p.m.
To: [hidden email]
Subject: Re: FW: Directionality plugin - getting Directionality analysis output values

Hi Jacqui,

It is that same "bug" , er, "feature". You need to import every class you use in Jython. I find the Java Doc really helpful here (see http://rsb.info.nih.gov/ij/developer/api/index.html). All the classes are listed in the left hand pane. You will see that the ImagePlus class is ij.ImagePlus. Since you had already put "from ij import WindowManager" in the script, you can just change the line to "from ij import WindowManager, ImagePlus".

Below are some common imports I use. Hope these save you some time on Google....

# If I want utf8
from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')

# common python imports
# you would then use sys.theFunction(args) import sys import os import glob import shutil import time import math import csv from math import sqrt

from colorsys import hsv_to_rgb
from java.awt import Color

# another shorthand. You would use jio.theFunction(args) import java.io as jio import java.lang as jl import java.util as ju

import jarray

from ij import IJ, ImagePlus, WindowManager, Prefs, ImageStack

from ij.io import FileInfo

from ij.gui import Roi, TextRoi, ImageRoi, Overlay, ImageCanvas, ShapeRoi, PointRoi

from ij.measure import ResultsTable, Calibration, Measurements from ij.plugin import ImageCalculator, Duplicator, ChannelSplitter from ij.plugin import MontageMaker from ij.plugin.filter import ParticleAnalyzer from ij.plugin.frame import RoiManager

from ij.process import LUT, ImageProcessor, StackProcessor

Best Regards,
John


On Wed, Mar 18, 2015 at 12:52 AM, Jacqui Ross <[hidden email]>
wrote:

> Hi Jan and John,
>
> Thanks very much for your assistance with the macro and for the
> explanation of what was going wrong. The macro for the fit parameters
> is all working well now so I'm very happy. (Thanks to Kenton and
> Gabriel who confirmed that they also had problems with it as that made
> me feel a bit better about not being able to work it out myself).
>
> However, I have one further question sorry. The macro above that one,
> under General Scripting, is also working OK  except for the
> Orientation map. I don't necessarily need it but it would be good if I
> could get that macro to work too. It seems to be a similar error
> related to ImagePlus. If I take the lines out which relate to the orientation map, it all works fine.
>
> The error I get is as follows;
>
> Started Directionality_standard_.py at Wed Mar 18 17:45:47 NZDT 2015
> Traceback (most recent call last):
>   File
> "C:\Users\jros013\Desktop\Fiji.app\macros\Directionality_standard_.py"
> ,
> line 35, in <module>
>     ImagePlus("Orientation map", stack).show()
> NameError: name 'ImagePlus' is not defined
>
>
> (more listing deleted...)
>

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

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