|
|
3DBasic Summary3DBasic is a Basic-like scripting language implemented to allow programming with 3D-DOCTOR¡¯s advanced image processing functions. This enables the user to perform sophisticated tasks in batch mode. A 3DBasic program can be created using a text editor, such as Windows NotePad or use 3D-DOCTOR¡¯s 3DBasic/Create command. Use 3DBasic/Run to run an existing 3DBasic program directly.
Key Features
3DBasic supports most of the standard Basic commands, including
In addition, 3DBasic provides a new set of commands to provide enhanced functionality for programming and image processing . The new commands include:
3DBasic supports different variable types, including INTEGER (32-bit long), FLOAT (64-bit double), STRING (variable length text string) and IMAGE3D (a data container for 3D images, boundaries, and other data). The following are some examples of some commonly used 3DBasic programs. Example for Image Segmentation:
Example for Simple Surface Rendering:
Example for saving image slices to separate image files:
1. REM statementThis command indicates that the entire line following REM is only comment and will not affect the program execution. Syntax:
Example:
2. LOGFILE statementThis command defines the output file where it stores all information generated by the PRINT command. Besides the PRINT command, all error messages will also be saved to the log file. Syntax:
where, STRING outputname This command can be used more than once in a program to define different log files for PRINT output.
3. INTEGER statement
INTEGER is used to declare integer variables. Syntax:
where, I, J, and K are the names of integer variables. An integer variable is 32-bit long and must be declared before it is used in the program. Example:
4. FLOAT statementFLOAT is used to declare float variables. Syntax:
where, X1, Y, and y1 are the names of float variables. Example:
5. STRING statementSTRING is used to declare variables that are text string. Syntax:
where, Name1, note, and name2 are text strings. Example:
6. IMAGE3D statementIMAGE3D is used to declare 3D image variables. IMAGE3D variables can contain image data, boundary data, and other types of data created using 3D-DOCTOR¡¯s processing functions. Syntax:
where, image1, Image10, and T1 are images. Example:
7 ASSIGNMENT statementAssignment statements are used to assign a value to a declared variable, which can be an integer, float, or string. Syntax:
Example:
8. PRINT statementThe PRINT statement prints values of variables, expressions, and text strings to the file defined by the LOGFILE statement. Syntax:
Example:
9. INPUT statementThe INPUT statement allows interactive assignment of values to variables. Syntax:
Example:
10. GOTO statementThe GOTO statement is one of several ways implemented in 3DBasic to control program flow. Syntax:
where, the Label is a numeric value indicating the line where the program continues. 3DBasic does not require a Label for each line. Only a line that is a target line of a GOTO statement must have a label. Example:
11. IF statementThe IF statement implemented in 3DBasic is slightly different from the standard Basic format. The ELSE statement is not supported and only "<", ">" and "=" can be used as operators. Syntax:
Example:
12. FOR loop statementThe FOR loop allows implementing sophisticated programs to repeat certain operations with different variable values. Syntax:
where, the "Control Variable" will start with the "Starting Value", and run the program through the "NEXT" statement and then increment the "Control Variable" by 1, and repeat the operation until the "Control Variable" is the same as the "Ending Value". Example:
13. GOSUB and RETURN statementsSame as the standard Basic, the use of GOSUB and RETURN allows implementation of subroutines. Syntax:
Example:
14. OPENIMAGE statementThis command opens an image or project file for processing. It is similar to the File/Open Image function. Syntax:
where, IMAGE3D imagevar STRING filename Example:
15. SAVEIMAGE statementThis command saves specified image planes to a file where both start and end planes are included. The image must be currently open and the start and end planes must exist. If the start plane is the same as the end plane, then only this plane is saved. This command is similar to File/Save Image As command. Syntax:
where, IMAGE3D imagevar, STRING filename, INTEGER startplane endplane Example:
16. SAVEIMAGEPLANE statementThis command saves the current active image plane to a file. An image plane can be set to active by using the SETIMAGEPLANE command. Syntax:
where, IMAGE3D imagevar, STRING filename
Example:
17. SETIMAGEPLANE statementThis command sets a specified image plane as current for processing functions like GETPIXEL, SETPIXEL, and SAVEIMAGEPLANE. The image plane number must exist. Syntax:
where, IMAGE3D image, INTEGER planenum Example:
18. IMAGEDIM statementThis function retrieves the image dimension values, including the number of columns, number of rows, and number of planes. The image must be opened before this command is used. This command is similar to Image/Information but with less parameters. Syntax:
where, IMAGE3D image, INTEGER x y z Example:
19. GETPIXEL statementThis function retrieves a pixel from the current plane of an opened image. The image must be opened before this command is used. To work on another image plane, use SETIMAGEPLANE to set the plane as current first and then use the GETPIXEL function. Syntax:
where, IMAGE3D image, INTEGER col row value, the col and row defines the pixel location. Example:
20. SETPIXEL statementThis function sets a pixel value in the current plane of an opened image. The image must be open before this command is used. To work on another image plane, use SETIMAGEPLANE to set the plane as current first and then use this function. Syntax:
where, IMAGE3D image, INTEGER col row value, the col and row defines the pixel location.
21. SHOWIMAGE statementThis command sends the currently opened image to display. Once an image is used by this command, it will be automatically closed and will no longer be available to the same program. It should be opened again if the image needs to be used by the same program. Syntax:
where, IMAGE3D imagevar Example:
22. CLOSEIMAGE statementThis command closes a currently opened image when it is no longer needed. This will free up all memory allocated by the image. Syntax:
where, IMAGE3D imagevar Example:
23. SIZEIMAGEUP statementThis command enlarges an image by a specified scaling factor. For example, if the scaling factor is 2, then the resized image will be doubled in all three dimensions. This command is similar to Image/Resize Volume command. Syntax:
where, IMAGE3D imagevar, STRING filename, INTEGER scalar Example:
24. SIZEIMAGEDOWN statementThis command reduces the size of an image by a specified scaling factor. For example, if the scaling factor is 2, then the resized image will be scaled down by 2 in all three dimensions. This command is similar to Image/Resize Volume command. Syntax:
where, IMAGE3D imagevar, STRING filename, INTEGER scalar Example:
25. ROTATEIMAGEX and ROTATEIMAGEY statementsThe ROTATEIMAGEX and ROTATEIMAGEY commands rotate a 3D volume around the X-axis and Y-axis, respectively. They are similar to Image/Reslice/Reslice X Axis and Image/Reslice/Reslice Y Axis commands. Syntax:
where, IMAGE3D imagevar, STRING filename Example:
26. CROPIMAGE statementThis command crops a sub-volume from an image and save the volume to a new image file. This command is similar to the Image/Crop Image/Crop Volume command. Syntax:
where, IMAGE3D imagevar, STRING outputfile INTEGER x1 x2 y1 y2 z1 z2; defines the volume Example:
27. SEGMENTIMAGE statementThis command segments an image using specified low and high thresholds. The generated object boundary lines are stored in the IMAGE3D variable and can be used by surface or volume rendering commands. This command is similar to the 3D Rendering/Interactive Segment command. Syntax:
where, IMAGE3D image, INTEGER low high INTEGER alllines (0: only outline, 1: all boundaries)
Example:
28. OPENBOUNDARY statementThis command loads object boundary data into an IMAGE3D variable from a boundary file. This command is similar to the File/Boundary/Import Boundary command. Syntax:
where, IMAGE3D imagevar, STRING filename Example:
29. SAVEBOUNDARY statementThis command saves object boundary data into a boundary file. This command is similar to the File/Boundary/Export Boundary command. Syntax:
where, IMAGE3D imagevar, STRING filename Example:
30. DECONVNN statementThis command performs a nearest neighbor deconvolution. It is similar to the Image/Deconvolution//Fast Nearest Neighbor command. Syntax:
where, STRING sourcefile, psffile, outputfile, INTEGER areasize, kernelsize, FLOAT scalar Example:
31. DECONVMAX statementThis command performs a maximum entropy based deconvolution. It is similar to the Image/Deconvolution/Maximum Entropy command. Syntax: DECONVMAX "sourcefile" "psffile" "outputfile" iterations feedback DECONVMAX sourcefile psffile outputfile 15 0.05 where, STRING sourcefile, psffile, outputfile, INTEGER iterations, FLOAT feedback; this value should be less than 1. Example:
32. SURFSIMPLE statementThis command performs a simple surface rendering using boundary data stored in an IMAGE3D object. It is similar to the 3D Rendering/Surface Rendering/Simple Surface command, but the surface modeling data is saved directly to a file, instead of being displayed in a window. Syntax:
where, IMAGE3D imagevar, STRING filename Example:
33. SURFCOMPLEX statementThis command performs a complex surface rendering using boundary data stored in an IMAGE3D object. It is similar to the 3D Rendering/Surface Rendering/(Fast or Full) Complex Surface command, but the surface modeling data is saved directly to a file, instead of being displayed in a window. Syntax:
where, IMAGE3D imagevar, STRING filename Example:
34. END statementThis command indicates the end of the program. Syntax:
Example:
|
|
|