Skip to content
Snippets Groups Projects
Commit d19a094f authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Add parallel beam projectors

parent fc396cfd
No related branches found
No related tags found
No related merge requests found
...@@ -26,10 +26,13 @@ from pystencils_autodiff.framework_integration.printer import \ ...@@ -26,10 +26,13 @@ from pystencils_autodiff.framework_integration.printer import \
FrameworkIntegrationPrinter FrameworkIntegrationPrinter
volume = pystencils.fields('volume: float32[3d]') volume = pystencils.fields('volume: float32[3d]')
projection = pystencils.fields('projection: float32[2d]') projection = pystencils.fields('projection: float32[3d]')
projection_matrices = pystencils.fields('matrices: float32[3d]') projection_matrices = pystencils.fields('matrices: float32[3d]')
inv_matrices = pystencils.fields('inv_matrices: float32[3d]') inv_matrices = pystencils.fields('inv_matrices: float32[3d]')
source_points = pystencils.fields('source_points: float32[1d]') source_points = pystencils.fields('source_points: float32[1d]')
volume_slice = pystencils.fields('volume_slice: float32[2d]')
projections_1d = pystencils.fields('projections_1d: float32[2d]')
ray_vectors = pystencils.fields('ray_vectors: float32[2d]')
FUNCTIONS = { FUNCTIONS = {
'Cone_Backprojection3D_Kernel_Launcher': CustomFunctionCall('Cone_Backprojection3D_Kernel_Launcher', 'Cone_Backprojection3D_Kernel_Launcher': CustomFunctionCall('Cone_Backprojection3D_Kernel_Launcher',
...@@ -45,7 +48,7 @@ FUNCTIONS = { ...@@ -45,7 +48,7 @@ FUNCTIONS = {
TypedSymbol('volume_origin_x', create_type('float32'), const=True), TypedSymbol('volume_origin_x', create_type('float32'), const=True),
TypedSymbol('volume_origin_y', create_type('float32'), const=True), TypedSymbol('volume_origin_y', create_type('float32'), const=True),
TypedSymbol('volume_origin_z', create_type('float32'), const=True), TypedSymbol('volume_origin_z', create_type('float32'), const=True),
*[FieldShapeSymbol(['projection'], i) for i in range(1, -1, -1)], *[FieldShapeSymbol(['projection'], i) for i in range(2, 0, -1)],
TypedSymbol('projection_multiplier', create_type('float32'), const=True), TypedSymbol('projection_multiplier', create_type('float32'), const=True),
fields_accessed=[volume, projection, projection_matrices], custom_signature=""" fields_accessed=[volume, projection, projection_matrices], custom_signature="""
void Cone_Backprojection3D_Kernel_Launcher(const float *sinogram_ptr, float *out, const float *projection_matrices, const int number_of_projections, void Cone_Backprojection3D_Kernel_Launcher(const float *sinogram_ptr, float *out, const float *projection_matrices, const int number_of_projections,
...@@ -66,7 +69,7 @@ void Cone_Backprojection3D_Kernel_Launcher(const float *sinogram_ptr, float *out ...@@ -66,7 +69,7 @@ void Cone_Backprojection3D_Kernel_Launcher(const float *sinogram_ptr, float *out
TypedSymbol('volume_spacing_x', create_type('float32'), const=True), TypedSymbol('volume_spacing_x', create_type('float32'), const=True),
TypedSymbol('volume_spacing_y', create_type('float32'), const=True), TypedSymbol('volume_spacing_y', create_type('float32'), const=True),
TypedSymbol('volume_spacing_z', create_type('float32'), const=True), TypedSymbol('volume_spacing_z', create_type('float32'), const=True),
*[FieldShapeSymbol(['projection'], i) for i in range(1, -1, -1)], *[FieldShapeSymbol(['projection'], i) for i in range(2, 0, -1)],
TypedSymbol('step_size', create_type('float32'), const=True), TypedSymbol('step_size', create_type('float32'), const=True),
fields_accessed=[volume, projection, inv_matrices, source_points], custom_signature=""" fields_accessed=[volume, projection, inv_matrices, source_points], custom_signature="""
void Cone_Projection_Kernel_Launcher(const float* volume_ptr, float *out, const float *inv_AR_matrix, const float *src_points, void Cone_Projection_Kernel_Launcher(const float* volume_ptr, float *out, const float *inv_AR_matrix, const float *src_points,
...@@ -86,7 +89,7 @@ void Cone_Projection_Kernel_Launcher(const float* volume_ptr, float *out, const ...@@ -86,7 +89,7 @@ void Cone_Projection_Kernel_Launcher(const float* volume_ptr, float *out, const
TypedSymbol('volume_spacing_x', create_type('float32'), const=True), TypedSymbol('volume_spacing_x', create_type('float32'), const=True),
TypedSymbol('volume_spacing_y', create_type('float32'), const=True), TypedSymbol('volume_spacing_y', create_type('float32'), const=True),
TypedSymbol('volume_spacing_z', create_type('float32'), const=True), TypedSymbol('volume_spacing_z', create_type('float32'), const=True),
*[FieldShapeSymbol(['projection'], i) for i in range(1, -1, -1)], *[FieldShapeSymbol(['projection'], i) for i in range(2, 0, -1)],
TypedSymbol('step_size', create_type('float32'), const=True), TypedSymbol('step_size', create_type('float32'), const=True),
fields_accessed=[volume, projection, inv_matrices, source_points], custom_signature=""" fields_accessed=[volume, projection, inv_matrices, source_points], custom_signature="""
void Cone_Projection_Kernel_Tex_Interp_Launcher( void Cone_Projection_Kernel_Tex_Interp_Launcher(
...@@ -97,6 +100,49 @@ void Cone_Projection_Kernel_Tex_Interp_Launcher( ...@@ -97,6 +100,49 @@ void Cone_Projection_Kernel_Tex_Interp_Launcher(
const float volume_spacing_x, const float volume_spacing_y, const float volume_spacing_x, const float volume_spacing_y,
const float volume_spacing_z, const int detector_width, const float volume_spacing_z, const int detector_width,
const int detector_height, const float step_size);"""), # noqa const int detector_height, const float step_size);"""), # noqa
'Parallel_Projection2D_Kernel_Launcher': CustomFunctionCall('Parallel_Projection2D_Kernel_Launcher',
FieldPointerSymbol(volume_slice.name, volume_slice.dtype, const=True),
FieldPointerSymbol(projections_1d.name, projections_1d.dtype, const=False),
FieldPointerSymbol(ray_vectors.name,
ray_vectors.dtype, const=True),
FieldShapeSymbol([ray_vectors.name], 0),
*[FieldShapeSymbol(['volume_slice'], i) for i in range(1, -1, -1)],
TypedSymbol('volume_spacing_x', create_type('float32'), const=True),
TypedSymbol('volume_spacing_y', create_type('float32'), const=True),
TypedSymbol('volume_origin_x', create_type('float32'), const=True),
TypedSymbol('volume_origin_y', create_type('float32'), const=True),
FieldShapeSymbol([projections_1d.name], 1),
TypedSymbol('detector_spacing', create_type('float32'), const=True),
TypedSymbol('detector_origin', create_type('float32'), const=True),
fields_accessed=[volume_slice, projections_1d, ray_vectors], custom_signature="""
void Parallel_Projection2D_Kernel_Launcher(
const float *volume_ptr, float *out, const float *ray_vectors,
const int number_of_projections, const int volume_width,
const int volume_height, const float volume_spacing_x,
const float volume_spacing_y, const float volume_origin_x,
const float volume_origin_y, const int detector_size,
const float detector_spacing, const float detector_origin);
"""), # noqa
'Parallel_Backprojection2D_Kernel_Launcher': CustomFunctionCall('Parallel_Backprojection2D_Kernel_Launcher',
FieldPointerSymbol(projections_1d.name, projections_1d.dtype, const=True),
FieldPointerSymbol(volume_slice.name, volume_slice.dtype, const=False),
FieldPointerSymbol(ray_vectors.name,
ray_vectors.dtype, const=True),
FieldShapeSymbol([ray_vectors.name], 0),
*[FieldShapeSymbol(['volume_slice'], i) for i in range(1, -1, -1)],
TypedSymbol('volume_spacing_x', create_type('float32'), const=True),
TypedSymbol('volume_spacing_y', create_type('float32'), const=True),
TypedSymbol('volume_origin_x', create_type('float32'), const=True),
TypedSymbol('volume_origin_y', create_type('float32'), const=True),
FieldShapeSymbol([projections_1d.name], 1),
TypedSymbol('detector_spacing', create_type('float32'), const=True),
TypedSymbol('detector_origin', create_type('float32'), const=True),
fields_accessed=[volume_slice, projections_1d, ray_vectors], custom_signature="""
void Parallel_Backprojection2D_Kernel_Launcher(const float *sinogram_ptr, float *out, const float *ray_vectors, const int number_of_projections,
const int volume_width, const int volume_height, const float volume_spacing_x, const float volume_spacing_y,
const float volume_origin_x, const float volume_origin_y,
const int detector_size, const float detector_spacing, const float detector_origin);
"""), # noqa
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment