Login  Register

Re: The acceptance of variable names by ImageJ Commands

Posted by Michael Schmid on Jun 24, 2011; 4:50pm
URL: http://imagej.273.s1.nabble.com/The-acceptance-of-variable-names-by-ImageJ-Commands-tp3684137p3684138.html

Hi Dan,

'Scale' accepts variables for the *scale factors*, both in java  
concatenation form ('+') and through the '&' operator in the String.  
Example:

   xScale=0.5;
   yScale=1.5;
   run("Scale...", "x="+xScale+" y=&yScale interpolation=Bilinear  
average create title=scaledImage");

(before trying, fix possible line breaks in the long line caused by  
the mailer)

When called from macros, 'Scale' only honors the scale factors, not  
the image sizes in pixels.
So, the following will not work (whether variables or constants are  
used):

   run("Scale...", "width=123 height=456 interpolation=Bilinear  
average create title=newImage");

Instead, you can use the Adjust>Size command (but it won't create a  
new image):

   run("Size...", "width=123 height=456 average  
interpolation=Bilinear");

Michael
________________________________________________________________

On 24 Jun 2011, at 18:31, Daniel W McDonald wrote:

> Hi List,
>
>
>
> I am running ImageJ 1.45i under Linux Ubuntu11.04.
>
>
>
> Some ImageJ Commands which are run in macros with the "Run ( )"  
> commands
> accept variables for parameter assignments.  For instance opening a  
> raw
> image file Run("Raw." requires passing the width and the height of  
> the file
> in pixels.  You can specify the width and height explicitly with  
> integers or
> you can use variable names such as "pwidth" and "pheight."  Both  
> work just
> fine.
>
>
>
> Other ImageJ commands such as Run("Scale." only accept explicit  
> numbers and
> not variables for the pixel size of the requested width and height  
> of the
> scaled image.  Is there a summary of which commands accept what  
> type of
> argument?  Other than Java source code?  Will any ImageJ commands  
> accept
> array variable values?
>
>
>
> Regards,
>
>
>
> Dan