direct.nn.multidomainnet package#

Submodules#

direct.nn.multidomainnet.config module#

class direct.nn.multidomainnet.config.MultiDomainNetConfig(model_name: str = '???', engine_name: str | None = None, standardization: bool = True, num_filters: int = 16, num_pool_layers: int = 4, dropout_probability: float = 0.0)[source][source]#

Bases: ModelConfig

dropout_probability: float = 0.0#
num_filters: int = 16#
num_pool_layers: int = 4#
standardization: bool = True#

direct.nn.multidomainnet.multidomain module#

class direct.nn.multidomainnet.multidomain.MultiDomainConv2d(forward_operator, backward_operator, in_channels, out_channels, **kwargs)[source][source]#

Bases: Module

forward(image)[source][source]#

Performs forward pass of of MultiDomainConv2d.

Parameters:
image: torch.Tensor
Returns:
torch.Tensor
Return type:

Tensor

training: bool#
class direct.nn.multidomainnet.multidomain.MultiDomainConvBlock(forward_operator, backward_operator, in_channels, out_channels, dropout_probability)[source][source]#

Bases: Module

A multi-domain convolutional block that consists of two multi-domain convolution layers each followed by instance normalization, LeakyReLU activation and dropout.

forward(_input)[source][source]#

Performs forward pass of of MultiDomainConvBlock.

Parameters:
_input: torch.Tensor
Returns:
torch.Tensor
Return type:

Tensor

training: bool#
class direct.nn.multidomainnet.multidomain.MultiDomainConvTranspose2d(forward_operator, backward_operator, in_channels, out_channels, **kwargs)[source][source]#

Bases: Module

forward(image)[source][source]#

Performs forward pass of of MultiDomainConvTranspose2d.

Parameters:
image: torch.Tensor
Returns:
torch.Tensor
Return type:

Tensor

training: bool#
class direct.nn.multidomainnet.multidomain.MultiDomainUnet2d(forward_operator, backward_operator, in_channels, out_channels, num_filters, num_pool_layers, dropout_probability)[source][source]#

Bases: Module

Unet modification to be used with Multi-domain network as in AIRS Medical submission to the Fast MRI 2020 challenge.

forward(input_data)[source][source]#
Parameters:
input_data: torch.Tensor
Returns:
torch.Tensor
training: bool#
class direct.nn.multidomainnet.multidomain.TransposeMultiDomainConvBlock(forward_operator, backward_operator, in_channels, out_channels)[source][source]#

Bases: Module

A Transpose Convolutional Block that consists of one convolution transpose layers followed by instance normalization and LeakyReLU activation.

forward(input_data)[source][source]#
Parameters:
input_data: torch.Tensor
Returns:
torch.Tensor
training: bool#

direct.nn.multidomainnet.multidomainnet module#

class direct.nn.multidomainnet.multidomainnet.MultiDomainNet(forward_operator, backward_operator, standardization=True, num_filters=16, num_pool_layers=4, dropout_probability=0.0, **kwargs)[source][source]#

Bases: Module

Feature-level multi-domain module.

Inspired by AIRS Medical submission to the Fast MRI 2020 challenge.

forward(masked_kspace, sensitivity_map)[source][source]#

Performs forward pass of MultiDomainNet.

Parameters:
masked_kspace: torch.Tensor

Masked k-space of shape (N, coil, height, width, complex=2).

sensitivity_map: torch.Tensor

Sensitivity map of shape (N, coil, height, width, complex=2).

Returns:
output_image: torch.Tensor

Multi-coil output image of shape (N, coil, height, width, complex=2).

Return type:

Tensor

training: bool#
class direct.nn.multidomainnet.multidomainnet.StandardizationLayer(coil_dim=1, channel_dim=-1)[source][source]#

Bases: Module

Multi-channel data standardization method. Inspired by AIRS model submission to the Fast MRI 2020 challenge. Given individual coil images \(\{x_i\}_{i=1}^{N_c}\) and sensitivity coil maps \(\{S_i\}_{i=1}^{N_c}\) it returns

\[[(x_{\text{sense}}, {x_{\text{res}}}_1), ..., (x_{\text{sense}}, {x_{\text{res}}}_{N_c})]\]

where \({x_{\text{res}}}_i = xi - S_i \times x_{\text{sense}}\) and \(x_{\text{sense}} = \sum_{i=1}^{N_c} {S_i}^{*} \times x_i\).

forward(coil_images, sensitivity_map)[source][source]#

Performs forward pass of StandardizationLayer.

Parameters:
coil_images: torch.Tensor

Coil images tensor.

sensitivity_map: torch.Tensor

Sensitivity maps.

Returns:
torch.Tensor
Return type:

Tensor

training: bool#

direct.nn.multidomainnet.multidomainnet_engine module#

class direct.nn.multidomainnet.multidomainnet_engine.MultiDomainNetEngine(cfg, model, device, forward_operator=None, backward_operator=None, mixed_precision=False, **models)[source][source]#

Bases: MRIModelEngine

Multi Domain Network Engine.

forward_function(data)[source][source]#

This method performs the model’s forward method given data which contains all tensor inputs.

Must be implemented by child classes.

Return type:

Tuple[Tensor, None]

Module contents#