How to use "makePolygon"?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use "makePolygon"?

Juanjo Vega
Hi!

I'm trying to programmatically select a Roi as a ploygon. I started
recording a macro and I got the following:

//setTool(2);
makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);


But when I try to use "makePolygon()" at my code, it doesn't work.
I'm not sure at all about the method because the number of arguments can
vary.

Any idea?

Sincerelly,
Juanjo.

--
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.uam.es

+34 91 585 4510


"Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes.
Reply | Threaded
Open this post in threaded view
|

Re: How to use "makePolygon"?

sabin basi
Hello,

Could anyone please help me, how to cluster the data coordinates acquired,
to give a meaningful distinction from homogenous and heterogenous
distribution of data points in different images.

anticipating for the kind help

thanks

sabin



----- Original Message -----
From: "Juanjo Vega" <[hidden email]>
To: <[hidden email]>
Sent: Monday, June 22, 2009 12:22 PM
Subject: How to use "makePolygon"?


Hi!

I'm trying to programmatically select a Roi as a ploygon. I started
recording a macro and I got the following:

//setTool(2);
makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);


But when I try to use "makePolygon()" at my code, it doesn't work.
I'm not sure at all about the method because the number of arguments can
vary.

Any idea?

Sincerelly,
Juanjo.

--
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.uam.es

+34 91 585 4510


"Las mejores almas son capaces de los mayores vicios como de las mayores
virtudes, y aquellos que caminan despacio por el camino recto pueden llegar
más lejos que los que corren pero se apartan de él." - Discurso del Método,
René Descartes.
Reply | Threaded
Open this post in threaded view
|

Re: How to use "makePolygon"?

Gluender-3
In reply to this post by Juanjo Vega
Could you please be more specific as to what doesn't work for you?

>Hi!
>
>I'm trying to programmatically select a Roi as a
>ploygon. I started recording a macro and I got
>the following:
>
>//setTool(2);
>makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);
>
>But when I try to use "makePolygon()" at my code, it doesn't work.
>I'm not sure at all about the method because the number of arguments can vary.

The macro function manual tells us:
--------------------------
makePolygon(x1, y1, x2, y2, x3, y3, ...)
Creates a polygonal selection. At least three
coordinate pairs must be specified, but not more
than 200. As an example,
makePolygon(20,48,59,13,101,40,75,77,38,70)
creates a polygon selection with five sides.
--------------------------

>Any idea?
>
>Sincerelly,
>Juanjo.
>
>--
>Juanjo Vega ([hidden email])
>
>Unidad de Biocomputación. Laboratorio B-13.
>Centro Nacional de Biotecnología. CNB-CSIC.
>C\ Darwin, 3. Campus de Cantoblanco.
>Universidad Autónoma de Madrid.
>28049, Madrid, Spain.

Best
--

                   Herbie

          ------------------------
          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: How to use "makePolygon"?

Juanjo Vega
Well, what doesn't work is:

IJ.run("makePolygon(20,48,59,13,101,40,75,77,38,70)");

It shows a message which says: "unrecognized command", or something like
that.

I also tried to look for a method like "IJ.makePolygon()", but it
doesn't exist (there are methods to makePoint, line, rectangle, oval,...
but no polygon).

Thanks for your help!

Juanjo.

Gluender escribió:

> Could you please be more specific as to what doesn't work for you?
>
>> Hi!
>>
>> I'm trying to programmatically select a Roi as a ploygon. I started
>> recording a macro and I got the following:
>>
>> //setTool(2);
>> makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);
>>
>> But when I try to use "makePolygon()" at my code, it doesn't work.
>> I'm not sure at all about the method because the number of arguments
>> can vary.
>
> The macro function manual tells us:
> --------------------------
> makePolygon(x1, y1, x2, y2, x3, y3, ...)
> Creates a polygonal selection. At least three coordinate pairs must be
> specified, but not more than 200. As an example,
> makePolygon(20,48,59,13,101,40,75,77,38,70) creates a polygon
> selection with five sides.
> --------------------------
>
>> Any idea?
>>
>> Sincerelly,
>> Juanjo.
>>
>> --
>> Juanjo Vega ([hidden email])
>>
>> Unidad de Biocomputación. Laboratorio B-13.
>> Centro Nacional de Biotecnología. CNB-CSIC.
>> C\ Darwin, 3. Campus de Cantoblanco.
>> Universidad Autónoma de Madrid.
>> 28049, Madrid, Spain.
>
> Best

