.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_07_infiltration_phantom.py: Example 07: Generate a 4D infiltration phantom ============================================== .. code-block:: default import foam_ct_phantom import h5py import numpy as np import pylab as pl pl.gray() random_seed = 9876 foam_ct_phantom.InfiltrationFoamPhantom.generate('test_infiltration.h5','test_phantom.h5',random_seed, 0.5, startz=1.5, cutoff=1e-2) infiltration_phantom = foam_ct_phantom.InfiltrationFoamPhantom('test_infiltration.h5') vol_geom = foam_ct_phantom.VolumeGeometry(256,256,1,3/256) infiltration_phantom.generate_volume('test_infiltration_vol_start.h5', vol_geom, time=0) infiltration_phantom.generate_volume('test_infiltration_vol_end.h5', vol_geom, time=1) vol0 = foam_ct_phantom.load_volume('test_infiltration_vol_start.h5') vol1 = foam_ct_phantom.load_volume('test_infiltration_vol_end.h5') pl.imshow(vol0[0]) pl.figure() pl.imshow(vol1[0]) pl.show() proj_geom = foam_ct_phantom.ParallelGeometry(256,256,np.linspace(0,4*np.pi,128,False),3/256) infiltration_phantom.generate_projections('test_infiltration_projs.h5', proj_geom) projs = foam_ct_phantom.load_projections('test_infiltration_projs.h5') pl.imshow(projs[0]) pl.figure() pl.imshow(projs[-1]) pl.show() .. _sphx_glr_download_auto_examples_07_infiltration_phantom.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: 07_infiltration_phantom.py <07_infiltration_phantom.py>` .. container:: sphx-glr-download :download:`Download Jupyter notebook: 07_infiltration_phantom.ipynb <07_infiltration_phantom.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_