Pretraining Model
Labelprop Index / Labelprop / Pretraining Model
Auto-generated documentation for labelprop.Pretraining_model module.
- Pretraining Model
- LabelProp
- LabelProp().apply_deform
- LabelProp().apply_successive_transformations
- LabelProp().automatic_optimization
- LabelProp().blend
- LabelProp().compose_deformation
- LabelProp().compose_list
- LabelProp().compute_loss
- LabelProp().configure_optimizers
- LabelProp().forward
- LabelProp().hardmax
- LabelProp().multi_class_dice
- LabelProp().norm
- LabelProp().register_images
- LabelProp().training_step
LabelProp
Show source in Pretraining_model.py:12
Signature
class LabelProp(pl.LightningModule):
def __init__(
self,
n_channels=1,
n_classes=2,
learning_rate=0.001,
weight_decay=1e-08,
way="up",
shape=256,
selected_slices=None,
losses={},
by_composition=False,
): ...
LabelProp().apply_deform
Show source in Pretraining_model.py:46
Apply deformation to x from flow field
Arguments
xTensor - Image or mask to deform (BxCxHxW)fieldTensor - Deformation field (Bx2xHxW)
Returns
Tensor- Transformed image
Signature
def apply_deform(self, x, field, ismask=False): ...
LabelProp().apply_successive_transformations
Show source in Pretraining_model.py:77
Arguments
movingTensor - Moving image (BxCxHxW)flows[Tensor] - List of deformation fields (Bx2xHxW)
Returns
Tensor- Transformed image
Signature
def apply_successive_transformations(self, moving, flows): ...
LabelProp().automatic_optimization
Show source in Pretraining_model.py:14
Signature
@property
def automatic_optimization(self): ...
LabelProp().blend
Show source in Pretraining_model.py:136
Signature
def blend(self, x, y): ...
LabelProp().compose_deformation
Show source in Pretraining_model.py:66
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): ...
LabelProp().compose_list
Show source in Pretraining_model.py:59
Signature
def compose_list(self, flows): ...
LabelProp().compute_loss
Show source in Pretraining_model.py:116
Arguments
moved : Transformed anatomical image target : Target anatomical image moved_mask : Transformed mask target_mask : Target mask field : Deformation field
Signature
def compute_loss(
self, moved=None, target=None, moved_mask=None, target_mask=None, field=None
): ...
LabelProp().configure_optimizers
Show source in Pretraining_model.py:262
Signature
def configure_optimizers(self): ...
LabelProp().forward
Show source in Pretraining_model.py:103
Arguments
movingTensor - Moving image (BxCxHxW)target[type] - Fixed image (BxCxHxW)registrationbool, optional - If False, also return non-integrated inverse flow field. Else return the integrated one. Defaults to False.
Returns
movedTensor - Moved imagefieldTensor - Deformation field from moving to target
Signature
def forward(self, moving, target, registration=True): ...
LabelProp().hardmax
Show source in Pretraining_model.py:265
Signature
def hardmax(self, Y, dim): ...
LabelProp().multi_class_dice
Show source in Pretraining_model.py:90
Arguments
pred_with_logits- Predicted mask with logitstarget- Target mask
Signature
def multi_class_dice(self, pred_with_logits, target): ...
LabelProp().norm
Show source in Pretraining_model.py:17
Signature
def norm(self, x): ...
LabelProp().register_images
Show source in Pretraining_model.py:258
Signature
def register_images(self, moving, target, moving_mask): ...
LabelProp().training_step
Show source in Pretraining_model.py:142
Signature
def training_step(self, batch, batch_nb): ...