Hello,
In my macro, I've just tried : Dialog.addChoice("Scanning mode",newArray("12", "4", "line")); scanmode=Dialog.getNextChoiceIndex(); IJ gives an error message saying that this is not a recognized Dialog function. scanmode=getNextChoiceIndex(); IJ gives an error message saying that this is an undefined identifier. These error messages are because I use them in a macro I guess Is there any other possibilities to get this numerical values instead of strings in my macro ? Many thanks, -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Thomas Boudier Sent: lundi, 10. juillet 2006 10:41 To: [hidden email] Subject: Re: dialog box Girault France a écrit : > Dear all, > > > > I have a dialog box that give some choices : > > > > Dialog.addChoice("Scanning mode",newArray("12", "4", "line")); > > scanmode=Dialog.getChoice(); > > > > A string is returned to scanmode, but I would rather like to return a numerical value: > > The value 12 would be 1, 4 would be 2 and line would be 3. > > > > > > I'm sure this is very trivial, but I really don't know how to do. > > Can anybody help me ?! > Hello France, You can use *getNextChoiceIndex*() that will return the number in your list, starting at 0 I think. Thomas > > > > > Many thanks, > > > > France > > > > France Girault > > Geological Institute > > CAB E-62 > > ETH Zürich > > Universitätstrasse 6 > > 8092 Zürich > > [hidden email] > > Private phone : ++4178/726.99.20 > > Office phone : ++4144/632 84 16 France Girault Geological Institute CAB E-62 ETH Zürich Universitätstrasse 6 8092 Zürich [hidden email] Private phone : ++4178/726.99.20 Office phone : ++4144/632 84 16 |
Girault France a écrit :
> Hello, > > > > In my macro, I've just tried : > > > > Dialog.addChoice("Scanning mode",newArray("12", "4", "line")); scanmode=Dialog.getNextChoiceIndex(); > Oups, my mistake, I thought it was a plugin :-[ you can use something like this : scanmode=Dialog.getChoice(); i=0; while(tab[i]!=scanmode) i++; print("i="+i); // your number Thomas > > > IJ gives an error message saying that this is not a recognized Dialog function. > > > > scanmode=getNextChoiceIndex(); > > IJ gives an error message saying that this is an undefined identifier. > > > > These error messages are because I use them in a macro I guess > > > > Is there any other possibilities to get this numerical values instead of strings in my macro ? > > > > > > Many thanks, > > > > > > -----Original Message----- > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Thomas Boudier > > Sent: lundi, 10. juillet 2006 10:41 > > To: [hidden email] > > Subject: Re: dialog box > > > > Girault France a écrit : > > >> Dear all, >> > > > > >> >> > > > > >> I have a dialog box that give some choices : >> > > > > >> >> > > > > >> Dialog.addChoice("Scanning mode",newArray("12", "4", "line")); >> > > > > >> scanmode=Dialog.getChoice(); >> > > > > >> >> > > > > >> A string is returned to scanmode, but I would rather like to return a numerical value: >> > > > > >> The value 12 would be 1, 4 would be 2 and line would be 3. >> > > > > >> >> > > > > >> >> > > > > >> I'm sure this is very trivial, but I really don't know how to do. >> > > > > >> Can anybody help me ?! >> > > >> >> > > > > Hello France, > > > > You can use *getNextChoiceIndex*() that will return the number in your list, starting at 0 I think. > > > > Thomas > > >> >> > > > > >> >> > > > > >> Many thanks, >> > > > > >> >> > > > > >> France >> > > > > >> >> > > > > >> France Girault >> > > > > >> Geological Institute >> > > > > >> CAB E-62 >> > > > > >> ETH Zürich >> > > > > >> Universitätstrasse 6 >> > > > > >> 8092 Zürich >> > > > > >> [hidden email] >> > > > > >> Private phone : ++4178/726.99.20 >> > > > > >> Office phone : ++4144/632 84 16 >> > > > > > > France Girault > > Geological Institute > > CAB E-62 > > ETH Zürich > > Universitätstrasse 6 > > 8092 Zürich > > [hidden email] > > Private phone : ++4178/726.99.20 > > Office phone : ++4144/632 84 16 > > > > . > > -- /*****************************************************/ Thomas Boudier, MCU Université Pierre et Marie Curie Imagerie Intégrative,Institut Curie - INSERM U759. Tél : 01 69 86 31 72 Fax : 01 69 07 53 27 /*****************************************************/ |
In reply to this post by Girault France
Girault France a écrit :
> Hello, > > > > In my macro, I've just tried : > > > > Dialog.addChoice("Scanning mode",newArray("12", "4", "line")); scanmode=Dialog.getNextChoiceIndex(); > tab=newArray("12", "4", "line"); Dialog.addChoice("Scanning mode",tab); Thomas > > > IJ gives an error message saying that this is not a recognized Dialog function. > > > > scanmode=getNextChoiceIndex(); > > IJ gives an error message saying that this is an undefined identifier. > > > > These error messages are because I use them in a macro I guess > > > > Is there any other possibilities to get this numerical values instead of strings in my macro ? > > > > > > Many thanks, > > > > > > -----Original Message----- > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Thomas Boudier > > Sent: lundi, 10. juillet 2006 10:41 > > To: [hidden email] > > Subject: Re: dialog box > > > > Girault France a écrit : > > >> Dear all, >> > > > > >> >> > > > > >> I have a dialog box that give some choices : >> > > > > >> >> > > > > >> Dialog.addChoice("Scanning mode",newArray("12", "4", "line")); >> > > > > >> scanmode=Dialog.getChoice(); >> > > > > >> >> > > > > >> A string is returned to scanmode, but I would rather like to return a numerical value: >> > > > > >> The value 12 would be 1, 4 would be 2 and line would be 3. >> > > > > >> >> > > > > >> >> > > > > >> I'm sure this is very trivial, but I really don't know how to do. >> > > > > >> Can anybody help me ?! >> > > >> >> > > > > Hello France, > > > > You can use *getNextChoiceIndex*() that will return the number in your list, starting at 0 I think. > > > > Thomas > > >> >> > > > > >> >> > > > > >> Many thanks, >> > > > > >> >> > > > > >> France >> > > > > >> >> > > > > >> France Girault >> > > > > >> Geological Institute >> > > > > >> CAB E-62 >> > > > > >> ETH Zürich >> > > > > >> Universitätstrasse 6 >> > > > > >> 8092 Zürich >> > > > > >> [hidden email] >> > > > > >> Private phone : ++4178/726.99.20 >> > > > > >> Office phone : ++4144/632 84 16 >> > > > > > > France Girault > > Geological Institute > > CAB E-62 > > ETH Zürich > > Universitätstrasse 6 > > 8092 Zürich > > [hidden email] > > Private phone : ++4178/726.99.20 > > Office phone : ++4144/632 84 16 > > > > . > > -- /*****************************************************/ Thomas Boudier, MCU Université Pierre et Marie Curie Imagerie Intégrative,Institut Curie - INSERM U759. Tél : 01 69 86 31 72 Fax : 01 69 07 53 27 /*****************************************************/ |
In reply to this post by Girault France
Hi Girault,
The error message is indeed due to the fact that ImageJ macro language knows no such function as "getNextChoiceIndex" An overview of the macro functions can be found at: http://rsb.info.nih.gov/ij/developer/macro/functions.html The getNextChoice() method is part of the class ij.gui.GenericDialog. You can use these methods in plugins (which are java code, unlike the higher level macro language) It is possible that you need to write a plugin instead of a macro (see the tutorial by Werner Bailer to get you started on plug-ins). First you could browse the functions that are available in the macro language and see if there's a function there that will do what you want. That is unless someone on the list could point out there is one/none. Greetings, Edwin |
Free forum by Nabble | Edit this page |