SynthShapes.texturizing
The SynthShapes.texturizing module provides tools for converting labeled data
into textured intensity images, facilitating the creation of synthetic medical
images with realistic textures.
LabelsToIntensities
Bases: Module
Convert a set of labeled data with unique IDs into intensity images using Gaussian Mixture Models.
This module transforms (int) labeled tensors, where each label represents a distinct region or structure, into intensity images. It applies a Gaussian Mixture Model (GMM) to texturize and assign semi-realistic intensity values to each label with randomly sampled mean values, facilitating the generation of synthetic images with varied textures.
Initialize the LabelsToIntensities module.
| PARAMETER | DESCRIPTION |
|---|---|
mu
|
Mean of GMM.
TYPE:
|
sigma
|
Sigma of GMM.
TYPE:
|
min
|
Minimum value of the output tensor (except background zeros)
TYPE:
|
max
|
Maximum value of output tensor.
TYPE:
|
transform
|
Single transform or moduledict
TYPE:
|
Source code in SynthShapes/texturizing.py
forward
Convert labeled data into intensity images by applying the GMM.
| PARAMETER | DESCRIPTION |
|---|---|
labels
|
Labels of shape (D, H, W) with unique integer IDs
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
An intensity image tensor where each label has been replaced by a corresponding intensity value (the average intensity value for that region). Background regions (label=0) are set to zero. Output shape is identical to input: (D, H, W) |
Source code in SynthShapes/texturizing.py
TexturizeLabels
Bases: Module
| PARAMETER | DESCRIPTION |
|---|---|
sigma
|
Standard deviation for label textures.
TYPE:
|
intensity
|
TYPE:
|
Source code in SynthShapes/texturizing.py
ParenchymaSynthesizer
Bases: Module
A torch.nn.Module subclass that synthesizes a background tensor by applying a series of transformations.
Source code in SynthShapes/texturizing.py
forward
Synthesizes the background by applying the defined transformations and blending multiple intensity tensors.
| PARAMETER | DESCRIPTION |
|---|---|
intensities_list
|
A list of tensors with intensities to blend into the background.
TYPE:
|
alpha
|
The blending parameter controlling the influence of intensities in the background.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The synthesized background tensor. |