Helper Module for Deep Learning.
Unsupervised Learning with CNNs for Image Registration
-
class
pynet.models.voxelmorphnet.ConvBlock(dim, in_channels, out_channels, stride=1)[source]¶ Represents a single convolution block in the Unet which is a convolution based on the size of the input channel and output channels and then preforms a Leaky Relu with parameter 0.2.
-
class
pynet.models.voxelmorphnet.FlowRegularizer(k1=0.01)[source]¶ Total Variation Loss (Smooth Term).
For a dense flow field, we regularize it with the following loss that discourages discontinuity.
k1 * FlowLoss
FlowLoss: a gradient loss on the flow field. Recommend for k1 are 1.0 for ncc, or 0.01 for mse.
-
class
pynet.models.voxelmorphnet.SpatialTransformer(size, mode='bilinear')[source]¶ Represesents a spatial transformation block that uses the output from the UNet to preform a grid_sample.
-
class
pynet.models.voxelmorphnet.UNetCore(dim, enc_nf, dec_nf, full_size=True)[source]¶ Class representing the U-Net implementation that takes in a fixed image and a moving image and outputs a flow-field.
-
__init__(dim, enc_nf, dec_nf, full_size=True)[source]¶ Initiliza the UNet model.
- Parameters
enc_nf: list of int, default [16, 32, 32, 32]
the number of features maps for encoding stages.
dec_nf: int, default [32, 32, 32, 32, 32, 16, 16]
the number of features maps for decoding stages.
full_size: bool, default False
full amount of decoding layers.
-
-
class
pynet.models.voxelmorphnet.VoxelMorphNet(vol_size, enc_nf=[16, 32, 32, 32], dec_nf=[32, 32, 32, 32, 32, 16, 16], full_size=True)[source]¶ VoxelMorphNet.
An unsupervised learning-based inference algorithm that uses insights from classical registration methods and makes use of recent developments inconvolutional neural networks (CNNs).
VoxelMorph assumes that input images are pre-affined by an external tool.
2018 CVPR implementation of voxelmorph.
TODO: expand this model by including anatomical surface alignment, which enables training the network given (optional) anatomical segmentations -> described in the paper.
Reference: https://arxiv.org/abs/1903.03545. Code: https://github.com/voxelmorph/voxelmorph.
-
__init__(vol_size, enc_nf=[16, 32, 32, 32], dec_nf=[32, 32, 32, 32, 32, 16, 16], full_size=True)[source]¶ Init class.
- Parameters
vol_size: uplet
volume size of the atlas.
enc_nf: list of int, default [16, 32, 32, 32]
the number of features maps for encoding stages.
dec_nf: int, default [32, 32, 32, 32, 32, 16, 16]
the number of features maps for decoding stages.
full_size: bool, default False
full amount of decoding layers.
-
Follow us
Inspired by AZMIND template.