--
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.uam.es

+34 91 585 4510


"Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes.
Reply | Threaded
Open this post in threaded view
|

Re: How to use "makePolygon"?

Michael Schmid
Hi Juanjo,

if you write a MACRO, remove the 'IJ.run', just write
   makePolygon(20,48,59,13,101,40,75,77,38,70);

If you write a PLUGIN (Java), use
     imp.setRoi(new PolygonRoi(x, y, n, Roi.POLYGON));
where x and y are arrays, and n is the number of points in the x and  
y arrays that should be used (usually the array length).

There is no method in IJ for making a polygon roi (admittingly, the  
command recorder sometimes only delivers a very rough approximation  
to what a plugin should look like...)


Michael
________________________________________________________________

On 22 Jun 2009, at 15:15, Juanjo Vega wrote:

> Well, what doesn't work is:
>
> IJ.run("makePolygon(20,48,59,13,101,40,75,77,38,70)");
>
> It shows a message which says: "unrecognized command", or something  
> like that.
>
> I also tried to look for a method like "IJ.makePolygon()", but it  
> doesn't exist (there are methods to makePoint, line, rectangle,  
> oval,... but no polygon).
>
> Thanks for your help!
>
> Juanjo.
>
> Gluender escribió:
>> Could you please be more specific as to what doesn't work for you?
>>
>>> Hi!
>>>
>>> I'm trying to programmatically select a Roi as a ploygon. I  
>>> started recording a macro and I got the following:
>>>
>>> //setTool(2);
>>> makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);
>>>
>>> But when I try to use "makePolygon()" at my code, it doesn't work.
>>> I'm not sure at all about the method because the number of  
>>> arguments can vary.
>>
>> The macro function manual tells us:
>> --------------------------
>> makePolygon(x1, y1, x2, y2, x3, y3, ...)
>> Creates a polygonal selection. At least three coordinate pairs  
>> must be specified, but not more than 200. As an example,  
>> makePolygon(20,48,59,13,101,40,75,77,38,70) creates a polygon  
>> selection with five sides.
>> --------------------------
>>
>>> Any idea?
>>>
>>> Sincerelly,
>>> Juanjo.
>>>
>>> --
>>> Juanjo Vega ([hidden email])
>>>
>>> Unidad de Biocomputación. Laboratorio B-13.
>>> Centro Nacional de Biotecnología. CNB-CSIC.
>>> C\ Darwin, 3. Campus de Cantoblanco.
>>> Universidad Autónoma de Madrid.
>>> 28049, Madrid, Spain.
>>
>> Best
>
> --
> Juanjo Vega ([hidden email])
>
> Unidad de Biocomputación. Laboratorio B-13.
> Centro Nacional de Biotecnología. CNB-CSIC.
> C\ Darwin, 3. Campus de Cantoblanco.
> Universidad Autónoma de Madrid.
> 28049, Madrid, Spain.
>
> http://www.cnb.csic.es
> http://www.biocomp.cnb.uam.es
>
> +34 91 585 4510
>
>
> "Las mejores almas son capaces de los mayores vicios como de las  
> mayores virtudes, y aquellos que caminan despacio por el camino  
> recto pueden llegar más lejos que los que corren pero se apartan de  
> él." - Discurso del Método, René Descartes.
Reply | Threaded
Open this post in threaded view
|

Re: How to use "makePolygon"?

Juanjo Vega
Hi Michael,

Thanks a lot, it works. Not for the values I'm using, but there must be
something weird I'm not seeing. I'll try to fix that by myself.

Thanks again

Sincerelly,

Juanjo.

Michael Schmid escribió:

