Files:
CAL_mp.py - python class for treating the 3D printing problem, starting from an STL file (CAL_mp uses multiprocessing unlike CAL.py)
*.ipynb - notebooks showing specific examples
githubRepo_schematic.png - schematic showing the setup and conventions used to describe the problem
stlread_utils - folder containing STL file and temporary png slices
hollies_hand... - Folder containing output files for one particular geometry (note: the *.mat file containing projector inputs was deleted due to size)
tomoEnv.yml - environment file to run this project
This python implementation provides the optimization and projection generation framework used for volumetric additive manufacturing as described in the following publications:
In computed axial lithography, a carefully calculated video is projected into a steadily rotating photocurable resin. The video is synchronized to the rotation of the resin so that specific images are projected at each rotated angle. This is modeled as an integral projection of the image through the resin container (in the low attenuation case). The accumulation of dose leads to a two step printing process. The first step, which consumes most of the dose, is an induction phase where oxygen free radicals are neutralized by polymer free radicals. The second step is gelation where the excess polymer free radicals cross-link and solidify into a desired geometry.
A detailed discussion and process model are provided in [1] and [2] above, but briefly, the forward model can be described as follows:
The 3D dose distribution within the photosensitive resin
where
We are interested in achieving solidification in a region
where
Figure: [A]: the hardware setup for 3D printing using a rotating resin container and projector, [B]: Schematic showing how different anges contribute to dose formation in 3D, [C]: the print target definition. Based on an input geometry, a target region, background and thin buffer region are created, [D]: Region definitions for computing the loss at any given iteration
Several possible mathematical optimization approaches could exist to encourage the print conditions as expressed in terms of
We impose an L1 penalty on each of the types of violations and obtain the loss at iteration
We would like to obtain
In the volume integrals above, the term corresponding to notation
The software implementation is through an optimization class CAL_mp. This uses multiprocessing for some of functions in order to speed up repetitive calculations that are applied over multiple z-slices. An example use case is provided in the notebook CAL_geometryIterations.ipynb. In order to initialize an optimization, we require the following inputs (in chronological order):
- STL file of print target: placed user stlread_utils/STL_database
- The order of the loss function (keep it 1 for L1 loss), parameters dl and dh for the optimization, size of angle discretization for the radon transform (361 here), lateral resolution of voxel grid to represent geometry (300 here)
- Once the optimization object is initialized with these parameters using the CAL_mp class, we can set the parameters for the optimization. This uses the scipy.minimize class and related parameters (maxiter, ftol, disp, maxcor, maxls). The in-built LBFGS-B function is used to implement the optimization procedure.
The CAL_geometryIterations.ipynb notebook shows an example for optimizing the projections of a model of the COVID-19 virus. Once the optimization is complete, a graph of loss vs epochs and videos of various quantities of interest are created. The projections are saved as a matlab file ready for driving projector output.
The example below shows a set of outputs for the 3D printing of a prosthetic arm 'Hollie's hand'. This particular example is shown in the notebook CAL_example.ipynb for two sets of discretizations. Both of these led to perfect convergence (zero loss before iteration counts could be exhausted).
Please feel free to fork the repository and try it out with your own STL geometries.
Note: Perfect reconstruction in the imaging problem (even in the case of coarse angular sampling) has been studied, for example: E. Candes, J. Romberg, T. Tao, "Robust uncertainty principles: exact signal reconstruction from highly incomplete frequency information". The 3D printing problem is positivity constrained in the projection space, a significant difference and potential difficulty compared to the imaging problem. On an optimistic note, target geometries are often sparse and have highly sparse gradients (unlike the imaging problem) and the reconstruction problem is highly non-linear in dose. It would be interesting to study the parameter space of perfect reconstruction in the 3D printing problem.
finalProj.mp4
This work was carried out at the University of California Berkeley in the lab of Prof. Hayden Taylor. Please consider using this technology with intention towards socially beneficial and conscious projects. The examples used in this notebook: a prosthetic hand and a medical model, serve to illustrate some of the ways in which 3D printing can help our society. The models used here are under a creative commons license.
[1] Incorporate a more detailed forward model using Abbe imaging physics
[2] Discretization using the cylindrical symmetry of the problem or other non-uniform grids that could be beneficial
[3] Faster optimization methods or parallelization using a GPU
[4] Study if allowing for the printing of artifacts in