I have used the following script to extract an EELS spectrum from a 3D spectrum-image.
(This script was published answering a similar question.)
number px = 5
number py = 3
image SIblock := GetFrontImage()
number sx, sy, sz
Get3DSize( SIblock, sx, sy, sz )
image spec := Slice1( SIblock, px,py,0, 2,sz,1 )
image specCopy := ImageClone( spec )
ShowImage( specCopy )
However, when I try to analyse the spectrum (for instance with EELS Quantification), I obtain the following result:
No valid EELS data front-most
I assume that I have not properly extracted the metadata.
What am I doing wrong? Thank you in advance.
When you do an ImageClone()
you copy all tags and calibrations. In particular, you copy the Meta Data info which tells DM that the data is a Spectrum Image
However, the extracted spectrum is no longer an SI, it is a spectrum. You therefore need to change this tag (before the image is displayed).
You can do this, with a little adjustement of the script:
number px = 5
number py = 3
image SIblock := GetFrontImage()
number sx, sy, sz
Get3DSize( SIblock, sx, sy, sz )
image specCopy := SIblock.Slice1( px,py,0, 2,sz,1 ).ImageClone()
specCopy.ImageGetTagGroup().TagGroupSetTagAsString( "Meta Data:Format", "Spectrum" )
ShowImage( specCopy )