Author Topic: Exporting Bruker EDS spectra  (Read 13323 times)

Probeman

  • Emeritus
  • *****
  • Posts: 2839
  • Never sleeps...
    • John Donovan
Exporting Bruker EDS spectra
« on: June 02, 2014, 11:27:15 AM »
This useful info was posted by Andrew Wager at UMN on the microscopy listserver and I thought worth re-posting here:

I actually figured it out yesterday with some helpful comments from another listserv member and it's just as you said. The format is Lispix ( http://www.nist.gov/lispix/ and for those who use EDX but might not be aware, see also HyperSpy, http://hyperspy.org/ and DTSA-II, http://www.cstl.nist.gov/div837/837.02/epq/dtsa2/ ). It is a
raw binary format with each bit of data in a continuous stream, i.e. no delimiter. Each channel of the first pixel is followed by each channel of the second pixel (left to right, top to bottom). An associated "rpl" file tells you the channel depth per pixel and the height and width of the spectrum image. It is uncalibrated (in space
and energy) so that must be taken care of by hand. Bruker opts for 8-bit data, so if you happen to have more than 255 counts in any channel you will have trouble. Esprit appears to truncate the data at the last channel with any counts for sake of file size, so the channel depth is important and potentially variable.

Lispix works great for spectra analysis and moving this data into DTSA. I have not played much with HyperSpy yet. On the off chance anyone else is interested in getting the data into Matlab, feel free to contact me. I put together a matlab script to read the file into a datacube and also perform some basic processing. Simple, but if it
saves someone some time in Matlab, great. I am looking at some exceptionally beam sensitive specimens, so I am playing with probe size, step size, dwell time, and probe current to see what compromises I can make while being able to spatially resolve changes in relative composition.  That's where Matlab comes in as I'd like to do running sums of the spectra while also doing 2-D running pixel sums as opposed to just binning or increasing probe size or step size.

Some nice discussion of EDX sensitivity, SDD detectors, and approaches to analysis can be found in this powerpoint:

http://epmalab.uoregon.edu/Workshop2/DonovanWorkshop07_SDD_Newbury.pdf
and this associated paper:

http://www.geology.wisc.edu/~johnf/g777/Scanning/NewburyBright-2005.pdf

Cheers,
Andrew

Note that Probe for EPMA allows for export of EDS spectra in Lispix format as shown here:

« Last Edit: October 13, 2014, 11:55:36 PM by John Donovan »
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 2839
  • Never sleeps...
    • John Donovan
Re: Exporting Bruker EDS spectra
« Reply #1 on: June 02, 2014, 12:13:23 PM »
Zack Gainsforth adds the following comments:

Hi Andrew,
Last year, I made a video and an ImageJ plugin for doing this for stacks acquired from the Bruker EDS on the Titan TEM at NCEM.

So here is about a 15 minute video where I import the data into ImageJ, make maps, make an RGB, export a spectrum from ImageJ and load it in a spectrum processing software:

https://berkeley.box.com/s/bya3oaiqat25hxwrsate

And here are the links to the source code for the ImageJ plugin which you can use as a starting point for whatever you want to do:

https://berkeley.box.com/s/bd74bnmg405lppfmfakd

and

https://berkeley.box.com/s/brtal2oz4hztj8wfws3y

I hope you find it helpful,

Zack Gainsforth
Space Sciences Laboratory, UC Berkeley
7 Gauss Way
Berkeley, CA
« Last Edit: June 02, 2014, 12:16:24 PM by Probeman »
The only stupid question is the one not asked!

brookzee

  • Student
  • *
  • Posts: 1
Re: Exporting Bruker EDS spectra
« Reply #2 on: January 26, 2017, 04:40:04 PM »
Hi Zack, I'll be the first to say thank you for the informative video, very useful.

I realize this is an old post, but I am having some issues running the .py script to automate the slicing and averaging in ImageJ.

I'm getting this error when trying to compile the .java file in ImageJ (see attachment)

I even changed the root directory in the .java to look for my .py script under the Plugins folder:

import ij.plugin.PlugIn;
import org.python.util.PythonInterpreter;
public class MapFromStackROI implements PlugIn {
  public void run(String arg) {
    // create a Python interpreter
    PythonInterpreter py = new PythonInterpreter();
    // execute the Python file containing the source code for this ImageJ plugin
    py.execfile("/Applications/ImageJ/plugins/Scripts/MapFromStackROI.py");
  }
}


Any help from the Probe forum members is appreciated!

Regards,
Adam
Queen's University, Canada
« Last Edit: January 26, 2017, 05:01:08 PM by John Donovan »

Zack Gainsforth

  • Graduate
  • **
  • Posts: 7
Re: Exporting Bruker EDS spectra
« Reply #3 on: January 27, 2017, 10:07:42 AM »
Hi Adam,

I'm glad you find the plugin interesting and (hopefully) useful!

The error you are having doesn't seem to be a problem with finding the plugin, but rather it doesn't seem to be finding the Python interpreter.  ImageJ is a Java app, so it uses the Jython interpreter -- which is a Python written in Java.  It may be that you have to install a jython component: take a look at http://marcora.caltech.edu/jython_imagej_howto.htm.  If not, ping me again, and we'll see what else could be happening.

If you are doing a lot of this, then you may also find a pure python command-line based version more useful.  It can process many stacks at once and is more robust (e.g. it figures out the dimensions of your data cube automatically and some other goodies).

That code is part of the OpenNCEM project: https://bitbucket.org/ercius/openncem/overview and you are looking for MakeMapsFromTitanRaw.py.

(I wrote it for the Titan TEM we use here at NCEM, hence the name.)

Zack