Rasterization using Polymender

Tao Ju

Polymender can be used to rasterize (or scan-convert) any 3D polyhedral model into an inside/outside volume at any chosen resolution. First, download the latest Polymender executable here. This tool takes any polyhedral model (represented as a triangulated mesh in PLY or STL format) and fixes errors like gaps, holes, and self-intersections. As an intermediate step, it rasterizes the model to an inside/outside volume at a user-specified resolution. The volume is represented as an octree, which is made up of (signed) cubic cells of different sizes depending on where they are (the cells closer to the object surface are finer). To output this signed octree, use ".sof" as the output format. For example:
  • polymender mymodel.ply 8 0.9 mymodel.sof
Here, "8" refers to the depth of the octree (that is, the volume has an effective resolution of 2^8 in each X,Y,Z direction), and "0.9" refers to the size of the model relative to the size of the bounding box of the volume grid. See more details in the readme.txt accompanying the software.

Next, download this mrc.zip package. The package contains a program, sof2mrc.exe, which turns the signed octree in a ".sof" file into a regular signed volume on a uniform grid, represented in MRC format. For example, run:
  • sof2mrc.exe mymodel.sof mymodel.mrc 10
The values in mymodel.mrc will range from 0 (inside) to -1 (outside). The last parameter "10" specifies how much the volume is smoothed (i.e., the kernel size of a Gaussian filter); a value of 0 will produce a volume with only 0 and -1 values, while larger parameter values will produce more anti-aliased volumes.

About MRC format: This is a standard format of 3D volume used in molecular biology. The description of the file format can be found here. You can also view a MRC file using the free Chimera viewer. The mrc.zip package also contains some sample C++ code to write/read MRC files (in mrc_sample.h) and a test MRC data (bvp8.mrc).


Comments or suggestions: taoju at cs.wustl.edu