
// Script function: Mask all pixels with higher value than their left neighbor (adjacent pixel) 
// Requirement: 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 GlobalSinoInput, GlobalSinoMask, GlobalSinoOutput

if ( !GetFrontImage( GlobalSinoInput ) )
Throw( "No image loaded." )

GlobalSinoMask = GlobalSinoInput * 0        
GlobalSinoMask = ( GlobalSinoInput[ icol-1, irow ] < GlobalSinoInput[ icol, irow ] ) ? 1 : 0                

GlobalSinoOutput := GlobalSinoMask ? GlobalSinoInput : 0
SetName( GlobalSinoOutput, GetName( GlobalSinoInput ) + " masked" )
ShowImage( GlobalSinoOutput ) 
 
