http://imagej.273.s1.nabble.com/Writing-ImageJ-Macros-a-better-way-tp5020818p5020834.html
The script parameters are SciJava's extension to the script languages. In
framework, not via the respective script language's usual launch mechanism.
temporary block at the top, while developing in your IDE.
# TEMP - Populate parameter values for testing.
And then hack to your heart's content, including use of the IDE's debugger.
When finished, delete those extra lines.
>
> Curtis,
> This some really seems to be the winner :
http://forum.imagej.net/t/impo> rt-python-packages-in-pycharm/3540/4
> I think I've basically got it working in IntelliJ. I followed the
> instructions here :
https://github.com/qupath/qupa> th/wiki/Advanced-scripting-with-IntelliJ#setting-up-
> intellij-idea-with-qupath but exchanged the path to QuPath.jar for the
> path to IJ.jar.
> The one thing that it doesn't seem to recognize is the Script Parameters.
> I can always use the GenericDialog class, but it would be nice to have
> Script Parameter capability. Using the GenericDialog class I'm able to
> launch GUI elements from within IntelliJ, so I know GUI capabilities are
> there.
>
> Any thoughts on why Script Parameters might not be working? I'll be sure
> to wiki this up once I have a more solid understanding of what's going on.
>
> Alex
> On Wednesday, June 20, 2018, 5:53:38 PM PDT, Curtis Rueden <
>
[hidden email]> wrote:
>
> Hi Alex,
>
> Maybe these threads are helpful?
>
> -
>
http://forum.imagej.net/t/writing-and-running-ij-scripts-in-> jython-externally/8843/3
> -
http://forum.imagej.net/t/import-python-packages-in-pycharm/3540/4>
> A guide to developing ImageJ code with PyCharm would be a welcome
> contribution to the ImageJ wiki.
>
> We also have experimental support for calling ImageJ from Python, so that
> you can use ImageJ e.g. from a Jupyter notebook with Python kernel. More
> documentation and example notebooks coming soon, but for now, you can take
> a look at
https://github.com/imagej/imagej.py#usage>
> Regards,
> Curtis
>
> --
> Curtis Rueden
> LOCI software architect -
https://loci.wisc.edu/software> ImageJ2 lead, Fiji maintainer -
https://imagej.net/User:Rueden> Did you know ImageJ has a forum?
http://forum.imagej.net/>
>
> On Wed, Jun 20, 2018 at 7:14 PM, Alex <
>
[hidden email]> wrote:
>
> > Curtis
> > Thanks so much for your support and for your development efforts. I know
> > what it’s like to develop be the sole maintainer for open source
> projects.
> >
> > >In general, if you want better development >tools, then I strongly
> > encourage
> > >you to use a script language other than >ImageJ macro.
> > I’m happy to move to Python me to develop Python based imagej scripts
> with
> > a real IDE (preferably pycharm) with debugger full support?
> > Thanks so much
> > Alex
> >
> > Sent from Yahoo Mail for iPhone
> >
> >
> > On Wednesday, June 20, 2018, 4:38 PM, Curtis Rueden <
> >
[hidden email]> wrote:
> >
> > Hi Alex,
> >
> > > Does anyone know why the screenshots on this page show a "Breakpoints"
> > > menu in the Fiji Script Editor that doesn't appear to be in the
> > > software?
> >
> > The debugger/breakpoint support was never completed, and removed in 2012.
> >
https://github.com/scijava/script-editor/commit/> > 87e05e3108d42c6276e786ba5d850c3d831de85c
> >
> > > Would be nice if we didn't have to resort to such trickery.
> >
> > See this issue:
> >
https://github.com/scijava/script-editor/issues/5> >
> > As I wrote there:
> >
> > > Unfortunately, I have too many other urgent priorities to work on the
> > > Script Editor right now, and there is unfortunately no one else taking
> > > care of this component besides me. However, if you or your group have
> > > any programming resources/capabilities which can be directed toward
> > > this mini-project, I would be delighted to provide guidance and
> > > support toward getting the feature implemented. Otherwise, I will get
> > > to it eventually, since this is a feature which I agree would be
> > > really useful—it's just going to be a few months at least if it falls
> > > on me personally to do it.
> >
> > In general, if you want better development tools, then I strongly
> encourage
> > you to use a script language other than ImageJ macro. The macro language
> is
> > a custom language that does not have any tooling support outside of
> ImageJ,
> > whereas the other script languages have a much broader base of community
> > support beyond ImageJ only. My personal favorite is Groovy. For a list of
> > available languages and brief summary of strengths and weaknesses, see
> >
http://imagej.net/Scripting#Supported_languages> >
> > Regards,
> > Curtis
> >
> > --
> > Curtis Rueden
> > LOCI software architect -
https://loci.wisc.edu/software> > ImageJ2 lead, Fiji maintainer -
https://imagej.net/User:Rueden> > Did you know ImageJ has a forum?
http://forum.imagej.net/> >
> >
> > On Wed, Jun 20, 2018 at 6:06 PM, Alex <00000313423ff55b-dmarc-
> >
[hidden email]> wrote:
> >
> > >
> > > Thanks Bram ... slick workaround. Would be nice if we didn't have to
> > > resort to such trickery.
> > > Does anyone know why the screenshots on this page show a "Breakpoints"
> > > menu in the Fiji Script Editor that doesn't appear to be in the
> software?
> > >
https://imagej.net/Using_the_Script_Editor> > >
> > > Alex
> > >
> > >
> > >
> > > On Wednesday, June 20, 2018, 3:15:39 PM PDT, Bram van den Broek <
> > >
[hidden email]> wrote:
> > >
> > > Hi Alex,
> > >
> > > Not sure if this is any help, but I tend to put 'waitForUser'
> statements
> > > at certain points in the code to check what's going on (or wrong).
> After
> > > many years of manual typing and deleting, I've only just made this
> into a
> > > function. Something like the code below. You can quickly disable the
> > > checkpoints by setting debug_mode to false.
> > >
> > > --------------------------------------------
> > > debug_mode = true;
> > > n=1;
> > >
> > > // code
> > > checkpoint("before filter");
> > > // more code
> > > checkpoint("after filter");
> > > // more code
> > > checkpoint("");
> > > // more code
> > >
> > > function checkpoint(message) {
> > > if(debug_mode==true) {
> > > setBatchMode("show"); //If you run your macro in Batch mode.
> > > print("Checkpoint "+n+" reached");
> > > waitForUser("Checkpoint "+n+": "+message);
> > > setBatchMode("hide"); //If you run your macro in Batch mode.
> > > n++;
> > > }
> > > }
> > > ------------------------------------------
> > >
> > > Best regards,
> > > Bram
> > >
> > > ------
> > > Bram van den Broek
> > > Advanced Microscopy and Image Analysis
> > > BioImaging Facility / Cell Biology
> > > The Netherlands Cancer Institute
> > >
> > >
> > >
> > >
> > >
> > > ________________________________________
> > > From: Alex <
[hidden email]>
> > > Sent: Wednesday, June 20, 2018 7:32 PM
> > > To:
[hidden email]
> > > Subject: Re: Writing ImageJ Macros a better way
> > >
> > > Brandon,
> > >
> > > Thanks ... I found a bbedit language module a while back so I've been
> > able
> > > to look at the code with syntax highlighting. The biggest issue I can
> > see
> > > with the Fiji Editor is that there's no debugger. The only way I could
> > > figure out how to debug was to copy the code back into the main ImageJ
> > > macro editor.
> > >
> > > I guess the one thing I'm looking for is some way to debug macros with
> an
> > > editor that provides real stop, step, step into, etc functionality.
> The
> > > macro editor's "run to insertion point" is a really clumsy way to do
> > > stops. When you've got lots of loops and sub-functions it really
> doesn't
> > > work well at all.
> > >
> > > Is there something I'm missing about the Fiji Editor?
> > > ThanksAlex
> > >
> > > On Wednesday, June 20, 2018, 8:55:59 AM PDT, Brandon Hurr <
> > >
[hidden email]> wrote:
> > >
> > > 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.html
> > > It 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> > >
> > >
> > > --
> > > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> > >
> > > --
> > > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> > >
> > > --
> > > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> > >
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >
> >
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>