demisjohn / Microscope-Measurement-Tools

Microscope Measurement/Calibration plugin for FIJI
15 stars 7 forks source link

DrawMeas-Line: Broken on MacOS FIJI #17

Open demisjohn opened 2 years ago

demisjohn commented 2 years ago

When I tried to run "Draw Measurement - Line", it didn't work with the following error

Can't find the Settings file for some reason? Error message looks like it's looking for the right name, and the file appears to be in the correct location and named correctly:

[ERROR] Traceback (most recent call last):
  File "Analyze/Microscope Measurement Tools/Draw_Measurement_-_Line.py", line 38, in <module>
ImportError: No module named Microscope_Calibrations_user_settings

    at org.python.core.Py.ImportError(Py.java:329)
    at org.python.core.imp.import_first(imp.java:1230)
    at org.python.core.imp.import_module_level(imp.java:1361)
    at org.python.core.imp.importName(imp.java:1528)
    at org.python.core.ImportFunction.__call__(__builtin__.java:1285)
    at org.python.core.PyObject.__call__(PyObject.java:433)
    at org.python.core.__builtin__.__import__(__builtin__.java:1232)
    at org.python.core.imp.importOneAs(imp.java:1564)
    at org.python.pycode._pyx2.f$0(Analyze/Microscope Measurement Tools/Draw_Measurement_-_Line.py:276)
    at org.python.pycode._pyx2.call_function(Analyze/Microscope Measurement Tools/Draw_Measurement_-_Line.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:173)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.Py.runCode(Py.java:1687)
    at org.python.core.__builtin__.eval(__builtin__.java:497)
    at org.python.core.__builtin__.eval(__builtin__.java:501)
    at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:255)
    at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
    at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
    at org.scijava.script.ScriptModule.run(ScriptModule.java:157)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:163)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
demisjohn commented 2 years ago

Maybe needs a "." before the module name? eg. import Microscope_Calibrations_user_settings as sets to import .Microscope_Calibrations_user_settings as sets

Choose Calibration.py is probably also broken. Maybe FIJI updated itself to a newer python version? Not sure what broke this.

Elaniobro commented 1 year ago

I came here to ask if this is an issue on MacOS or a change in ImageJ. Imports appear to be working with Fiji (ImageJ2) 2.3.0/1.52v build d544a3f481 as of 2021-09-13.

On my new MacOS M2, I downloaded Fiji (imagej2) 2.14.0/1.54f build c89e8500e4 as of 2023-07-07 and no dice. Reading the docs, seems like python is not listed anymore, or at least, when I click it, it takes my to jython or uses pyimagej.

Have you had any success?

demisjohn commented 1 year ago

As far as I can tell, FIJI and ImageJ still support Python. The changelog on nih.gov doesn't show any obvious python upgrade that would have broken our plugin (at least with a quick page search for "python" and "jython"). I believe technically this plugin is written in "jython" - I honestly don't know the difference between Jython and Python, it has basically worked as expected when I made this plugin.

I suspect this error is basically a "search path" issue - for some reason FIJI has changed where it searches for scripts, so my Installation instructions may need to be upgrades. For example maybe we need to put the scripts in a different folder... just guessing here.

If you have the time, can you look up instructions for manually installing a Jython plugin?

One workaround - which is NOT ideal - is to put the settings directly into the main plugin script. This would be prone to breakage of the entire script - but if you really need it working, that's one way to make it work.