| 3D-DOCTOR: Vector-Based 3D Medical Modeling and Imaging Software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
APPLICATIONS DOWNLOAD TECH SUPPORT ORDER 3D-DOCTOR
COMPANY INFO |
3D-DOCTOR Scripting With 3DBasic:
|
| 3DBasic Summary | |
| Key Features |
![]()
3DBasic is a Basic-like scripting language implemented to allow programming with 3D-DOCTORs 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-DOCTORs 3DBasic/Create command. Use 3DBasic/Run to run an existing 3DBasic program directly.
![]()
3DBasic supports most of the standard Basic commands, including
| ASSIGNMENT (=), | |
| PRINT, | |
| INPUT, | |
| IF, | |
| THEN, | |
| FOR, | |
| NEXT, | |
| TO, | |
| GOTO, | |
| GOSUB, | |
| RETURN, | |
| END and | |
| REM. |
In addition, 3DBasic provides a new set of commands to provide enhanced functionality for programming and image processing . The new commands include:
| LOGFILE, | |
| OPENIMAGE, | |
| SHOWIMAGE, | |
| CLOSEIMAGE, | |
| SAVEIMAGE, | |
| SAVEIMAGEPLANE, | |
| SETIMAGEPLANE, | |
| GETPIXEL, | |
| SETPIXEL, | |
| SIZEIMAGEUP, | |
| SIZEIMAGEDOWN, | |
| ROTATEIMAGE, | |
| CROPIMAGE, | |
| SEGMENTIMAGE, | |
| IMAGEDIM, | |
| OPENBOUNDARY, | |
| SAVEBOUNDARY, | |
| DECONVNN, | |
| DECONVMAX, | |
| SURFSIMPLE, | |
| SURFCOMPLEX and | |
| more being implemented. |
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:
- LOGFILE "c:\output.log"
- PRINT "THIS IS A 3D SEGMENTATION EXAMPLE"
- STRING FILENAME
- INTEGER X1, X2
- X1 = 51
- X2 = 186
- IMAGE3D image1
- INPUT "Enter image file name:", FILENAME
- PRINT FILENAME
- OPENIMAGE image1 FILENAME
- SEGMENTIMAGE image1 X1 X2
- SAVEBOUNDARY image1 "c:\test.bnd"
- SHOWIMAGE image1
- PRINT "FINISHED"
- END
Example for Simple Surface Rendering:
- LOGFILE "c:\ output.log"
- PRINT "THIS IS A SURFACE RENDERING PROGRAM"
- STRING FILENAME
- IMAGE3D image1
- INPUT "Enter image file name:", FILENAME
- PRINT FILENAME
- OPENIMAGE image1 FILENAME
- REM Assuming boundary data has been generated
- OPENBOUNDARY image1 "d:\test.bnd"
- SURFSIMPLE image1 "d:\test.suf"
- CLOSEIMAGE image1
- PRINT "FINISHED"
- END
Example for saving image slices to separate image files:
- LOGFILE "c:\output.log"
- INTEGER X
- STRING FILENAME, NAME1, NAME
- IMAGE3D image1
- NAME = "testimg"
- INPUT "Enter image file name:", FILENAME
- PRINT FILENAME
- OPENIMAGE image1 FILENAME
- REM saves image slices 1 to 10 to files testimage1 to testimage10
- FOR X = 1 TO 10
- NAME1 = NAME + X
- PRINT NAME1
- SAVEIMAGE image1 X X NAME1
- NEXT
- END
![]()
This command indicates that the entire line following REM is only comment and will not affect the program execution.
Syntax:
Example:
![]()
This 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.
![]()
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:
![]()
FLOAT is used to declare float variables.
Syntax:
where, X1, Y, and y1 are the names of float variables.
Example:
![]()
STRING is used to declare variables that are text string.
Syntax:
where, Name1, note, and name2 are text strings.
Example:
![]()
IMAGE3D is used to declare 3D image variables. IMAGE3D variables can contain image data, boundary data, and other types of data created using 3D-DOCTORs processing functions.
Syntax:
where, image1, Image10, and T1 are images.
Example:
![]()
Assignment statements are used to assign a value to a declared variable, which can be an integer, float, or string.
Syntax:
Example:
![]()
The PRINT statement prints values of variables, expressions, and text strings to the file defined by the LOGFILE statement.
Syntax:
Example:
![]()
The INPUT statement allows interactive assignment of values to variables.
Syntax:
Example:
![]()
The 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:
![]()
The 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:
![]()
The 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:
![]()
Same as the standard Basic, the use of GOSUB and RETURN allows implementation of subroutines.
Syntax:
Example:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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.
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
The 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This 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:
![]()
This command indicates the end of the program.
Syntax:
Example:
- PRINT"This is a test"
END
![]()
"3D-DOCTOR" and "3DBasic" are trademarks of Able Software Corp.
Copyright © 1993-2008 Able Software Corp. All rights reserved.