The build3D user macro takes a series of 2D image files that represent layers of a 3D volume and builds them into 3D field data that can be visualized using the normal tools.
The following lists all of the parameters found in the parameter block Build3DImageParams, which are accessed by the low-level macro Build3DAssemble, the functional macro Build3D and the UI Macro Build3D.
Name | Type | Description | UI Control |
start_layer | int | first layer to be built into volume | First layer text box |
end_layer | int | last layer to be built into volume | Last layer text box |
component | int | colour component to be extracted | Radio control panel |
start | int | triggers the building of the volume | Build button |
This macro also makes use of the common parameter block IndexedFileParams and the associated macro CreateIndexedFilename. This macro creates a filename from a number of sub-strings and an index. Documentation can be found in the IOWidgets library. The important details of the parameters used are shown below.
Name | Type | Description | UI Control |
dir | string | file directory (e.g. iac_proj/build3d/) | Directory Text Box |
filename_stub | string | filename without index (e.g. cube) | Filename Stub Text Box |
extension | string | file extension without leading "." (e.g. tif) | Extension Text Box |
index_width | int | width of index number in characters | Index Width Edit Box |
Name | Type | Description | |
out | uniform scalar field | generated 3D volume | |
The Build3D project consists of a set of macros that build up a 3D model from a set of 2D slices or layers. The 2D layers can be represented by any of the image file formats that AVS/Express supports. The build3D User Macro is a high-level macro that performs this task. It also helps the user by determining the resolution of the supplied files and by providing a user interface.
The 3D volume that is built is represented as uniform scalar field data. Scalar values are extracted from the image data by selecting a certain colour component and removing the others. The extracted scalar values are then stored as node data within the uniform field. It should be noted that due to the use of a uniform mesh, best results will be obtained when all slices are evenly spaced. This is a limitation of the current macro. In the future it maybe possible to use a rectlinear mesh and thereby allow unevenly spaced layers. It is currently possible to workaround this problem by using the scale module to stretch the output data.
Typically the module will be used to visualise all slices of data at once. This can be done by setting start_layer to 0 and end_layer to the last layer present. However when dealing with large data sets it maybe useful to only visual certain sections of the data. This can be done by specifying start and end layers appropriately.
start_layer
A member of the Build3DImageParams parameter block group, this int value is used to specify the index number of the first slice that should be used to build the 3D block. The start_layer should be less than the end_layer. However if this error is made the user interface will correct this by swapping the two values so they are in the correct order.
end_layer
A member of the Build3DImageParams parameter block group, this int value is used to specify the index number of the last slice that should be used to build the 3D block. The end_layer should be greater than the start_layer. However if this error is made the user interface will correct this by swapping the two values so they are in the correct order.
component
A member of the Build3DImageParams parameter block group, this int value is used to specify the colour component that should be extracted from the image file. This parameter can have values in the range 0 to 3, these values relate to the alpha, red, green and blue components respectively.
start
A member of the Build3DImageParams parameter block group, this int value is used to trigger the start of the internal loop that reads the image files into the uniform field. When the trigger value switches from 0 to 1 the macro disconnects the field data from the macro output and begins to read in the image files. Once this is finished the the network is reconnected. The field data is disconnected while image files are read to avoid unnecessary updates rippling through the network and thereby avoiding unnecessary visualization calculations.
out
The generated 3D block in the form of a uniform scalar field with the dimensions specified in the Build3DImageParams parameter block. The data present in the images is stored as single byte node data within the field. The data can be visualized using any of the standard visualization components. This can be seen in the example application where isosurface and bounds modules are used.
The User Macro build3D uses the Functional Macro Build3DFunc which in turn uses the low-level macro Build3DAssemble.
An example application Build3DEg is provided, which loads four BMP files that are each 4x4 pixels in size, builds a 3D volume from these and displays the volume using an isosurface and a bounding box. The resulting model should resemble a cube.
iac_proj/build3d/bl3dmods.v contains the Build3DImageParams group and the Build3DMakeDims, Build3DExtractScalar and Build3DAssemble module V definitions.
iac_proj/build3d/bl3dmacs.v contains the build3D User Macro, the Build3DFunc Functional Macro and the Build3DUI UI Macro.
iac_proj/build3d/bl3dapps.v contains the Build3DEg and CreateImageSlicesEg example application V definitions.
This project requires the following components to be installed correctly. Without these components the project will not work.
The Build3DMacs library inherits its process. As this library contains no procedural code, the process is not important.
Steve Larkin
Jimmy Schumm Paul G. Lever Andrew Dodd
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL