Login  Register

Re: Extracting .tif Metadata from SEM image?

Posted by Silas Kraus-2 on May 18, 2017; 2:03pm
URL: http://imagej.273.s1.nabble.com/Extracting-tif-Metadata-from-SEM-image-tp5018744p5018752.html

Hello, Kees.

Thanks for the help. The code using "split" will be helpful to isolate
the numerical value once I have the raw data. However,
"print(getMetadata("Info"));" only returns an empty Log window. I am not
sure what is the difference between "getMetadata("Info")" and "run("Show
Info...");"  , which works but does only show general information about
image resolution and file size.

Reading through the Builtin Macro Functions, I discovered "indexOf" and
"substring" which could be useful to find the data in the bulk text.
However, I would still need a way to parse the image as a text string.
Actually, is that really a good idea to try and parse a 10MB image file
as text?

Greetings.
Silas





On 18/05/2017 10:50, Straatman, Kees (Dr.) wrote:

> Dear Silas,
>
> In general I think you can get the header info via
> getMetadata("Info") or maybe via getImageInfo()
>
> I don't know the format of your header but to start with try for
> example:
>
> print(getMetadata("Info")); find the line with the data you want to
> extract and put it into the code below where you replace the 1 in N =
> lines[1] with the line number -1 you want to extract.
>
> print(getMetadata("Info")); selectWindow("Log"); lines =
> split(getInfo(),"\n"); N = lines[1]; print(N);
>
>
> Best wishes
>
> Kees
>
>
> Dr Ir K.R. Straatman Senior Experimental Officer Advanced Imaging
> Facility Centre for Core Biotechnology Services University of
> Leicester
> http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif
>
>  ImageJ workshops 1 and 2 June:
> http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/AIF/workshops/imagej-workshops-June-2017
>
>
>
> -----Original Message----- From: Silas Kraus
> [mailto:[hidden email]] Sent: 17 May 2017 23:16 To:
> [hidden email] Subject: Extracting .tif Metadata from SEM
> image?
>
> Greetings.
>
> I am using Fiji to analyse images taken with a Scanning Electron
> Microscope (FEI Quanta 250). I want to analyse particle density and
> therefore need the magnification or Pixel size. The SEM stores this
> data as text in the .tif file together with many other metadata, but
> Fiji's "Show Info..." function does not show this data. Debug mode
> won't do the trick either.
>
> I managed to fetch the information with the simple bash-command:
>> "grep --text -e Pixel -i <image.tif>"
> But my goal is to write a single ImageJ macro that I can give to my
> colleagues who are working on Windows, with just Fiji and maybe a few
> plugins installed.
>
> So, my question is: How can I find a text line in a .tif file that
> reads something like "PixelSize = 1.4681e-008" and process the
> number, all in a simple ImageJ macro?
>
> I've been searching the Internet for a few days now. There seem to be
> a few similar discussions online, but I didn't manage to make use of
> them, mostly because they often involve Java programming, which I
> understand nothing about. Any help would be greatly appreciated.
>
> Silas Kraus
>
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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