Login  Register

Re: returning results of plugins within macros

Posted by Frederic V. Hessman on Aug 05, 2008; 2:00pm
URL: http://imagej.273.s1.nabble.com/returning-results-of-plugins-within-macros-tp3695452p3695455.html

OK - only works for plugins.  Got it....   I had wanted to avoid using  
an otherwise not so interesting plugin, but hey!, at least it works!

Rick

On 5 Aug 2008, at 3:43 pm, Frederic V. Hessman wrote:

> Ah yes - I forgot "call".
>
> Using 1.38x and the following method of my FitsJ class
>
>        public static String getCardValueFromFile (String key,  
> String image)
>
> in a package located in the jar
>
> plugins/astroj.jar
>
> and invoking call via the macro
>
> title = getTitle();
> exptime = call("FitsJ.getCardValueFromFile","EXPTIME",title);
>
> I get an error message sayting that ImageJ can't find the FitsJ  
> class, a problem normal plugins don't have.   Even tried renaming  
> the jar to astroj_.jar......
>
> Rick
>
> On 5 Aug 2008, at 2:49 pm, Ben Tupper wrote:
>
>> On Aug 5, 2008, at 8:21 AM, Frederic V. Hessman wrote:
>>
>>> I looked at the documentation, but I can't find a way of using the  
>>> non-image result of a plugin in a macro.
>>>
>>
>> Hello,
>>
>> I think you want the macro command call("class.method", arg1,  
>> arg2, ...) See http://rsb.info.nih.gov/ij/developer/macro/functions.html#C 
>>  for more info.  The run("command", ...) command is used to call  
>> ImageJ menu commands which is a little different. Your FITS reader  
>> plugin will have to have a static method to return the contents of  
>> the FITS header as a string (or strings that have been concetenated  
>> into one string) to the macro.
>>
>> Cheers,
>> Ben
>>
>>
>>> I want to be able to pull an entry out of a FITS image header and  
>>> use it in a macro, something like
>>>
>>> exposuretime=run("Read FITS Header","image=[] key=[EXPTIME]");
>>>
>>> Any ideas?  An alternative would be to be able to use Prefs within  
>>> a macro, e.g.
>>>
>>> run("Read FITS Header", "key=EXPTIME");
>>> exposuretime=Prefs.get("fits.result");
>>>
>>> This functionality would come in handy for other reasons.
>>>
>>> Rick
>>>
>>> ------------------------------------------------------------------------------------------------
>>> Dr. Frederic V. Hessman     [hidden email]
>>> Institut für Astrophysik          Tel.  +49-551-39-5052
>>> Friedrich-Hund-Platz 1         Fax +49-551-39-5043
>>> 37077 Goettingen                 Room F04-133
>>> http://www.Astro.physik.Uni-Goettingen.de/~hessman
>>> -------------------------------------------------------------------------------------------------
>>> MONET: a MOnitoring NEtwork of Telescopes
>>> http://monet.Uni-Goettingen.de
>>> -------------------------------------------------------------------------------------------------
>>
>> Ben Tupper
>> [hidden email]
>>
>> I GoodSearch for Ashwood Waldorf School.
>>
>> Raise money for your favorite charity or school just by searching  
>> the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!