MIR.models.TransMorphLDDMM¶
- class MIR.models.TransMorphLDDMM(*args, **kwargs)[source]¶
TransMorph with an LDDMM (time-varying velocity field) transformation model.
- Parameters:
config – TransMorph configuration (see
configs_TransMorph);config.img_sizeis the size of the network input.param –
'shooting'(predict initial momentum, geodesic shooting) or'tvf'(predict a velocity field at every time step, relaxation).time_steps – Number of integration steps of the flow.
kernel – See
FourierKernel. Kernel parameters are expressed in network-input voxels. Ignored whensigmasis given.alpha – See
FourierKernel. Kernel parameters are expressed in network-input voxels. Ignored whensigmasis given.gamma – See
FourierKernel. Kernel parameters are expressed in network-input voxels. Ignored whensigmasis given.power – See
FourierKernel. Kernel parameters are expressed in network-input voxels. Ignored whensigmasis given.sigma – See
FourierKernel. Kernel parameters are expressed in network-input voxels. Ignored whensigmasis given.kernel_weights – See
FourierKernel. Kernel parameters are expressed in network-input voxels. Ignored whensigmasis given.sigmas – Gaussian standard deviations of a spatially varying kernel (region-specific LDDMM, the LDDMM counterpart of TransMorph-SPR). A small head on the decoder features predicts per-voxel kernel weights; the output dict then also contains
kernel_weightsand theomtpenalty to add to the loss.None= stationary kernel.weight_smooth_sigma – See
SpatiallyVaryingKernel.omt_power – See
SpatiallyVaryingKernel.spr –
None,'kernel'or'energy': add the TransMorph-SPR head (sigma_0..2convs + sigmoid, one weight maplamin (0, 1]) on the decoder features.'kernel'mapslamto the per-voxel kernel scale of the spatially varying kernel (sigmasrequired, 1 = smoothest);'energy'weights the kinetic-energy integrand bylamwith a stationary kernel. The output dict then containsspr_weightfor the Beta prior.int_scale – Integrate the flow on a grid
int_scaletimes finer than the network input ('shooting'only). The returned fields are at that resolution.swin_type – Only
'swin'is supported.
- Forward inputs:
inputs – Tuple
(mov, fix)of tensors [B, 1, D, H, W].return_dict – If True, return a dict with
flow,inv_flow,energy,energiesandmomentum(shooting) /pre_velocities(tvf), pluskernel_weightsandomtwith a spatially varying kernel.
- Forward outputs:
Dense displacement field [B, 3, D*int_scale, H*int_scale, W*int_scale] (or a dict).
- __init__(config, param='shooting', time_steps=7, kernel='helmholtz', alpha=2.0, gamma=1.0, power=2, sigma=2.0, kernel_weights=None, sigmas=None, weight_smooth_sigma=1.0, omt_power=2.0, spr=None, int_scale=1, swin_type='swin')[source]¶
Methods
__init__(config[, param, time_steps, ...])encode(mov, fix)Shared TransMorph encoder/decoder up to the half-resolution feature map.
forward(inputs[, return_dict])Predict the momentum (shooting) or per-step pre-velocities (tvf) and integrate the flow.
Attributes
spatially_varyingWhether
self.kernelis aSpatiallyVaryingKernel.