Drawing Arrows with a Macro?

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

Drawing Arrows with a Macro?

Adam Cliffe
Does anyone know a good way of drawing an arrow using the Arrow tool with a macro?
I've tried:

setTool("arrow");
makeLine(169, 193, 171, 194);
run("Draw", "slice");

but it doesn't work...

thanks

Adam





Dr Adam Cliffe
Research Scientist, Rorth Lab

Institute of Molecular and Cell Biology
61 Biopolis Drive
Proteos
Singapore 138673

tel: +65 6586 9731









Note: This message may contain confidential information. If this Email/Fax has been sent to you by mistake, please notify the sender and delete it immediately. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Drawing Arrows with a Macro?

jmutterer
Adam,

include this function in your macro:

function makeArrow(x,y,x1,y1) {
eval('script','img = IJ.getImage();a= new
Arrow('+x+','+y+','+x1+','+y1+');img.setRoi(a);');
}

You can then use the makeArrow  (x,y,x1,y1) function that will draw an arrow
between to two given points, using the curent arrows settings.

Jerome

On Wed, Mar 24, 2010 at 7:53 AM, Adam Cliffe <[hidden email]>wrote:

> Does anyone know a good way of drawing an arrow using the Arrow tool with a
> macro?
> I've tried:
>
> setTool("arrow");
> makeLine(169, 193, 171, 194);
> run("Draw", "slice");
>
> but it doesn't work...
>
> thanks
>
> Adam
>
>
>
>
>
> Dr Adam Cliffe
> Research Scientist, Rorth Lab
>
> Institute of Molecular and Cell Biology
> 61 Biopolis Drive
> Proteos
> Singapore 138673
>
> tel: +65 6586 9731
>
>
>
>
>
>
>
>
>
> Note: This message may contain confidential information. If this Email/Fax
> has been sent to you by mistake, please notify the sender and delete it
> immediately. Thank you.
>
Reply | Threaded
Open this post in threaded view
|

Re: Drawing Arrows with a Macro?

Adam Cliffe
Hi Jerome,

Thanks for the mail, I've tried the function and I just get this
message:
ReferenceError: "newArrow" is not defined. (<Unknown source>#1) in
<Unknown source> at line number 1

any idea what's going wrong?

thanks

Adam

On Mar 24, 2010, at 4:12 PM, Jerome Mutterer wrote:

> function makeArrow(x,y,x1,y1) {
> eval('script','img = IJ.getImage();a= new
> Arrow('+x+','+y+','+x1+','+y1+');img.setRoi(a);');
> }

Dr Adam Cliffe
Research Scientist, Rorth Lab

Institute of Molecular and Cell Biology
61 Biopolis Drive
Proteos
Singapore 138673

tel: +65 6586 9731









Note: This message may contain confidential information. If this Email/Fax has been sent to you by mistake, please notify the sender and delete it immediately. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Drawing Arrows with a Macro?

jmutterer
Adam,
use the whole code, including the 'function' keyword that defines the new
function. A full example macro would look like this :


// example macro with the custom makeArrow function
run("Clown (14K)");
makeArrow(70, 23, 52, 109);
function makeArrow(x,y,x1,y1) {
eval('script','img = IJ.getImage();a= new
Arrow('+x+','+y+','+x1+','+y1+');img.setRoi(a);');
}
// end of macro


On Wed, Mar 24, 2010 at 9:38 AM, Adam Cliffe <[hidden email]>wrote:

> Hi Jerome,
>
> Thanks for the mail, I've tried the function and I just get this
> message:
> ReferenceError: "newArrow" is not defined. (<Unknown source>#1) in
> <Unknown source> at line number 1
>
> any idea what's going wrong?
>
> thanks
>
> Adam
>
>
> On Mar 24, 2010, at 4:12 PM, Jerome Mutterer wrote:
>
>  function makeArrow(x,y,x1,y1) {
>> eval('script','img = IJ.getImage();a= new
>> Arrow('+x+','+y+','+x1+','+y1+');img.setRoi(a);');
>> }
>>
>
> Dr Adam Cliffe
> Research Scientist, Rorth Lab
>
> Institute of Molecular and Cell Biology
> 61 Biopolis Drive
> Proteos
> Singapore 138673
>
> tel: +65 6586 9731
>
>
>
>
>
>
>
>
>
> Note: This message may contain confidential information. If this Email/Fax
> has been sent to you by mistake, please notify the sender and delete it
> immediately. Thank you.
>