Boolean and @parameter annotation in IJ1 macro

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

Boolean and @parameter annotation in IJ1 macro

Benoit Lombardot
Dear IJ users,

I am using the awesome @parameter annotation in an IJ1 macro to create
simple interfaces and I observe a discrepancy between boolean created by
annotations (i.e. //@boolean var1) and those declared directly in the
script (var2 = true;). Below is a small macro illustrating what I mean.
I commented the behavior on my machine (Win7 pro, FIJI
2.0.0-rc-25/1.49p; Java 1.6.0_24 [64-bit] )

//@Boolean bool1

IJ.log("bool1 is "+bool1) // boolean declared in @parameter annotation
print as "true"
if (bool1){ IJ.log("in test 1 : bool1 is "+bool1)
}                                      // this test does not pass
if (startsWith(bool1,"true")){ IJ.log("in test 2 : bool1 is "+bool1)
}    // this test pass

bool2 = true;
IJ.log("bool2 is "+ bool2) // boolean declared in macro display as "1"
if (bool2){ IJ.log("in test 3: bool2 is "+bool2)
}                                     // this test pass
// end of the macro


Did I do something wrong? Or is this the expected behavior and I don't
get it?
In Any case thanks for your feedback.

Also I have a subsidiary questions about the annotations in macro if any
one has directions to point me at.
Is it possible to set some default value in the fields? I know it is
possible in Java but couldn't find how to do it in macro.
Is there a widget to create a drop-down menu with the name of open image
windows?

Thanks a lot
Best regards,

Benoit



--
Benoit Lombardot
Bio-Image informatics, Scientific Computing Facility

Max Planck Institute CBG
Pfotenhauer Str. 108, 01307 Dresden
room: 106 (s)
phone: +49 351 210 2544
fax:   +49 351 210 1689

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

Re: Boolean and @parameter annotation in IJ1 macro

ctrueden
Hi Benoit,

> I observe a discrepancy between boolean created by
> annotations (i.e. //@boolean var1) and those
> declared directly in the script (var2 = true;).

Thanks for the report. This bug is now fixed [1].

We'll cut a release and upload to the ImageJ update site within the next
few days.

Regards,
Curtis

[1] https://github.com/imagej/imagej-legacy/pull/108

On Tue, Mar 17, 2015 at 7:52 AM, Benoit Lombardot <[hidden email]>
wrote:

> Dear IJ users,
>
> I am using the awesome @parameter annotation in an IJ1 macro to create
> simple interfaces and I observe a discrepancy between boolean created by
> annotations (i.e. //@boolean var1) and those declared directly in the
> script (var2 = true;). Below is a small macro illustrating what I mean. I
> commented the behavior on my machine (Win7 pro, FIJI 2.0.0-rc-25/1.49p;
> Java 1.6.0_24 [64-bit] )
>
> //@Boolean bool1
>
> IJ.log("bool1 is "+bool1) // boolean declared in @parameter annotation
> print as "true"
> if (bool1){ IJ.log("in test 1 : bool1 is "+bool1) }
>               // this test does not pass
> if (startsWith(bool1,"true")){ IJ.log("in test 2 : bool1 is "+bool1) }
> // this test pass
>
> bool2 = true;
> IJ.log("bool2 is "+ bool2) // boolean declared in macro display as "1"
> if (bool2){ IJ.log("in test 3: bool2 is "+bool2) }
>              // this test pass
> // end of the macro
>
>
> Did I do something wrong? Or is this the expected behavior and I don't get
> it?
> In Any case thanks for your feedback.
>
> Also I have a subsidiary questions about the annotations in macro if any
> one has directions to point me at.
> Is it possible to set some default value in the fields? I know it is
> possible in Java but couldn't find how to do it in macro.
> Is there a widget to create a drop-down menu with the name of open image
> windows?
>
> Thanks a lot
> Best regards,
>
> Benoit
>
>
>
> --
> Benoit Lombardot
> Bio-Image informatics, Scientific Computing Facility
>
> Max Planck Institute CBG
> Pfotenhauer Str. 108, 01307 Dresden
> room: 106 (s)
> phone: +49 351 210 2544
> fax:   +49 351 210 1689
>
> --
> 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
|

Re: Boolean and @parameter annotation in IJ1 macro

Benoit Lombardot
Thanks a lot, that's great!

Best,
Benoit

Le 18/03/2015 21:51, Curtis Rueden a écrit :

> Hi Benoit,
>
>> I observe a discrepancy between boolean created by
>> annotations (i.e. //@boolean var1) and those
>> declared directly in the script (var2 = true;).
> Thanks for the report. This bug is now fixed [1].
>
> We'll cut a release and upload to the ImageJ update site within the next
> few days.
>
> Regards,
> Curtis
>
> [1] https://github.com/imagej/imagej-legacy/pull/108
>
> On Tue, Mar 17, 2015 at 7:52 AM, Benoit Lombardot <[hidden email]>
> wrote:
>
>> Dear IJ users,
>>
>> I am using the awesome @parameter annotation in an IJ1 macro to create
>> simple interfaces and I observe a discrepancy between boolean created by
>> annotations (i.e. //@boolean var1) and those declared directly in the
>> script (var2 = true;). Below is a small macro illustrating what I mean. I
>> commented the behavior on my machine (Win7 pro, FIJI 2.0.0-rc-25/1.49p;
>> Java 1.6.0_24 [64-bit] )
>>
>> //@Boolean bool1
>>
>> IJ.log("bool1 is "+bool1) // boolean declared in @parameter annotation
>> print as "true"
>> if (bool1){ IJ.log("in test 1 : bool1 is "+bool1) }
>>                // this test does not pass
>> if (startsWith(bool1,"true")){ IJ.log("in test 2 : bool1 is "+bool1) }
>> // this test pass
>>
>> bool2 = true;
>> IJ.log("bool2 is "+ bool2) // boolean declared in macro display as "1"
>> if (bool2){ IJ.log("in test 3: bool2 is "+bool2) }
>>               // this test pass
>> // end of the macro
>>
>>
>> Did I do something wrong? Or is this the expected behavior and I don't get
>> it?
>> In Any case thanks for your feedback.
>>
>> Also I have a subsidiary questions about the annotations in macro if any
>> one has directions to point me at.
>> Is it possible to set some default value in the fields? I know it is
>> possible in Java but couldn't find how to do it in macro.
>> Is there a widget to create a drop-down menu with the name of open image
>> windows?
>>
>> Thanks a lot
>> Best regards,
>>
>> Benoit
>>
>>
>>
>> --
>> Benoit Lombardot
>> Bio-Image informatics, Scientific Computing Facility
>>
>> Max Planck Institute CBG
>> Pfotenhauer Str. 108, 01307 Dresden
>> room: 106 (s)
>> phone: +49 351 210 2544
>> fax:   +49 351 210 1689
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
Benoit Lombardot
Bio-Image informatics, Scientific Computing Facility

Max Planck Institute CBG
Pfotenhauer Str. 108, 01307 Dresden
room: 106 (s)
phone: +49 351 210 2544
fax:   +49 351 210 1689

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