void PerformBatchAction( imageDocument doc ) { // Modify this method to act on the imageDocument or image // Current action: Output the data type and some statistics of first image in document image img := doc.ImageDocumentGetImage( 0 ) result( "\t\t Data range [ " + min( img ) + ", " + max( img ) + "] mean = " + mean( img ) + "\n" ) } if ( TwoButtonDialog( "Perform action on all images...", "across all Workspaces", "on the active Workspace" ) ) { number nWS = WorkspaceGetCount() for( number w = 0; w < nWS ; w++ ) { number wsID = WorkspaceGetFromIndex( w ) string wsName = WorkSpaceGetName( wsID ) number nDocs = CountImageDocuments( nWS ) result( "\n Performing action on " + nDocs + " documents on '" + wsName + "':\n" ) for( number i = 0 ; i < nDocs ; i++ ) { imageDocument doc = GetImageDocument( i, nWS ) PerformBatchAction( doc ) } } } else { number nDocs = CountImageDocuments() result( "\n Performing action on " + nDocs + " documents:\n" ) for( number i = 0 ; i < nDocs ; i++ ) { imageDocument doc = GetImageDocument( i ) PerformBatchAction( doc ) } }