Scientific notation within a numericField of a GenericDialog

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

Scientific notation within a numericField of a GenericDialog

CARL Philippe (LBP)
Dear all,
Is there a way to force the content of a numericField (at least for its defaultValue) within a GenericDialog to be shown with scientific notations.
I thank very much in advance for your help on this.
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

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

Re: Scientific notation within a numericField of a GenericDialog

Michael Schmid
Hi Philippe,

you can specify a negative number for the number of digits, then ImageJ
uses scientific notation. It is the same as with IJ.d2s (java) or d2s
(macro).

Macro example:

   Dialog.create("test");
   Dialog.addNumber("the number", 1.0, -3, 8, "units");
   Dialog.show();


Michael
________________________________________________________________
On 09.03.21 19:59, CARL Philippe (LBP) wrote:

> Dear all,
> Is there a way to force the content of a numericField (at least for its defaultValue) within a GenericDialog to be shown with scientific notations.
> I thank very much in advance for your help on this.
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Bioimagerie et Pathologies
> UMR 7021 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH

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

Re: Scientific notation within a numericField of a GenericDialog

CARL Philippe (LBP)
Dear Michael,
Thanks a lot for your (as always) very sharp answer which is working as described!
I had lost myself in way more complicated solutions.
Kindest regards,
Philippe

----- Mail original -----
De: "Michael Schmid" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Mardi 9 Mars 2021 20:55:55
Objet: Re: Scientific notation within a numericField of a GenericDialog

Hi Philippe,

you can specify a negative number for the number of digits, then ImageJ
uses scientific notation. It is the same as with IJ.d2s (java) or d2s
(macro).

Macro example:

   Dialog.create("test");
   Dialog.addNumber("the number", 1.0, -3, 8, "units");
   Dialog.show();


Michael
________________________________________________________________
On 09.03.21 19:59, CARL Philippe (LBP) wrote:

> Dear all,
> Is there a way to force the content of a numericField (at least for its defaultValue) within a GenericDialog to be shown with scientific notations.
> I thank very much in advance for your help on this.
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Bioimagerie et Pathologies
> UMR 7021 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH

--
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: Scientific notation within a numericField of a GenericDialog

Herbie
Bonjour Philippe,

when using e.g.
         IJ.d2s( yourDecimalNumber, -2 );
you may even append "toLowerCase()" which gives
         IJ.d2s( yourDecimalNumber, -2 ).toLowerCase();
and from my point of view results in improved readability...

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::::::::
Am 09.03.21 um 21:20 schrieb CARL Philippe (LBP):

> Dear Michael,
> Thanks a lot for your (as always) very sharp answer which is working as described!
> I had lost myself in way more complicated solutions.
> Kindest regards,
> Philippe
>
> ----- Mail original -----
> De: "Michael Schmid" <[hidden email]>
> À: "imagej" <[hidden email]>
> Envoyé: Mardi 9 Mars 2021 20:55:55
> Objet: Re: Scientific notation within a numericField of a GenericDialog
>
> Hi Philippe,
>
> you can specify a negative number for the number of digits, then ImageJ
> uses scientific notation. It is the same as with IJ.d2s (java) or d2s
> (macro).
>
> Macro example:
>
>     Dialog.create("test");
>     Dialog.addNumber("the number", 1.0, -3, 8, "units");
>     Dialog.show();
>
>
> Michael
> ________________________________________________________________
> On 09.03.21 19:59, CARL Philippe (LBP) wrote:
>> Dear all,
>> Is there a way to force the content of a numericField (at least for its defaultValue) within a GenericDialog to be shown with scientific notations.
>> I thank very much in advance for your help on this.
>> My best regards,
>> Philippe
>>
>> Philippe CARL
>> Laboratoire de Bioimagerie et Pathologies
>> UMR 7021 CNRS - Université de Strasbourg
>> Faculté de Pharmacie
>> 74 route du Rhin
>> 67401 ILLKIRCH
>
> --
> 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