
// Script function: Mask a triangle of an image
// Requirement to run the script: Open an 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 imgInitial, ImgMaskA, ImgMaskB, ImgMaskC, ProducedImg

if ( !GetFrontImage( imgInitial ) )
 Throw( "Please open an image." )

ImgMaskA = imgInitial * 0      
ImgMaskA = ( icol >= irow ) ? 1 : 0                

ImgMaskB = imgInitial * 0      
ImgMaskB = ( (icol/2) >= irow ) ? 1 : 0                

ImgMaskC = abs(ImgMaskA-ImgMaskB)

ProducedImg := ImgMaskC ? imgInitial : 0

SetName( ProducedImg, GetName( imgInitial ) + " masked" )
ShowImage( ProducedImg ) 
