> On Apr 27, 2015, at 12:18 PM, moxed <
[hidden email]> wrote:
>
> Hi all,
>
> I have very limited programming experience but have been working with the
> ImageJ macros to make my life a little easier. I'm just writing the macros
> in the ijm format.
>
> For downstream calculations, I need certain pieces of information stored in
> the Image Info/metadata.
>
> Right now I have the user input the information manually:
> s= getNumber("enter pixels/um", 2.2756)
>
> But I would like the information to be pulled automatically from the image
> data
You can use getPixelSize(unit,pixelWidth,pixelHeight) to retrieve the resolution of the current image. For example, this macro
run("Neuron (1.6M, 5 channels)");
getPixelSize(unit, pixelWidth, pixelHeight);
print("Resolution: "+ 1/pixelWidth + " pixels/"+unit);
outputs
Resolution: 6.25 pixels/µm
-wayne
> For certain values, which are unitless in the Show Info file, this command
> works fine:
>
> b= getInfo("ImageLength");
> print(b);
>
> but for values that have a unit, like resolution, I am unable to store just
> the value in a variable. So a command like:
>
> a= getInfo("Resolution");
> print(a);
>
> returns nothing and does not work.
>
> Is there a simple fix around this?
>
> Thanks in advance!
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Store-metadata-in-a-user-defined-variable-getInfo-tp5012626.html> Sent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html