Posted by
John Minter on
Mar 18, 2015; 11:05pm
URL: http://imagej.273.s1.nabble.com/FW-Directionality-plugin-getting-Directionality-analysis-output-values-tp5011976p5012052.html
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