In [1]:
import occiput
occiput.initialise()
from occiput.Reconstruction.PET import PET_Static_Scan, Binning
from occiput.Reconstruction.PET import PET_Interface_mMR
from occiput.DataSources.Synthetic import uniform_sphere, uniform_spheres_ring
import numpy
In [8]:
# Geometry of the scanner:
N_axial = 252 # number of axial projections
N_azimuthal = 1 # number of azimuthal projections
angular_step_axial = numpy.pi/N_axial # radians
angular_step_azimuthal = 0.0 # radians
N_u = 200 # voxels
N_v = 128 # voxels
size_u = 200 # [mm]
size_v = 128 # [mm]
interface = PET_Interface_mMR()
binning = Binning([N_axial, N_azimuthal, angular_step_axial, angular_step_azimuthal, size_u, size_v, N_u, N_v])
# Static acquisition:
SCAN = PET_Static_Scan()
SCAN.set_interface(interface)
SCAN.set_binning(binning)
# Full sampling (all detector pixels are active):
SCAN.set_full_sampling()
# Parameters of the projection and backprojection algorithms:
SCAN.projection_parameters.sample_step = 0.8
SCAN.projection_parameters.N_samples = 256
SCAN.backprojection_parameters.sample_step = 0.8
SCAN.backprojection_parameters.N_samples = 256
SCAN.projection_parameters.direction = 7
In [9]:
# Number of voxels of the synthetic activity volume:
phantom_voxels_x = 128 # voxels
phantom_voxels_y = 128 # voxels
phantom_voxels_z = 128 # voxels
# Size of the synthetic activity volume in [mm]
phantom_size_x = 128 # [mm]
phantom_size_y = 128 # [mm]
phantom_size_z = 128 # [mm]
# Center of the synthetic activity volume in [mm]
phantom_center_x = 0.5 * phantom_size_x # [mm]
phantom_center_y = 0.5 * phantom_size_y # [mm]
phantom_center_z = 0.5 * phantom_size_z # [mm]
# Synthetic activity parameters:
phantom_n_spheres = 6 # number of spheres
phantom_ring_radius = 0.4 * phantom_size_x # radius of the ring of spheres [mm]
phantom_small_radius = 0.04 * phantom_size_z # radius of the smallest spheres [mm]
phantom_large_radius = 0.10 * phantom_size_z # radius of the largest sphere [mm]
phantom_value = 10.0 # activity inside the spheres
phantom_background = 0.25 # activity outside the spheres
phantom_ring_axis = 2 # axis of the ring of spheres : 0 for X, 1 for Y, 2 for Z
phantom_extrusion = 0.6 * phantom_size_z # extrusion along axis [mm]
# Make the synthetic activity volume:
#phantom = occiput.DataSources.Synthetic.uniform_sphere([128,128,128],[128,128,128],[64,64,64],20,2,0)
phantom = uniform_spheres_ring( [phantom_voxels_x, phantom_voxels_y, phantom_voxels_z],
[phantom_size_x, phantom_size_y, phantom_size_z ],
[phantom_center_x, phantom_center_y, phantom_center_z],
phantom_ring_radius, phantom_small_radius, phantom_large_radius,
phantom_n_spheres, phantom_value, phantom_background, phantom_extrusion, phantom_ring_axis)
In [10]:
phantom
Out[10]:
In [11]:
# Compute projection:
SCAN.activity_shape = [phantom_voxels_x,phantom_voxels_y,phantom_voxels_z]
SCAN.activity_size = [phantom_size_x,phantom_size_y,phantom_size_z]
proj = SCAN.project(phantom.data);
# Uncompress the projection data and visualize it:
SCAN.uncompress(proj)
Out[11]:
In [11]:
In [11]:
In [11]:
In [11]:
In [12]:
SCAN.volume_render(phantom,scale=1)
Out[12]:
In [13]:
# Backproject:
SCAN.backprojection_parameters.direction=7
bkpr = SCAN.backproject(proj)
In [14]:
# Visualise the back-projection and the synthetic activity:
occiput.Visualization.MultipleVolumes([phantom,bkpr],axis=0)
Out[14]:
In [15]:
SCAN.set_measurement_data(proj)
In [29]:
A = SCAN.estimate_activity(iterations=20, subset_size=16)
In [30]:
SCAN.volume_render(A,scale=0.5)
Out[30]:
In [11]:
In [11]:
In [11]:
In [24]:
In [31]:
bkpr.shape
Out[31]:
In [11]:
In [12]:
In [ ]:
In [ ]:
In [12]:
In [16]:
In [16]:
In [16]:
In [16]:
In [16]:
In [16]:
In [16]:
In [16]:
In [ ]: