
// Script function: Count (Sum) pixels with values smaller than a threshold
// 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 GlobalSinoImage

if ( !GetFrontImage( GlobalSinoImage ) )
Throw( "Please open an image." )

Number EMNumber = 20000 // The threshold is 20000 here.

Result( "The total number of pixels with values smaller than " + EMNumber + " is : " + Sum( GlobalSinoImage < EMNumber ? 1 : 0 ) + "\n" ) 
 
 
 

