
// Script function: Measure the angle of a line ROI on an image
// Requirement: Open at least one image

// 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 EMImage := GetFrontImage()
ImageDisplay GlobalSinoDisp = EMImage.ImageGetImageDisplay(0)
ROI EMLineROI = GlobalSinoDisp.ImageDisplayGetRoi(0)
if ( EMLineROI.RoiIsValid() )
{
if ( EMLineROI.RoiIsLine() )
{
number EMx0,EMy0,EMxE,EMyE
EMLineROI.RoiGetLine(EMx0,EMy0,EMxE,EMyE)
Number EMPi = 3.14159265358979323846264338327950288419716939937510
number EMy = EMyE - EMy0
number EMx = EMxE - EMx0
number EMangle = -atan( EMy / EMx ) * 180/EMPi

Result("\n The line angle is: " + EMangle + " degree.")
}
}