Login  Register

Re: getting length of an image for a macro

Posted by Michael Schmid on Jan 28, 2014; 10:18am
URL: http://imagej.273.s1.nabble.com/getting-length-of-an-image-for-a-macro-tp5006311p5006312.html

Hi Jose,

you can get the values of 'key = value' and 'key: value' lines in the ImageInfo with the getInfo('key') macro command (a space is needed before the "=" sign, but no space before the colon).
In your case, you probably want to use it as a number, not as a String (text), so you have to use parseFloat to convert it into a number:

parseFloat(getInfo("DimensionDescription|Length 1"));

Michael
________________________________________________________________
On Jan 28, 2014, at 11:11, Jose Guzman wrote:

> Hi
>
> I would like programmatically obtain the length (in seconds) of an image obtained with an SP5 microscope (Leica Microsystems).
>
> Currently, I can see the length in Image->Properties as
>
> >>> DimensionDescription|Length 1 = 4.000000e+000
>
> I wondered whether there's something like getDimensions(); to obtain that value and use it in a macro.
>
> Thanks in advance
>
> Jose
>
> --
> Jose Guzman
> http://www.ist.ac.at/~jguzman/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html