dm-script

Reconstructing EELS Spectra from Individual Files for SI-picker


I have EELS spectra from a STEM experiment that were unfortunately output into individual files instead of a single stack. Given that the dimensions in the real and EELS space are known, would it be possible to allocate the spectra and reconstruct an image recognizable by SI-picker?

I regret to say that I did not get too far, but I have replicated my situation by generating a set of line spectra filled with random values and saving each into a file.

number numSpectra = 100
number spectrumLength = 512
string baseName = "spectrum_"
string saveDir
GetDirectoryDialog(saveDir)
Image spectrumImage := RealImage("spectrum", 4, spectrumLength)

for( number i = 0; i < numSpectra; i++)
{
    for( number j=1; j< spectrumLength; j++)
    {
        spectrumImage.SetPixel(j, 0, Random()*100)
    }

    string filename = saveDir + baseName + (i + 1)
    spectrumImage.SetName(filename)
    spectrumImage.Save()
    spectrumImage.ShowImage()
}   

Solution

  • This would for sure work, provided the EELS spectra are all the same number of channels (and hopefully calibrated the same.) But you should not iterate over intividual pixels, or you will wait for a very long time. Instead, you need: