Login  Register

Re: array in macro functions

Posted by Csaba DÁVID on Feb 16, 2018; 9:31am
URL: http://imagej.273.s1.nabble.com/array-in-macro-functions-tp5020111p5020115.html

Dear Jan,thank you for your advice. I was afraid that I have to learn another language. But it is probably not possible to learn Java in a week :(
ThanksCsaba
 

    On Friday, February 16, 2018 10:25 AM, Jan Eglinger <[hidden email]> wrote:
 

 Dear Csaba,

I recommend to switch to some of the more powerful scripting languages
[1], e.g. Groovy, Javascript, Beanshell or Jython.
They provide syntactic constructs (such as list comprehensions) that
facilitate this kind of task. In addition, you have full access to the
underlying Java API [2] to create your Roi objects.

Cheers
Jan

[1]: https://imagej.net/Scripting#Supported_languages
[2]: http://javadoc.scijava.org/ImageJ1/index.html?overview-summary.html

On 16.02.2018 10:09, Csaba DÁVID wrote:

> Dear Kees,this is exactly what I wanted to avoid, since each of the polygons have different number of points, so I cannot express them in a general format. Is there any tricky way? Maybe?Best regardsCsaba
>
>      On Friday, February 16, 2018 9:55 AM, "Straatman, Kees (Dr.)" <[hidden email]> wrote:

>
>  Dear Csaba,
>
> You need something like:
>
> coord = newArray(20,48,59,13,101,40,75,77,38,70);
> makePolygon(coord[0],coord[1],coord[2],coord[3],coord[4],coord[5],coord[6],coord[7],coord[8],coord[9]);
>
> I guess it depends a little how many sides your polygons will have how to implement this.
>
> Best wishes
>
> Kees
>
>
> Dr Ir K.R. Straatman
> Senior Experimental Officer
> Advanced Imaging Facility
> Centre for Core Biotechnology Services
> University of Leicester
> www.le.ac.uk/advanced-imaging-facility
>
>
>
> -----Original Message-----
> From: Csaba DÁVID [mailto:[hidden email]]
> Sent: 15 February 2018 20:28
> To: [hidden email]
> Subject: array in macro functions
>
> Hi,i have coordinates of hundreds of irregularly shaped polygons that i want to draw on a single image. I do not have the polygons as ROIs, unfortunately. I want to usea list of coordinates from another software. I managed to import them in an array, but when i wanted to use makePolygon(coord); where coord is an array of all the coordinates of a polygon, i got the failure message: Numer or numeric function is required. When i wrote a list of coordinates one by one in the makePolygon function it worked well, but I do not have the time to write all the many thousand coordinates of many hundred polygons that way.
> How can I use list of coordinates for making polygons?
> Many thank in advance!Csaba
>
> --
> 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