Posted by
ctrueden on
Aug 23, 2017; 3:07am
URL: http://imagej.273.s1.nabble.com/Using-JSON-files-in-Macros-tp5019247p5019250.html
Hi Rob,
Have you considered using a full-featured scripting language such as
JavaScript, Groovy, etc.? Then you would not have to work around
limitations of the ImageJ macro language. For details, see this page:
https://imagej.net/Scripting> I would like to use a JSON file for storing settings/parameter for a
> macro.
It could also help move the discussion forward if you can describe _why_
you want to do this. What are you trying to accomplish?
Regards,
Curtis
--
Curtis Rueden
LOCI software architect -
https://loci.wisc.edu/softwareImageJ2 lead, Fiji maintainer -
https://imagej.net/User:RuedenDid you know ImageJ has a forum?
http://forum.imagej.net/On Tue, Aug 22, 2017 at 2:00 AM, Kirmse, Robert <
[hidden email]>
wrote:
> Dear ImageJ List,
> I have a question regarding the use of JSON files.
>
> I would like to use a JSON file for storing settings/parameter for a macro.
> However I am not sure how to use the variable in the actual macro once I
> read it.
>
> So the way I tried to set it up is the following
>
>
> javascript file that reads the JSON with.
>
> ...
> function read JSON() {
> var settings = JSON.parse(IJ.openAsString("pathToFile\\inputs.json"));
> "some more code"
> return(settings)
> }
>
> --------------------
> and then my actual IJM file
> "some code"
>
> javacode = File.openAsString("pathToFile\\JSON_Read2.js");
> settings= eval("script",javacode);
>
>
> that only give the message "object array" in the log file, when I try to
> access settings.
> I tried storing the retrieved JSON content in different variables that i
> tried to return but was not successfull.
>
> I am wondering if there is an elegant way to actually get the JSON content
> and make them
> available for the imageJ macro.
>
> Thank you in advance for any hints
>
> Best
> Rob
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html