

// Script function: Remove all the annotations on the most-front image.
// Requirement: At least one opened 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 GlobalSinoImg := GetFrontImage()
imageDisplay EMDisplay = GlobalSinoImg.ImageGetImageDisplay(0)


number MyAllAnnotations = EMDisplay.ComponentCountChildren()
OKDialog( "There are " + MyAllAnnotations + " child components on the most-front image totally.\nRemoving them now." )
for( number i = 0; i<MyAllAnnotations; i++ )
{
    component SelfAnnotation = EMDisplay.ComponentGetChild( 0 )     
    SelfAnnotation.ComponentRemoveFromParent()
}

// Script to remove a specific type of annotations: 
// http://www.globalsino.com/EM/page2597_annotation2.s