void CalculateAndShowMap(image data,string Element,number bcgrd_Start,number bcgrd_Width,number signal_Start,number signal_Width)
{
number bcgrd_End = bcgrd_Start + bcgrd_Width
number signal_End = signal_Start + signal_Width

number scale = data.ImageGetDimensionScale(0)
string units = data.ImageGetDimensionUnitString(0)

image Map = ExtractEELSSignal112(data,bcgrd_Start,bcgrd_End,signal_Start,signal_End)

Map.imagesetName(Element)
Map.ImageSetDimensionCalibration(0,0,scale,units,1)
Map.ImageSetDimensionCalibration(1,0,scale,units,1)

Map.showimage()
}


image data := getFrontImage()

number O_bcgrd_Start = 480
number O_bcgrd_Width = 50
number O_signal_Start = 530
number O_signal_Width = 40

number Mg_bcgrd_Start = 1220
number Mg_bcgrd_Width = 80
number Mg_signal_Start = 1300
number Mg_signal_Width = 60

number Al_bcgrd_Start = 1475
number Al_bcgrd_Width = 80
number Al_signal_Start = 1560
number Al_signal_Width = 80

CalculateAndShowMap(data,"O",O_bcgrd_Start,O_bcgrd_Width,O_signal_Start,O_signal_Width)
CalculateAndShowMap(data,"Mg",Mg_bcgrd_Start,Mg_bcgrd_Width,Mg_signal_Start,Mg_signal_Width)
CalculateAndShowMap(data,"Al",Al_bcgrd_Start,Al_bcgrd_Width,Al_signal_Start,Al_signal_Width)

