1

I’m trying to install a Python script in ImageJ. My preference is to use the script with ImageJ 1.x but can use Fiji if required. 

I am trying to use the script with ImageJ 1.x by placing it in the plugins folder.  The script appears in the plugins menu but when I try to run it I get an error that it can't find __future__

Traceback (most recent call last): 
File "<string>", line 1, in <module> 
ImportError: No module named __future__

  This makes no sense to me as the __future__ module is being used to import the with_statement module and python version is listed as :

2.5.4rc1 (2.5:723492dbab02, Feb 8 2013, 10:13:55) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]

from __future__ import with_statement is specifically designed for use with Python versions 2.5.x

https://docs.python.org/3/library/future.html

So ... moving on ...

I tired to use Fiji instead since it is based on ImageJ2. 

I'm able to paste the code into the Script Editor using File > New > Script ...

The code runs when executed from there.  However, when saved I can't get it to show up in the plugins menu.  I've tried saving it to :

Fiji/plugins

Fiji/plugins/Scripts

Fiji/plugins/Scripts/Plugins

The file name has an _ in it.

The version of Fiji I'm running is ImageJ 2.0.0 rc-68/1.52e / Java1.8.0_172 (64-bit)

The version of ImageJ 1.x I'm running is ImageJ 1.52e / Java1.8.0_172 (64-bit)

Any help would be greatly appreciated.

Thanks

2 Answers 2

2

The canonical place to put scripts for ImageJ2 is scripts/Foo/Bar/My_Script.py, if you want it located in the menu at Foo > Bar > My Script.

It also works for backwards compatibility to use plugins or plugins/Scripts. However, there was recently a critical bug preventing scripts from appearing in the plugins-based locations; see this thread. The bug is fixed in the latest release.

Sign up to request clarification or add additional context in comments.

2 Comments

This worked! However, where exactly is this documented?
0

you might want to have a look here on the ij-wiki. Also, there ij2 has its own, very active forum where this topic is also activeley discussed.

Best,

Felix

2 Comments

Posted to the imagej email listserv. No response.
@agf1997 When posting the same question to multiple places, please disclose and cross-link, so that people can keep track of the discussion and avoid duplication of effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.