fetalbrain.tedsnet_multi.teds_multi_segm module

How to apply our segmentation method

fetalbrain.tedsnet_multi.teds_multi_segm.generate_multiclass_prediction(prediction: Tensor) ndarray[source]

Convert the TEDS-multiclass output into a multiclass segmentation mask

Note: I don’t think this works for batches atm :param prediction: prediction from TEDS model of size [B, 10, H, W, D]

Returns:

combined_pred – multiclass segmentation mask of size [H, W, D]

fetalbrain.tedsnet_multi.teds_multi_segm.get_prior_shape_sa(sd: Literal[0, 1]) Tensor[source]

Get the prior paired with each week and side

Parameters:

sd – which side to get the prior shape for, either 0 or 1

Returns:

prior_shape – tensor containing the prior shape

Example

>>> prior_shape = get_prior_shape_sa(0)
fetalbrain.tedsnet_multi.teds_multi_segm.load_tedsmulti_model(model_path: Path | None = None) TEDS_Net[source]

Load the trained multistructure segmentation model

Parameters:

model_path – path to the trained model weights

Returns:

model – segmentation model with trained weights loaded

Example

>>> model = load_tedsmulti_model()
fetalbrain.tedsnet_multi.teds_multi_segm.segment_scan_tedsall(aligned_scan: Tensor) tuple[ndarray, dict][source]

Executes the whole TEDSall segmentation pipeline

Parameters:

aligned_scan – _description_

Returns:

_description_

fetalbrain.tedsnet_multi.teds_multi_segm.segment_tedsall(aligned_scan: Tensor, segm_model: TEDS_Net, side: Literal[0, 1] = 0) tuple[ndarray, dict][source]

_summary_

Parameters:
  • aligned_scan – _description_

  • segm_model – _description_

  • side – _description_. Defaults to “0”.

Returns:

_description_