Customizing EPIX menu driven software is easy! 4MIP/SVIP can be enhanced with script files, which are user-written operations that perform custom algorithms. A script can be as simple as a consolidation of often-used operations, as sophisticated as the implementation of a new processing function, or as ambitious as the creation of a project-specific custom menu. This article will demonstrate how the "Teacher", in the MIPX SCRIPTS menu, provides a simple method for constructing basic script files, and how these basic constructs, if needed, can be enhanced with the introduction of loops and other commands.
EPIX refers to script files as Menu Interactive Programming EXtensions (MIPX). The fundamental tool for building MIPX scripts is "Teacher". Under MIPX SCRIPTS in the main menu is: Teach: Record Commands Into File. Name: . This operation is affectionately know as the "Teacher" because it allows you to teach the software. The Teacher gives you the power to create your own image processing and board control routines.
Creating a MIPX script starts with the desire to develop something better. EPIX programmers may not have yet written the ideal operation for your particular application, so you call on the Teacher for help. You begin by selecting a name for your MIPX Script and entering it into the Teacher. The next step is to perform your process with existing menu selections and commands. The Teacher records all of your interactive menu operations into a script file. Once the appropriate selections and commands have been executed, you return to the MIPX SCRIPTS menu and execute :Teach:Stop & Close File. You have just created a MIPX script! It's that simple! You have a sequence of EPIX software operations that have been consolidated into a single command. To review what you have done, move the cursor to, Execute MIPX Script File, and enter the name of the script you have just created-your script will be executed exactly the way you wrote it. Now you have a script file that can be edited as ASCII text. Most dedicated DOS editors, as well as most word processing programs, can serve this function.
Example Scripts
MIPX Script 1 shows an example script file created with the Teacher. This script captures a sequence of images and performs a threshold on the first one.
Automatic Repetitionn
Some imaging applications require a set of operations to be performed multiple times on a single image. Other applications may require a single set of operations to be applied to many different images. Executing the same routine multiple times can become tedious. Such applications are prime candidates for MIPX scripting. Consider the need to threshold several images located in on-board memory.
Move Thru Buffers with PGUP
The obvious method of creating a script to threshold several buffers is, after activating the Teacher, to threshold each image in the sequence, using the PAGE-UP key to move to the next image buffer. The PAGE-UP key will be recorded in the script file as: {!}KEY 0x4900 PGUP. The program would contain the following command sequence repeated for all images required:
Commands which utilize function keys are recorded as brace commands "{!}," as demonstrated above with the PAGE-UP key. Any additional commands programmed by the user, such as loops, etc., are also brace commands.
Move Thru Buffers with Loop
A better method to implement sequential thresholding is to use a loop. Using a DOS editor, a simple WHILE loop is added which automatically moves through the sequence of buffers and executes the threshold operation. MIPX Script 2 shows the modified script file written for a sequence of 16 images. The name "i" is used as a counter. The "@" operator means, "The Contents Of . . ."; lines 7, 8, 14, 15, and 16 contain commands programmed by the user {note the braces}. Line 7 sets the counter to one, and lines 8 and 16 create a loop which is executed "i" times (in this case, 16). Line 15 increments the counter.
Saving Multiple Images as TIFF Files
MIPX scripts can also be used to quickly save a sequence of images as individual TIFF files. MIPX Script 3 demonstrates how a loop, using counter "j" automatically names and save the images. Note that line 2 initializes the current image buffer to 1, so that the images are saved in ascending order. Line 9 shows how the counter can be used to identify and name each image saved. Line 8 prints, "Saving Images To Disk." on the display monitor for the duration of the saving operation.
Summary
The above examples demonstrate how easily a script file can be created. The Menu Interface & Scripts manual, provided with 4MIP/SVIP, provides many other commands that can be used to enhance a script file or to create a custom menu. Please contact EPIX if you have any questions, and continue to read future editions of EPIX Vision for more hints and examples of better image processing by use of MIPX.
MIPX Script 1
1 <QuitMenu RETURN TO MAIN MENU 2 > MotionSequenceCapture/Display 3 !DigitizeSequence.Period: 1 4 <QuitMenu 5 >ImageProcessing 6 >SimplePixelOperations 7 ^ Threshold:Lowbound 200 [ LINES 7-11 DETERMINE 8 ^ Threshold:Highbound 255 THRESHOLD VALUES 9 ^ Threshold:NewValue 255 AND AREA OF INTEREST ] 10 !ThresholdPixelValues 11 !ImageAreaoflnterest:FullImage 12 <QuitMenu 13 <QuitMenu 14 >MIPXScripts BACK TO MIPX SCRIPTS MENU
MIPX Script 2
1 <QuitMenu 2 > MotionSequenceCapture/Display 3 !DigitizeSequence.Period: 1 4 <QuitMenu 5 >ImageProcessing 6 > SimplePixelOperations 7 {!}SET i 1 COUNTER "i" to 1 8 {!}WHILE {@i}<17 LOOP 16 TIMES 9 ^ Threshold:Lowbound 200 10 ^ Threshold:Highbound 255 11 ^ Threshold:NewValue 255 12 !ThresholdPixelValues 13 ! ImageAreaoflnterest : Fulllmage 14 {!}KEY 0x4900 PGUP 15 {!}SET i {@i}+l INCREMENT COUNTER 16 {!}ENDWHILE CONTINUE LOOP 17 <QuitMenu 18 <QuitMenu 19 >MIPXScripts
MIPX Script 3
1 >VideoDigitize/Display 2 !CurrentlmageBuffer 1 3 <QuitMenu 4 {!}SET j 1 SET COUNTER "j" TO 1 5 >ImageFileLoad/Save 6 > FileLoad/Save,TIFFFormatw.AOI 7 {!}WHILE {@j}<17 LOOP 16 TIMES 8 {!}MESSAGE { Saving Images To Disk. } ON-SCREEN MESSAGE 9 !SavelmagetoFile.Name: IMAGE_{@j}.TIF ( COUNTER "j" IS USED 10 !ImageAreaoflnterest:Fulllmage TO NAME IMAGES ) 11 {!}SETj {@j}+l 12 {!}ENDWHILE CONTINUE LOOP 13 {!}MESSAGE { All Files Saved -- End Of Program.} 14 <QuitMenu 15 <QuitMenu
EPIX Vision - April 1994 Newsletter
Specifications and prices subject to change without notice.
EPIX® imaging products are made in the USA.
Copyright © 2024 EPIX, Inc. All rights reserved.