// Script function: Sum the counts of a ROI in a spectrum. // Requirement: Open a spectrum and then draw a ROI on it // Unless named starting with GlobalSino, EM, My, Self, the function commands are defined //by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html image GlobalSinoImage if ( !GetFrontImage( GlobalSinoImage ) ) Throw( "Please open a spectrum and draw a rectangle ROI" ) GlobalSinoImage:=getfrontimage() ImageDisplay EMImage=GlobalSinoImage.ImageGetImageDisplay(0) if( 1 != EMImage.ImageDisplayCountROIs()) Throw( "Please draw a rectangle ROI" ) ImageDisplay EMImageDisplay=GlobalSinoImage.ImageGetImageDisplay(0) ROI EMROI=EMImageDisplay.ImageDisplayGetROI(0) image EMROIImage=GlobalSinoImage[] ShowImage(EMROIImage) ImageCopyCalibrationFrom(EMROIImage, GlobalSinoImage) string EMImageName GetName(GlobalSinoImage, EMImageName) ImageDisplay EMROIDisplay=EMROIImage.ImageGetImageDisplay(0) EMROIDisplay.ApplyDataBar() string GlobalSinoImageName="ROI from " + EMImageName SetName(EMROIImage, GlobalSinoImageName) number EMImageSum EMImageSum= sum(EMROIImage) result ("Sum of the ROI is: " + EMImageSum + "\n") EMROIImage.SetName("Summed area " + EMROIImage.GetName()) ShowImage(EMROIImage)