Quantcast

incorporating dialog box choices into a macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

incorporating dialog box choices into a macro

dobensl
I am trying to give users of a macro that I’m writing some flexibility in the size/color of arrows it draws outlining particle directionality.

From the Arrow Tool, users make choices about arrow "size/color/arrow head," but these changes are not being implemented when the arrows are drawn.

Is there a straightforward solution to this?

Here is the last bit of the macro, drawing lines between points identified earlier:

> run("Arrow Tool...");
>
> for (i=0; i<nResults; i++) {
>
> xh = getResult("xh",i);
> xt = getResult("xt",i);
> yh = getResult("yh",i);
> yt = getResult("yt",i);
>
>
>   makeArrow(xt, yt, xh, yh, "notched");
>
> run("Draw", "slice");
> }



Leonard Dobens, PhD
Professor of Molecular Biology and Biochemistry
SCB312
School of Biological Sciences
University of Missouri-Kansas City
5007 Rockhill Road
Kansas City, MO 64110
8162356272
[hidden email]



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: incorporating dialog box choices into a macro

Michael Schmid-3
Hi Leonard,

from the ImageJ Macro Functions Documentation at
   https://imagej.nih.gov/ij/developer/macro/functions.html#makeArrow

   "See also: Roi.setStrokeWidth and Roi.setStrokeColor"

To me, this indicates that the interactive arrow options do not apply
for arrows created by the 'makeArrow' macro command.  You would have to
create your own dialog for the options of the 'makeArrow' arrows.
   https://imagej.nih.gov/ij/developer/macro/functions.html#dialog

Michael
________________________________________________________________


On 12/27/2016 06:15 AM, Dobens, Leonard wrote:

> I am trying to give users of a macro that I’m writing some flexibility in the size/color of arrows it draws outlining particle directionality.
>
> From the Arrow Tool, users make choices about arrow "size/color/arrow head," but these changes are not being implemented when the arrows are drawn.
>
> Is there a straightforward solution to this?
>
> Here is the last bit of the macro, drawing lines between points identified earlier:
>
>> run("Arrow Tool...");
>>
>> for (i=0; i<nResults; i++) {
>>
>> xh = getResult("xh",i);
>> xt = getResult("xt",i);
>> yh = getResult("yh",i);
>> yt = getResult("yt",i);
>>
>>
>>   makeArrow(xt, yt, xh, yh, "notched");
>>
>> run("Draw", "slice");
>> }
>
>
>
> Leonard Dobens, PhD
> Professor of Molecular Biology and Biochemistry
> SCB312
> School of Biological Sciences
> University of Missouri-Kansas City
> 5007 Rockhill Road
> Kansas City, MO 64110
> 8162356272
> [hidden email]
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: incorporating dialog box choices into a macro

dobensl
thanks, - this turned out to be the answer for me:

Dialog.create("Arrow Attributes");
  Dialog.addNumber("Width:", 51);
  Dialog.addChoice("Color:", newArray("black", "white"));
  Dialog.show();
  width = Dialog.getNumber();
  color = Dialog.getChoice();

for (i=0; i<nResults; i++) {

xh = getResult("xh",i);
xt = getResult("xt",i);
yh = getResult("yh",i);
yt = getResult("yt",i);


  makeArrow(xt, yt, xh, yh, "notched");
Roi.setStrokeWidth(width);
Roi.setStrokeColor(color);
run("Draw", "slice");
}



On Dec 27, 2016, at 4:04 AM, Michael Schmid <[hidden email]<mailto:[hidden email]>> wrote:

Hi Leonard,

from the ImageJ Macro Functions Documentation at
 https://imagej.nih.gov/ij/developer/macro/functions.html#makeArrow

 "See also: Roi.setStrokeWidth and Roi.setStrokeColor"

To me, this indicates that the interactive arrow options do not apply for arrows created by the 'makeArrow' macro command.  You would have to create your own dialog for the options of the 'makeArrow' arrows.
 https://imagej.nih.gov/ij/developer/macro/functions.html#dialog

Michael
________________________________________________________________


On 12/27/2016 06:15 AM, Dobens, Leonard wrote:
I am trying to give users of a macro that I’m writing some flexibility in the size/color of arrows it draws outlining particle directionality.

From the Arrow Tool, users make choices about arrow "size/color/arrow head," but these changes are not being implemented when the arrows are drawn.

Is there a straightforward solution to this?

Here is the last bit of the macro, drawing lines between points identified earlier:

run("Arrow Tool...");

for (i=0; i<nResults; i++) {

xh = getResult("xh",i);
xt = getResult("xt",i);
yh = getResult("yh",i);
yt = getResult("yt",i);


   makeArrow(xt, yt, xh, yh, "notched");

run("Draw", "slice");
}



Leonard Dobens, PhD
Professor of Molecular Biology and Biochemistry
SCB312
School of Biological Sciences
University of Missouri-Kansas City
5007 Rockhill Road
Kansas City, MO 64110
8162356272
[hidden email]<mailto:[hidden email]>



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Leonard Dobens, PhD
Professor of Molecular Biology and Biochemistry
SCB312
School of Biological Sciences
University of Missouri-Kansas City
5007 Rockhill Road
Kansas City, MO 64110
8162356272
[hidden email]<mailto:[hidden email]>




--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Loading...