Voxelmorph2d

Labelprop Index / Labelprop / Voxelmorph2d

Auto-generated documentation for labelprop.voxelmorph2d module.

AffineGenerator

Show source in voxelmorph2d.py:178

Dense network that takes affine matrix and generate affine transformation

Signature

class AffineGenerator(nn.Module):
    def __init__(self, inshape): ...

AffineGenerator().forward

Show source in voxelmorph2d.py:189

Signature

def forward(self, x1, x2): ...

AffineGenerator3D

Show source in voxelmorph2d.py:197

Dense network that takes affine matrix and generate affine transformation

Signature

class AffineGenerator3D(nn.Module):
    def __init__(self, inshape): ...

AffineGenerator3D().forward

Show source in voxelmorph2d.py:208

Signature

def forward(self, x1, x2): ...

Dice

Show source in voxelmorph2d.py:518

N-D dice for segmentation

Signature

class Dice: ...

Dice().loss

Show source in voxelmorph2d.py:523

Signature

def loss(self, y_true, y_pred): ...

FeaturesToAffine

Show source in voxelmorph2d.py:158

Dense network that takes pixels of features map and convert it to affine matrix

Signature

class FeaturesToAffine(nn.Module):
    def __init__(self, inshape): ...

FeaturesToAffine().forward

Show source in voxelmorph2d.py:172

Signature

def forward(self, x): ...

Grad

Show source in voxelmorph2d.py:531

N-D gradient loss.

Signature

class Grad:
    def __init__(self, penalty="l1", loss_mult=None): ...

Grad().loss

Show source in voxelmorph2d.py:540

Signature

def loss(self, _, y_pred): ...

MSE

Show source in voxelmorph2d.py:509

Mean squared error loss.

Signature

class MSE: ...

MSE().loss

Show source in voxelmorph2d.py:514

Signature

def loss(self, y_true, y_pred): ...

MultiLevelNet

Show source in voxelmorph2d.py:257

Convolutional network generating deformation field with different scales.

Signature

class MultiLevelNet(nn.Module):
    def __init__(self, inshape, in_channels=2, levels=3, features=16): ...

MultiLevelNet().compose_deformation

Show source in voxelmorph2d.py:309

Returns flow_k_j(flow_i_k(.)) flow

Arguments

flow_i_k flow_k_j

Returns

  • [Tensor] - Flow field flow_i_j = flow_k_j(flow_i_k(.))

Signature

def compose_deformation(self, flow_i_k, flow_k_j): ...

MultiLevelNet().compose_list

Show source in voxelmorph2d.py:303

Signature

def compose_list(self, flows): ...

MultiLevelNet().forward

Show source in voxelmorph2d.py:320

For each levels, downsample the input and apply the convolutional block.

Signature

def forward(self, x, registration=False): ...

MultiLevelNet().get_conv_blocks

Show source in voxelmorph2d.py:279

For each levels, create a convolutional block with two Conv Tanh BatchNorm layers

Signature

def get_conv_blocks(self, in_channels, levels, intermediate_features): ...

MultiLevelNet().get_downsample_blocks

Show source in voxelmorph2d.py:273

Signature

def get_downsample_blocks(self, in_channels, levels): ...

MultiLevelNet().get_transformer_list

Show source in voxelmorph2d.py:294

Create a list of spatial transformer for each level.

Signature

def get_transformer_list(self, levels, inshape): ...

NCC

Show source in voxelmorph2d.py:444

Local (over window) normalized cross correlation loss.

Signature

class NCC:
    def __init__(self, win=None): ...

NCC().loss

Show source in voxelmorph2d.py:452

Signature

def loss(self, y_true, y_pred, mean=True): ...

ResizeTransform

Show source in voxelmorph2d.py:410

Resize a transform, which involves resizing the vector field and rescaling it.

Signature

class ResizeTransform(nn.Module):
    def __init__(self, vel_resize, ndims): ...

ResizeTransform().forward

Show source in voxelmorph2d.py:424

Signature

def forward(self, x): ...

SingleLevelNet

Show source in voxelmorph2d.py:215

Convolutional network generating deformation field

Signature

class SingleLevelNet(nn.Module):
    def __init__(self, inshape, in_channels=2, features=16): ...

SingleLevelNet().forward

Show source in voxelmorph2d.py:245

Forward pass of the network

Arguments

  • x [Tensor] - Tensor of shape (B,C,H,W)

Returns

  • [Tensor] - Tensor of shape (B,C,H,W)

Signature

def forward(self, x): ...

SingleLevelNet().get_conv_blocks

Show source in voxelmorph2d.py:227

For each levels, create a convolutional block with two Conv Tanh BatchNorm layers

Signature

def get_conv_blocks(self, in_channels, intermediate_features): ...

SpatialTransformer

Show source in voxelmorph2d.py:343

N-D Spatial Transformer

Signature

class SpatialTransformer(nn.Module):
    def __init__(self, size, mode="bilinear", levels=4): ...

SpatialTransformer().forward

Show source in voxelmorph2d.py:368

Signature

def forward(self, src, flow): ...

VecInt

Show source in voxelmorph2d.py:390

Integrates a vector field via scaling and squaring.

Signature

class VecInt(nn.Module):
    def __init__(self, inshape, nsteps): ...

VecInt().forward

Show source in voxelmorph2d.py:403

Signature

def forward(self, vec): ...

VxmDense

Show source in voxelmorph2d.py:10

VoxelMorph network for (unsupervised) nonlinear registration between two images.

Signature

class VxmDense(nn.Module):
    def __init__(
        self,
        inshape,
        int_steps=7,
        int_downsize=2,
        bidir=False,
        use_probs=False,
        src_feats=1,
        trg_feats=1,
        unet_half_res=False,
        sub_levels=3,
    ): ...

VxmDense().forward

Show source in voxelmorph2d.py:111

Arguments

  • source - Source image tensor.
  • target - Target image tensor.
  • registration - Return transformed image and flow. Default is False.

Signature

def forward(self, source, target, registration=False): ...