Alternative script editor for imageJ macros - what is atom-imagej-mode?

Relatively newish to scripts etc. Was wondering if there is an alternative script editor to the built in one in imageJ. I found atom-imagej-mode, but am not quite sure if this is what I am looking for.

Is the point of this package to enable me to write imageJ scripts within atom, and execute them from there…?

Also, is there any other documentation on how to use it, as all I find is this: https://atom.io/packages/atom-imagej-mode

1 Like

Hey @samuelorion,

have you tried the script editor in Fiji?

Cheers,
Robert

1 Like

Hi Robert,

Yes, thanks. Just find it a little clunky and less easy on the eyes…

Thank you

You might also try the Eclipse ImageJ macro editor plugin. It is integrated into Bio7 but also available as a separate plugin for Eclipse and updated frequently, see:

Features:

  • Dynamic grammar detection with visible error markers in the editor
  • Toolbar action to execute ImageJ macros
  • Syntax highlightening
  • Debugging support (with Graphical User Interface, Breakpoints and Conditional Breakpoints)
  • Code completion (variables selectable with tab key - browser help available)
  • Default code templates for the ImageJ macro API
  • Code completion for self defined variables and functions
  • Code template editor (add you own templates with selectable vars)
  • Info popups (text hoover)
  • Outline view (‘var’ variables, variables, methods and macros)
  • Automatic closing of braces, parentheses and strings, automatic indention of functions,loops, etc.
  • Editor code folding
  • Code formatting (all or selected code blocks)
  • Resizing of fonts (with Ctrl++ or CMD++, CTRL± or CMD ±)
  • Multiple cursor selections to refactor variables and method names
  • Font preferences
  • Graphical File, Folder and Color Dialogs to select and add easily paths and colors to the macro code
  • Mark occurences (scope independant)
  • A copy function for this forum
  • Default Eclipse editor functions (Split View, Minimap, Block selections, etc.)

Forum post with examples:

Hello.

I wrote atom-imagej-mode. I was heavily motivated by the fact that script editor doesn’t have flexible keybindings (I’m an emacs user), and I do believe that this is a job that atom is quite good at. Folks have done a great job with the script editor, but I personally think it isn’t the right choice for the image analysis community to take on the job of maintaining a code editing tool when so many already exist and can now fairly easily be adapted and integrated into other tools.

Yes, the point is that you can write ImageJ scripts in Atom. If you follow the instructions on the link you reference (https://atom.io/packages/atom-imagej-mode) then it should work for you.

The way I (and folks in my lab) have been using it is:

  1. follow the installation instructions
  2. launch Fiji/ImageJ from atom using the “Launch ImageJ” command
  3. Write your script, and when you want to evaluate it with “Run ImageJ script”
    You get the same effect as using script editor with Run.

Script editor has had some extra features added since then, and some of them can certainly be ported to atom-imagej-mode.

Cheers,
Kyle

1 Like

Thank you all for your input!

Hi Kyle,
I’d love to use it. Looks good. However, I have a simple (I imagine) problem.

I tried following those instructions and come across the following error message once I have launched

Module threw exception
java.lang.IllegalArgumentException: Unknown language: /Users/SamuelOrion/Desktop/test_atomiamgejmode
at net.imagej.server.external.ScriptEval.run(ScriptEval.java:73)
at org.scijava.command.CommandModule.run(CommandModule.java:199)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
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)
127.0.0.1 - - [13/Apr/2020:18:18:13 +0000] “POST /modules/command:net.imagej.server.external.ScriptEval?process=false HTTP/1.1” 400 45 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Atom/1.45.0 Chrome/69.0.3497.128 Electron/4.2.7 Safari/537.36” 201

The ImageJ script evaluator uses filename’s extension to detect the language, and it appears as though your filename doesn’t have one. If that is an ImageJ macro script then add .ijm to your filename and try again.

I’ll still track this issue here https://github.com/kephale/atom-imagej-mode/issues/3
because it would be nice if there was a warning that informed you when your filename does not have an extension.

1 Like

Awesome, that worked straight away! Thank you.

1 Like