spyrit.misc.load_data.generate_synthetic_tumors
- spyrit.misc.load_data.generate_synthetic_tumors(x: Tensor, tumor_params: List[dict]) Tuple[Tensor, Tensor][source]
Creates synthetic Gaussian tumors to a tensor of shape (batch, n_wav, *img_shape).
- Args:
x(torch.Tensor): Input tensor of shape (batch, n_wav, *img_shape)tumor_params(List[dict]): List of tumor parameters. Each dict should contain:center: (row, col) center position of the tumorsigma_x: Standard deviation of the Gaussian in the x directionsigma_y: Standard deviation of the Gaussian in the y directionamplitude: Amplitude of the tumorchannels: List of channel indices to add the tumor to (if None, adds to all channels)angle(optional): Rotation angle in degrees (counter-clockwise). Default is 0.
- Returns:
Tuple of (tumors, x_with_tumors):
tumors(torch.Tensor): Tensor of the same shape as x containing only the tumor contributions.x_with_tumors(torch.Tensor): Tensor of the same shape as x with the tumors added and values clamped to [0, 1].