> Hi Juanjo,
>
> if you write a MACRO, remove the 'IJ.run', just write
>   makePolygon(20,48,59,13,101,40,75,77,38,70);
>
> If you write a PLUGIN (Java), use
>     imp.setRoi(new PolygonRoi(x, y, n, Roi.POLYGON));
> where x and y are arrays, and n is the number of points in the x and y
> arrays that should be used (usually the array length).
>
> There is no method in IJ for making a polygon roi (admittingly, the
> command recorder sometimes only delivers a very rough approximation to
> what a plugin should look like...)
>
>
> Michael
> ________________________________________________________________
>
> On 22 Jun 2009, at 15:15, Juanjo Vega wrote:
>
>> Well, what doesn't work is:
>>
>> IJ.run("makePolygon(20,48,59,13,101,40,75,77,38,70)");
>>
>> It shows a message which says: "unrecognized command", or something
>> like that.
>>
>> I also tried to look for a method like "IJ.makePolygon()", but it
>> doesn't exist (there are methods to makePoint, line, rectangle,
>> oval,... but no polygon).
>>
>> Thanks for your help!
>>
>> Juanjo.
>>
>> Gluender escribió:
>>> Could you please be more specific as to what doesn't work for you?
>>>
>>>> Hi!
>>>>
>>>> I'm trying to programmatically select a Roi as a ploygon. I started
>>>> recording a macro and I got the following:
>>>>
>>>> //setTool(2);
>>>> makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);
>>>>
>>>> But when I try to use "makePolygon()" at my code, it doesn't work.
>>>> I'm not sure at all about the method because the number of
>>>> arguments can vary.
>>>
>>> The macro function manual tells us:
>>> --------------------------
>>> makePolygon(x1, y1, x2, y2, x3, y3, ...)
>>> Creates a polygonal selection. At least three coordinate pairs must
>>> be specified, but not more than 200. As an example,
>>> makePolygon(20,48,59,13,101,40,75,77,38,70) creates a polygon
>>> selection with five sides.
>>> --------------------------
>>>
>>>> Any idea?
>>>>
>>>> Sincerelly,
>>>> Juanjo.
>>>>
>>>> --
>>>> Juanjo Vega ([hidden email])
>>>>
>>>> Unidad de Biocomputación. Laboratorio B-13.
>>>> Centro Nacional de Biotecnología. CNB-CSIC.
>>>> C\ Darwin, 3. Campus de Cantoblanco.
>>>> Universidad Autónoma de Madrid.
>>>> 28049, Madrid, Spain.
>>>
>>> Best
>>
>> --
>> Juanjo Vega ([hidden email])
>>
>> Unidad de Biocomputación. Laboratorio B-13.
>> Centro Nacional de Biotecnología. CNB-CSIC.
>> C\ Darwin, 3. Campus de Cantoblanco.
>> Universidad Autónoma de Madrid.
>> 28049, Madrid, Spain.
>>
>> http://www.cnb.csic.es
>> http://www.biocomp.cnb.uam.es
>>
>> +34 91 585 4510
>>
>>
>> "Las mejores almas son capaces de los mayores vicios como de las
>> mayores virtudes, y aquellos que caminan despacio por el camino recto
>> pueden llegar más lejos que los que corren pero se apartan de él." -
>> Discurso del Método, René Descartes.
>

--
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.uam.es

+34 91 585 4510


"Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes.
Reply | Threaded
Open this post in threaded view
|

Re: How to use "makePolygon"?

Fernando Sales
Juanjo,

an useful tip for situations like these is to use the "Macro Recorder"
command.
With this command, all operations executed will be added to macro recorder
window and you will discover how to pass the arguments into the command
IJ.Run(Macro name,args).
Best regards,

Fernando

On Mon, Jun 22, 2009 at 11:40 AM, Juanjo Vega <[hidden email]> wrote:

