
// Script function: Sum and average the mirrored ROIs in different images separately
// Requirement: Open three images

// 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



number GlobalSinoImage = CountImageDocuments()

imageDocument ForEMImageAA = GetImageDocument( GlobalSinoImage-1 )
image EMImageAA := ImageDocumentGetImage( ForEMImageAA, 0 )

 

imageDocument ForEMImageBB = GetImageDocument( GlobalSinoImage-2 )
image EMImageBB := ImageDocumentGetImage( ForEMImageBB, 0 )

 

imageDocument ForEMImageCC = GetImageDocument( GlobalSinoImage-3 )
image EMImageCC := ImageDocumentGetImage( ForEMImageCC, 0 )

// ===

number EMxScaleAA, EMyScaleAA //
GetScale(EMImageAA, EMxScaleAA, EMyScaleAA)
ImageDisplay EMImageDisplayAA=EMImageAA.ImageGetImageDisplay(0)
ROI EMROIAA=EMImageDisplayAA.ImageDisplayGetROI(0)
image EMROIImageAA=EMImageAA[]

// For setting the name:

string EMImageNameAA
GetName(EMImageAA, EMImageNameAA)
ImageDisplay EMROIDisplayAA=EMImageAA.ImageGetImageDisplay(0)
EMROIDisplayAA.ApplyDataBar()
string EMImageAAName=EMImageNameAA
SetName(EMImageAA, EMImageAAName)
 

// ===
number EMxScaleBB, EMyScaleBB //
GetScale(EMImageBB, EMxScaleBB, EMyScaleBB)
ImageDisplay EMImageDisplayBB=EMImageBB.ImageGetImageDisplay(0)
ROI EMROIBB=EMImageDisplayBB.ImageDisplayGetROI(0)
image EMROIImageBB=EMImageBB[]

// For setting the name:

 

string EMImageNameBB
GetName(EMImageBB, EMImageNameBB)
ImageDisplay EMROIDisplayBB=EMImageBB.ImageGetImageDisplay(0)
EMROIDisplayBB.ApplyDataBar()
string EMImageBBName=EMImageNameBB
SetName(EMImageBB, EMImageBBName)

 
// ===

number EMxScaleCC, EMyScaleCC //
GetScale(EMImageCC, EMxScaleCC, EMyScaleCC)
ImageDisplay EMImageDisplayCC=EMImageCC.ImageGetImageDisplay(0)
ROI EMROICC=EMImageDisplayCC.ImageDisplayGetROI(0)
image EMROIImageCC=EMImageCC[]

 
// For setting the name:

string EMImageNameCC
GetName(EMImageCC, EMImageNameCC)
ImageDisplay EMROIDisplayCC=EMImageCC.ImageGetImageDisplay(0)
EMROIDisplayCC.ApplyDataBar()
string EMImageCCName=EMImageNameCC
SetName(EMImageCC, EMImageCCName)
 
// ==

result ("Sum of " + GetName(EMImageAA) + ":" +"\t" + sum (EMROIImageAA)+ "\n")
result ("Sum of " + GetName(EMImageBB) + ":" +"\t"  + sum(EMROIImageBB) + "\n")
result ("Sum of " + GetName(EMImageCC) + ":" +"\t"  + sum(EMROIImageCC) + "\n"+ "\n")

result ("Average of " + GetName(EMImageAA) + ":" +"\t" + mean (EMROIImageAA)+ "\n")
result ("Average of " + GetName(EMImageBB) + ":" +"\t"  + mean(EMROIImageBB) + "\n")
result ("Average of " + GetName(EMImageCC) + ":" +"\t"  + mean(EMROIImageCC) + "\n"+ "\n")

