FusionFBP.py 🚧¢

Source: LION/models/learned_fbp/FusionFBP.py

Warning

This file has not yet received a complete narrative and docstring audit. Its public source-level API is listed automatically below.

class LearnableFilter(init_filter, per_angle=False, num_angles=None)

Learnable frequency-domain filter module for CT sinograms in FusionFBP. This module replaces traditional filters like Ram-Lak with trainable parameters in the frequency domain. It supports shared or per-angle filters. Args: init_filter (torch.Tensor): Initial 1D filter in the frequency domain. per_angle (bool): If True, uses one filter per angle. num_angles (int, optional): Required if per_angle=True.

LearnableFilter.forward(self, x)

No docstring is available.

class IntermediateResidualBlock(channels)

Depthwise 1D residual block used in angular interpolation.

IntermediateResidualBlock.forward(self, x)

No docstring is available.

class DenoisingBlock

Deep CNN block for denoising reconstructed CT images. Architecture: - One initial convolutional layer with ReLU - Fifteen residual Conv2d + BatchNorm2d + ReLU blocks - One final convolutional layer without activation This is adapted from the DBP model, but designed to process a single fused image rather than a stack of backprojections.

DenoisingBlock.initial_layer(self, in_channels, out_channels, kernel_size, stride, padding)

Builds the initial convolutional block of the network. This block consists of: - Conv2d - ReLU activation Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. kernel_size (int): Size of the convolutional kernel. stride (int): Convolution stride. padding (int): Zero-padding to add to each side. Returns: nn.Sequential: A sequential block with Conv2d and ReLU.

DenoisingBlock.conv_block(self, in_channels, out_channels, kernel_size, stride, padding)

Builds an intermediate convolutional block for the DBP architecture. This block includes: - Conv2d - BatchNorm2d - ReLU activation Args: in_channels (int): Number of input feature channels. out_channels (int): Number of output feature channels. kernel_size (int): Size of the convolutional kernel. stride (int): Convolution stride. padding (int): Zero-padding to apply. Returns: nn.Sequential: A sequential block with Conv2d, BatchNorm2d, and ReLU.

DenoisingBlock.final_layer(self, in_channels, out_channels, kernel_size, stride, padding)

Builds the final convolutional layer that produces the output image. This layer does not include an activation function. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels (typically 1). kernel_size (int): Size of the convolutional kernel. stride (int): Convolution stride. padding (int): Zero-padding to apply. Returns: nn.Conv2d: Final convolutional layer.

DenoisingBlock.forward(self, x)

Defines the forward pass of the DBP network. The input is passed sequentially through: - Initial convolutional block - Fifteen intermediate convolutional blocks - Final convolutional layer Args: x (torch.Tensor): Input tensor of shape (B, C, H, W), where: B = batch size, C = number of backprojection channels (n_single_BP), H, W = spatial dimensions. Returns: torch.Tensor: Output tensor of shape (B, 1, H, W), representing the reconstructed image.

class FusionFBPNetwork(geometry: ct.Geometry, model_parameters: LIONParameter = None)

FusionFBP Network for CT reconstruction. This architecture fuses physics-based filtering and backprojection with deep learning modules for interpolation and denoising. Pipeline: - Learnable frequency-domain filtering (Ram-Lak-based) - Angular interpolation via residual 1D convolutions - Differentiable backprojection using Tomosipo - Deep CNN-based image denoising Args: num_detectors (int): Number of detector bins. num_angles (int): Number of projection angles. A (ts.Operator): Tomosipo projection operator. filter_type (str): Either β€˜Filter I’ (shared) or Filter II. device (torch.device): Computation device.

FusionFBPNetwork.compute_projection_size_padded(self)

Computes the next power-of-two padding size to avoid aliasing.

FusionFBPNetwork.ram_lak_filter(self, size)

Generates Ram-Lak filter directly in frequency domain.

FusionFBPNetwork.default_parameters()

No docstring is available.

FusionFBPNetwork.forward(self, x)

No docstring is available.