> Hi Michael,
>
> Thanks a lot, it works. Not for the values I'm using, but there must be
> something weird I'm not seeing. I'll try to fix that by myself.
>
> Thanks again
>
> Sincerelly,
>
> Juanjo.
>
> Michael Schmid escribió:
>
>  Hi Juanjo,
>>
>> if you write a MACRO, remove the 'IJ.run', just write
>>  makePolygon(20,48,59,13,101,40,75,77,38,70);
>>
>> If you write a PLUGIN (Java), use
>>    imp.setRoi(new PolygonRoi(x, y, n, Roi.POLYGON));
>> where x and y are arrays, and n is the number of points in the x and y
>> arrays that should be used (usually the array length).
>>
>> There is no method in IJ for making a polygon roi (admittingly, the
>> command recorder sometimes only delivers a very rough approximation to what
>> a plugin should look like...)
>>
>>
>> Michael
>> ________________________________________________________________
>>
>> On 22 Jun 2009, at 15:15, Juanjo Vega wrote:
>>
>>  Well, what doesn't work is:
>>>
>>> IJ.run("makePolygon(20,48,59,13,101,40,75,77,38,70)");
>>>
>>> It shows a message which says: "unrecognized command", or something like
>>> that.
>>>
>>> I also tried to look for a method like "IJ.makePolygon()", but it doesn't
>>> exist (there are methods to makePoint, line, rectangle, oval,... but no
>>> polygon).
>>>
>>> Thanks for your help!
>>>
>>> Juanjo.
>>>
>>> Gluender escribió:
>>>
>>>> Could you please be more specific as to what doesn't work for you?
>>>>
>>>>  Hi!
>>>>>
>>>>> I'm trying to programmatically select a Roi as a ploygon. I started
>>>>> recording a macro and I got the following:
>>>>>
>>>>> //setTool(2);
>>>>> makePolygon(175,20,106,161,264,227,348,78,201,103,231,31);
>>>>>
>>>>> But when I try to use "makePolygon()" at my code, it doesn't work.
>>>>> I'm not sure at all about the method because the number of arguments
>>>>> can vary.
>>>>>
>>>>
>>>> The macro function manual tells us:
>>>> --------------------------
>>>> makePolygon(x1, y1, x2, y2, x3, y3, ...)
>>>> Creates a polygonal selection. At least three coordinate pairs must be
>>>> specified, but not more than 200. As an example,
>>>> makePolygon(20,48,59,13,101,40,75,77,38,70) creates a polygon selection with
>>>> five sides.
>>>> --------------------------
>>>>
>>>>  Any idea?
>>>>>
>>>>> Sincerelly,
>>>>> Juanjo.
>>>>>
>>>>> --
>>>>> Juanjo Vega ([hidden email])
>>>>>
>>>>> Unidad de Biocomputación. Laboratorio B-13.
>>>>> Centro Nacional de Biotecnología. CNB-CSIC.
>>>>> C\ Darwin, 3. Campus de Cantoblanco.
>>>>> Universidad Autónoma de Madrid.
>>>>> 28049, Madrid, Spain.
>>>>>
>>>>
>>>> Best
>>>>
>>>
>>> --
>>> Juanjo Vega ([hidden email])
>>>
>>> Unidad de Biocomputación. Laboratorio B-13.
>>> Centro Nacional de Biotecnología. CNB-CSIC.
>>> C\ Darwin, 3. Campus de Cantoblanco.
>>> Universidad Autónoma de Madrid.
>>> 28049, Madrid, Spain.
>>>
>>> http://www.cnb.csic.es
>>> http://www.biocomp.cnb.uam.es
>>>
>>> +34 91 585 4510
>>>
>>>
>>> "Las mejores almas son capaces de los mayores vicios como de las mayores
>>> virtudes, y aquellos que caminan despacio por el camino recto pueden llegar
>>> más lejos que los que corren pero se apartan de él." - Discurso del Método,
>>> René Descartes.
>>>
>>
>>
> --
> Juanjo Vega ([hidden email])
>
> Unidad de Biocomputación. Laboratorio B-13.
> Centro Nacional de Biotecnología. CNB-CSIC.
> C\ Darwin, 3. Campus de Cantoblanco.
> Universidad Autónoma de Madrid.
> 28049, Madrid, Spain.
>
> http://www.cnb.csic.es
> http://www.biocomp.cnb.uam.es
>
> +34 91 585 4510
>
>
> "Las mejores almas son capaces de los mayores vicios como de las mayores
> virtudes, y aquellos que caminan despacio por el camino recto pueden llegar
> más lejos que los que corren pero se apartan de él." - Discurso del Método,
> René Descartes.
>



--
**************************************************
Fernando José Ribeiro Sales
**************************************************
Email: [hidden email]
Tel: (11) 82020303
**************************************************