Skip to content

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


pyronn.ct_reconstruction.layers.tensorflow.backprojection_2d.parallel_backprojection2d

parallel_backprojection2d(sinogram, geometry)

Wrapper function for making the layer call. Args: volume: Input volume to project. geometry: Corresponding GeometryParallel2D Object defining parameters. Returns: Initialized lme_custom_ops.parallel_backprojection2d layer.

Source code in pyronn/ct_reconstruction/layers/tensorflow/backprojection_2d.py
def parallel_backprojection2d(sinogram, geometry):
    """
    Wrapper function for making the layer call.
    Args:
        volume:     Input volume to project.
        geometry:   Corresponding GeometryParallel2D Object defining parameters.
    Returns:
            Initialized lme_custom_ops.parallel_backprojection2d layer.
    """
    batch = np.shape(sinogram)[0]
    return pyronn_layers.parallel_backprojection2d(sinogram,
                                                   volume_shape=geometry.volume_shape,
                                                    volume_origin   =np.broadcast_to(geometry.volume_origin,[batch,*np.shape(geometry.volume_origin)]),
                                                    detector_origin =np.broadcast_to(geometry.detector_origin,[batch,*np.shape(geometry.detector_origin)]),
                                                    volume_spacing  =np.broadcast_to(geometry.volume_spacing,[batch,*np.shape(geometry.volume_spacing)]),
                                                    detector_spacing=np.broadcast_to(geometry.detector_spacing,[batch,*np.shape(geometry.detector_spacing)]),
                                                    ray_vectors     =np.broadcast_to(geometry.trajectory,[batch,*np.shape(geometry.trajectory)]))





pyronn.ct_reconstruction.layers.tensorflow.backprojection_2d._backproject_grad

_backproject_grad(op, grad)

Compute the gradient of the backprojector op by invoking the forward projector.

Source code in pyronn/ct_reconstruction/layers/tensorflow/backprojection_2d.py
@ops.RegisterGradient("FanBackprojection2D")
def _backproject_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 backprojector op by invoking the forward projector.
    '''
    proj = pyronn_layers.fan_projection2d(
        volume=grad,
        projection_shape=op.inputs[0].shape[1:],
        volume_origin=op.inputs[2],
        detector_origin=op.inputs[3],
        volume_spacing=op.inputs[4],
        detector_spacing=op.inputs[5],
        source_2_isocenter_distance=op.inputs[6],
        source_2_detector_distance=op.inputs[7],
        central_ray_vectors=op.inputs[8],
    )
    return [proj, 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]),  tf.stop_gradient(op.inputs[7]), tf.stop_gradient(op.inputs[8])]





pyronn.ct_reconstruction.layers.tensorflow.backprojection_2d.fan_backprojection2d

fan_backprojection2d(sinogram, geometry)

Wrapper function for making the layer call. Args: volume: Input volume to project. geometry: Corresponding GeometryFan2D Object defining parameters. Returns: Initialized lme_custom_ops.fan_backprojection2d layer.

Source code in pyronn/ct_reconstruction/layers/tensorflow/backprojection_2d.py
def fan_backprojection2d(sinogram, geometry):
    """
    Wrapper function for making the layer call.
    Args:
        volume:     Input volume to project.
        geometry:   Corresponding GeometryFan2D Object defining parameters.
    Returns:
            Initialized lme_custom_ops.fan_backprojection2d layer.
    """
    batch = np.shape(sinogram)[0]
    return pyronn_layers.fan_backprojection2d(sinogram,
                                              volume_shape=geometry.volume_shape,
                                              volume_origin=np.broadcast_to(geometry.volume_origin, [batch, *np.shape(geometry.volume_origin)]),
                                              detector_origin=np.broadcast_to(geometry.detector_origin, [batch, *np.shape(geometry.detector_origin)]),
                                              volume_spacing=np.broadcast_to(geometry.volume_spacing, [batch, *np.shape(geometry.volume_spacing)]),
                                              detector_spacing=np.broadcast_to(geometry.detector_spacing, [batch, *np.shape(geometry.detector_spacing)]),
                                              source_2_isocenter_distance=np.broadcast_to(geometry.source_isocenter_distance, [batch, *np.shape(geometry.source_isocenter_distance)]),
                                              source_2_detector_distance=np.broadcast_to(geometry.source_detector_distance, [batch, *np.shape(geometry.source_detector_distance)]),
                                              central_ray_vectors=np.broadcast_to(geometry.trajectory, [batch, *np.shape(geometry.trajectory)]))





pyronn.ct_reconstruction.layers.tensorflow.backprojection_2d._backproject_grad

_backproject_grad(op, grad)

Compute the gradient of the backprojector op by invoking the forward projector.

Source code in pyronn/ct_reconstruction/layers/tensorflow/backprojection_2d.py
@ops.RegisterGradient("FanBackprojection2D")
def _backproject_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 backprojector op by invoking the forward projector.
    '''
    proj = pyronn_layers.fan_projection2d(
        volume=grad,
        projection_shape=op.inputs[0].shape[1:],
        volume_origin=op.inputs[2],
        detector_origin=op.inputs[3],
        volume_spacing=op.inputs[4],
        detector_spacing=op.inputs[5],
        source_2_isocenter_distance=op.inputs[6],
        source_2_detector_distance=op.inputs[7],
        central_ray_vectors=op.inputs[8],
    )
    return [proj, 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]),  tf.stop_gradient(op.inputs[7]), tf.stop_gradient(op.inputs[8])]