setLut and getLut Commands

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

setLut and getLut Commands

Jason NoSpam
I am trying to convert the below macro into an ImageJ plugin.  However, the LUT functions getLut and setLut don't want to work as a plugin in all permutations I have tried. I get an error on setLut that the wrong number of arguments has been past to the function when I try to call it as below.

IJ.Macro.Functions.SetLUT(r,r,r)
 
 Do I need to setup/call/? the LUTs differently to use them in a Plugin versus a macro?
 
 ****Original Macro*******
   macro "Gamma [F1]" {
       getLut(r, g, b);
       gamma = gamma + 0.005;
       for (i=0; i<256; i++) {
           r[i] = pow(r[i]/255, gamma)*255;
       }
       setLut(r, r, r);
   }
 ************************
 
 
 
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
Reply | Threaded
Open this post in threaded view
|

Re: setLut and getLut Commands

Wayne Rasband
You can find out how to duplicate in a plugin what the getLut() and  
setLut() macro functions do by looking at the source for the getLut()  
and setLut() methods in the Functions class. The source is online at

       http://rsb.info.nih.gov/ij/developer/source/ij/macro/ 
Functions.java.html

-wayne

> I am trying to convert the below macro into an ImageJ plugin.  
> However, the LUT functions getLut and setLut don't want to work as  
> a plugin in all permutations I have tried. I get an error on setLut  
> that the wrong number of arguments has been past to the function  
> when I try to call it as below.
>
> IJ.Macro.Functions.SetLUT(r,r,r)
>
>  Do I need to setup/call/? the LUTs differently to use them in a  
> Plugin versus a macro?
>
>  ****Original Macro*******
>    macro "Gamma [F1]" {
>        getLut(r, g, b);
>        gamma = gamma + 0.005;
>        for (i=0; i<256; i++) {
>            r[i] = pow(r[i]/255, gamma)*255;
>        }
>        setLut(r, r, r);
>    }
>  ************************
Reply | Threaded
Open this post in threaded view
|

Re: setLut and getLut Commands

Jason NoSpam
Thanks Wayne.

I am still having problems calling the getLut() method in a plugin.  I did the following:

Interpreter in=null;
Program pgm=null;
Functions f = new Functions(in,  pgm);
f.getLut();

And I get :"No method matching getLut() found in class ij.macro.Functions." so I assume I am calling this improperly?

Do you have an example of a plugin that uses either the getLut and setLut functions or any macro function?

Thanks!


Rasband Wayne <[hidden email]> wrote: You can find out how to duplicate in a plugin what the getLut() and  
setLut() macro functions do by looking at the source for the getLut()  
and setLut() methods in the Functions class. The source is online at

       http://rsb.info.nih.gov/ij/developer/source/ij/macro/ 
Functions.java.html

-wayne

> I am trying to convert the below macro into an ImageJ plugin.  
> However, the LUT functions getLut and setLut don't want to work as  
> a plugin in all permutations I have tried. I get an error on setLut  
> that the wrong number of arguments has been past to the function  
> when I try to call it as below.
>
> IJ.Macro.Functions.SetLUT(r,r,r)
>
>  Do I need to setup/call/? the LUTs differently to use them in a  
> Plugin versus a macro?
>
>  ****Original Macro*******
>    macro "Gamma [F1]" {
>        getLut(r, g, b);
>        gamma = gamma + 0.005;
>        for (i=0; i<256; i++) {
>            r[i] = pow(r[i]/255, gamma)*255;
>        }
>        setLut(r, r, r);
>    }
>  ************************


 
---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.