DIRECTModel#
- class deepinv.models.DIRECTModel(model_name='jointicnet_5x', pretrained=True, device='cpu')[source]#
Bases:
Reconstructor,MRIMixinPretrained MRI reconstruction models from DIRECT library.
Runs a pretrained model from DIRECT for (multi-coil) MRI reconstruction from kspace to images.
Available models:
Models trained on Calgary-Campinas 12-coil brain (downloaded from here)
jointicnet_5x(or_10x) [1],recurrentvarnet_5x(or_10x) [2],varnet_5x(or_10x) [3],conjgradnet_5x(or_10x) [4],iterdualnet_5x(or_10x) [5],kikinet_5x(or_10x) [6],lpdnet_5x(or_10x) [7],unet_5x(or_10x) [8],xpdnet_5x(or_10x) [9],multidomainnet[10] (downloaded from DIRECT, repaired locally, uploaded to HF).
Models trained on a mix of MRI datasets (including brain, cardiac, knee and prostate) (downloaded from here)
The wrapped models handle the MRI physics and estimate coil maps themselves.
Note
deepinv uses centered FFTs but DIRECT uses uncentered, so we pre-shift
y(a checkerboard modulation) into DIRECT’s convention.Also, the output scale is not preserved, so its intensity is proportional to but not equal to
y.Note
This model requires DIRECT >=2.2.0 and Python >=3.12. Install it with
pip install deepinv[direct]. The model should be used on non-CPU devices. CPU support is experimental and depends on your platform due to DIRECT requirement constraints.Warning
Currently, this model can only be used for evaluation, not training/fine-tuning. If you want to use the model in training mode, please open a feature request issue on GitHub.
- Parameters:
model_name (str) – model name, see list above.
pretrained (bool, str) – If
True, the model will be initialized with pretrained weights from DIRECT. Ifstr, load from file.device (torch.device, str) – device.
- Example:
>>> import deepinv as dinv >>> model = dinv.models.DIRECTModel("vsharp_brain") >>> x_hat = model(y, physics) # y: multicoil k-space, physics: dinv.physics.MultiCoilMRI
- References:
- forward(y, physics, **kwargs)[source]#
Reconstruct image from k-space
yandphysics.- Parameters:
y (torch.Tensor) – k-space of shape
(B,2,N,H,W)for multicoil or(B,2,H,W)for singlecoil MRI.physics (deepinv.physics.MultiCoilMRI, deepinv.physics.MRI) – MRI physics with mask (coil maps ignored).
Examples using DIRECTModel:#
Reconstruct undersampled k-space for cardiac and brain MRI