Posted by
Brandon Hurr on
Jun 20, 2018; 3:55pm
URL: http://imagej.273.s1.nabble.com/Writing-ImageJ-Macros-a-better-way-tp5020818p5020821.html
Alex,
I'm very much in a similar boat to you. I'm skilled in R and can manage in
python and C when I have to, but Java is hard for me for some reason. I
typically write macros in the GUI editor in FIJI and I'm on a mac. My
macros have increased in complexity and have become much more difficult to
manage in recent years.
The syntax highlighting in FIJI's editor is the best I've used so far. Most
front end's don't seem to know what to do with ImageJ script, but they have
better tools for refactoring. Secondarily, I've used textWrangler/BBedit
with the module mentioned here:
http://imagej.1557.x6.nabble.com/BBEdit-language-module-for-ImageJ-macros-td3686081.htmlIt works pretty well and is easier on the eyes than FIJIs editor.
Advice will vary a lot as each person works best in their own way, but one
way that has helped me loads is to functionalize things as much as
possible. If you have a piece of code that runs in many places, make a
function out of it and use it instead. This abstracts pieces away from the
core code and allows you to focus more on the flow of things. Then when you
get a problem you can more easily focus on that piece. I used to have
scripts that were 1500 lines long. Now the core loops and functions are
more like 200 lines and the functions that run within that core are the
other 1300 lines. You could even tear those pieces out into other scripts
(functions script) or rewrite in Java for speed if you need it and can do
that.
I also know that FIJI can use python, javascript and other languages to run
the core functions, but the documentation around this is not nearly as good
as the imagej scripting language docs and examples that are on the
internet. At least the last time I looked, which admittedly was a while
ago.
HTH,
Brandon
On Tue, Jun 19, 2018 at 3:33 PM Alex <
[hidden email]> wrote:
> All,
>
> I know there's lots of information on the web but it seems very scattered
> and unclear what's considered "best practice."
> I've been writing ImageJ macros for some time using the ImageJ Macro
> language and the built in script editor. Obviously this has it's
> limitations. The scope of the Macro Language itself isn't really a problem
> but some of my macros have become so complex that debugging and changing
> them is very difficult.
>
> I'm pretty handy at Python, R, and C but don't have any experience with
> Java. Also, I'm working on MacOS.
> I've tired the Eclipse ImageJ plugin (
>
https://github.com/Bio7/EclipseImageJ1Plugin) but it leaves a lot to be
> desired as it's very clunky and still only seems to show variables and
> their values in ImageJ itself.
>
> What would you consider the best way to write ImageJ macros in an IDE that
> offers real debugging functionality? What's the best step-by-step resource
> for learning out more advanced ImageJ macro programming techniques?
> ThanksAlex
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html