// Script function: Image selection dialog. // Requirement: At least open 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 TagGroup GlobalSinoDialog, GlobalSinoItems GlobalSinoDialog = DLGCreateDialog( "2-D image", GlobalSinoItems ) TagGroup EMchoice = DLGCreateChoice( 1 ) TagGroup GlobalSinoIDs = NewTagList() image GlobalSinoImage GetFrontImage( GlobalSinoImage ) while ( GlobalSinoImage.ImageIsValid() ) { if ( 2 == GlobalSinoImage.ImageGetNumDimensions() ) { EMchoice.DLGAddChoiceItemEntry( GlobalSinoImage.GetLabel() + " : " + GlobalSinoImage.GetName() ) GlobalSinoIDs.TagGroupInsertTagAsLong( Infinity(), GlobalSinoImage.ImageGetID() ) } GlobalSinoImage := FindNextImage( GlobalSinoImage ) } GlobalSinoItems.DLGAddElement( DLGCreateLabel( "Please select an image:" ) ) GlobalSinoItems.DLGAddElement( EMchoice ) if ( !Alloc( UIframe ).Init( GlobalSinoDialog ).Pose() ) Throw( "You cancelled!" ) string EMlabel if ( EMchoice.DLGGetNthLabel( EMchoice.DLGGetValue(), EMlabel ) ) Result( "Selected image is '" + EMlabel + "'\n" ) number EMid GlobalSinoIDs.TagGroupGetIndexedTagAsLong( EMchoice.DLGGetValue(), EMid ) GlobalSinoImage := FindImageByID( EMid ) GlobalSinoImage.SetName( "Selected Image" )