Hi everyone!
I wrote some macro with ImageJ and I try rewrote it (and some others) in Java with the source code of ImageJ... but I can't manage to understand how to use functions we can find in "MacroConstants" that were used in the macro, as "isOpen", "nImages" or "openAsString" in the file "Functions". I understand that there is a relation with what is called "token", but I can't use it... Can someone show me how to use it for one of these functions? Thanks, Paul. _________________________________________________________________ Hotmail et MSN dans la poche? HOTMAIL et MSN sont dispo gratuitement sur votre téléphone! http://www.messengersurvotremobile.com/?d=Hotmail |
Hi Paul,
many of the macro commands are static functions in ij.IJ. E.g., IJ.openAsString(String path). If you don't find it there, you have to look at ij.macro.Functions.java to see what java code they actually correspond to. Michael ________________________________________________________________ On 7 May 2010, at 00:24, Paul Dufouleur wrote: > Hi everyone! > > I wrote some macro with ImageJ and I try rewrote it (and some > others) in Java with the source code of ImageJ... but I can't > manage to understand how to use functions we can find in > "MacroConstants" that were used in the macro, as "isOpen", > "nImages" or "openAsString" in the file "Functions". I understand > that there is a relation with what is called "token", but I can't > use it... > > Can someone show me how to use it for one of these functions? > > Thanks, > > Paul. |
Hi everyone,
Thank you for your help last time, but I have still some problem for using functions described in ij.macro.Functions.java like the method "getFileList" that I used in macro language. Can someone show me how to use them (is there an other way than finding those functions in some other class?)? Thanks, Paul. PS: I understood why I didn't find "openAsString", I was using the 1.39 version source code... > Date: Fri, 7 May 2010 10:27:35 +0200 > From: [hidden email] > Subject: Re: help for a beginner in plugin with the ImageJ source code (use of macro functions)... > To: [hidden email] > > Hi Paul, > > many of the macro commands are static functions in ij.IJ. E.g., > IJ.openAsString(String path). > If you don't find it there, you have to look at > ij.macro.Functions.java to see what java code they actually > correspond to. > > Michael > ________________________________________________________________ > > On 7 May 2010, at 00:24, Paul Dufouleur wrote: > > > Hi everyone! > > > > I wrote some macro with ImageJ and I try rewrote it (and some > > others) in Java with the source code of ImageJ... but I can't > > manage to understand how to use functions we can find in > > "MacroConstants" that were used in the macro, as "isOpen", > > "nImages" or "openAsString" in the file "Functions". I understand > > that there is a relation with what is called "token", but I can't > > use it... > > > > Can someone show me how to use it for one of these functions? > > > > Thanks, > > > > Paul. _________________________________________________________________ Découvrez Windows Phone 7 : Une nouvelle ère de téléphones ! http://www.microsoft.com/windowsmobile/fr-fr/cmpn1/windowsphone7series/default.mspx |
Hi,
On Mon, 17 May 2010, Paul Dufouleur wrote: > Thank you for your help last time, but I have still some problem for > using functions described in ij.macro.Functions.java like the method > "getFileList" that I used in macro language. Can someone show me how to > use them (is there an other way than finding those functions in some > other class?)? http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#list() Hth, Johannes |
In reply to this post by Paul Dufouleur
Hi Paul,
you can simply take the code from ij.macro.Functions.java, with a few modifications: Variable[] getFileList() should become String[] getFileList(String dir) 'String dir = getStringArg();' becomes obsolete (needed to get the argument of a macro call) 'return new Variable[0];' should become 'return null;' Omit the code at the end, starting with 'Variable[] array', instead 'return list;' (that code is for conversion of the String array 'list' into the data type used by macros). If you don't care about hidden files or hidden directory, you can also omit the 'if (list[i].startsWith("."))' branch and all code starting with 'int n = list.length-hidden;', this code is only for removing hidden files from the list. Michael ________________________________________________________________ On 17 May 2010, at 14:32, Paul Dufouleur wrote: > Hi everyone, > > > > Thank you for your help last time, but I have still some problem > for using functions described in ij.macro.Functions.java like the > method "getFileList" that I used in macro language. Can someone > show me how to use them (is there an other way than finding those > functions in some other class?)? > > > > > > Thanks, > > Paul. > > > PS: I understood why I didn't find "openAsString", I was using the > 1.39 version source code... > > > > >> Date: Fri, 7 May 2010 10:27:35 +0200 >> From: [hidden email] >> Subject: Re: help for a beginner in plugin with the ImageJ source >> code (use of macro functions)... >> To: [hidden email] >> >> Hi Paul, >> >> many of the macro commands are static functions in ij.IJ. E.g., >> IJ.openAsString(String path). >> If you don't find it there, you have to look at >> ij.macro.Functions.java to see what java code they actually >> correspond to. >> >> Michael >> ________________________________________________________________ >> >> On 7 May 2010, at 00:24, Paul Dufouleur wrote: >> >>> Hi everyone! >>> >>> I wrote some macro with ImageJ and I try rewrote it (and some >>> others) in Java with the source code of ImageJ... but I can't >>> manage to understand how to use functions we can find in >>> "MacroConstants" that were used in the macro, as "isOpen", >>> "nImages" or "openAsString" in the file "Functions". I understand >>> that there is a relation with what is called "token", but I can't >>> use it... >>> >>> Can someone show me how to use it for one of these functions? >>> >>> Thanks, >>> >>> Paul. > > _________________________________________________________________ > Découvrez Windows Phone 7 : Une nouvelle ère de téléphones ! > http://www.microsoft.com/windowsmobile/fr-fr/cmpn1/ > windowsphone7series/default.mspx |
Free forum by Nabble | Edit this page |