Skip to content

Reference for pyronn/ct_reconstruction/layers/tensorflow/projection_3d.py


pyronn.ct_reconstruction.layers.tensorflow.projection_3d.cone_projection3d

cone_projection3d(volume, geometry, hardware_interp=True, step_size=1.0)

Wrapper function for making the layer call. Args: volume: Input volume to project. geometry: Corresponding GeometryCone3D Object defining parameters. hardware_interp: Controls if interpolation is done by GPU. step_size: step_size along ray direction in voxel. Returns: Initialized lme_custom_ops.cone_projection3d layer.

Source code in pyronn/ct_reconstruction/layers/tensorflow/projection_3d.py
def cone_projection3d(volume, geometry, hardware_interp=True, step_size=1.0):
    """
    Wrapper function for making the layer call.
    Args:
        volume:             Input volume to project.
        geometry:           Corresponding GeometryCone3D Object defining parameters.
        hardware_interp:    Controls if interpolation is done by GPU.
        step_size:          step_size along ray direction in voxel.
    Returns:
            Initialized lme_custom_ops.cone_projection3d layer.
    """
    batch = np.shape(volume)[0]
    return pyronn_layers.cone_projection3d(volume,
                                           projection_shape=geometry.sinogram_shape,
                                           volume_origin=np.broadcast_to(geometry.volume_origin, [batch, *np.shape(geometry.volume_origin)]),
                                           volume_spacing=np.broadcast_to(geometry.volume_spacing, [batch, *np.shape(geometry.volume_spacing)]),
                                           projection_matrices=np.broadcast_to(geometry.trajectory, [batch, *np.shape(geometry.trajectory)]),
                                           step_size=np.broadcast_to(step_size, [batch, *np.shape(step_size)]),
                                           projection_multiplier=np.broadcast_to(geometry.projection_multiplier, [batch, *np.shape(geometry.projection_multiplier)]),
                                           hardware_interp=hardware_interp)





pyronn.ct_reconstruction.layers.tensorflow.projection_3d._project_grad

_project_grad(op, grad)

Compute the gradient of the projection op by invoking the backprojector.

Source code in pyronn/ct_reconstruction/layers/tensorflow/projection_3d.py
@ops.RegisterGradient("ConeProjection3D")
def _project_grad(op, grad):
    # TODO: Document this function on your own. Could not be documented by the model.
    # TODO: Document this function on your own. Could not be documented by the model.
    '''
    Compute the gradient of the projection op by invoking the backprojector.
    '''
    reco = pyronn_layers.cone_backprojection3d(
        sinogram=grad,
        volume_shape=op.inputs[0].shape[1:],
        volume_origin=op.inputs[2],
        volume_spacing=op.inputs[3],
        projection_matrices=op.inputs[4],
        step_size=op.inputs[5],
        projection_multiplier=op.inputs[6],
        hardware_interp=op.get_attr("hardware_interp")
    )
    return [reco, tf.stop_gradient(op.inputs[1]), tf.stop_gradient(op.inputs[2]), tf.stop_gradient(op.inputs[3]), tf.stop_gradient(op.inputs[4]), tf.stop_gradient(op.inputs[5]), tf.stop_gradient(op.inputs[6])]