Skip to content

cornucopia.contrast

This module contains transforms that operate on image contrasts.

ContrastMixtureFinalTransform

ContrastMixtureFinalTransform(z, mu0, sigma0, mu, sigma, **kwargs)

Bases: FinalTransform

Classwise shift and rescaling.

Parameters:

Name Type Description Default
z (K, *spatial) tensor

Probability that each voxel belongs to a given class.

required
mu0 (K, C) tensor

Original means for each class.

required
sigma0 (K, C, C) tensor

Original covariances for each class.

required
mu (K, C) tensor

New means for each class.

required
sigma (K, C, C) tensor

New covariances for each class.

required

ContrastMixtureTransform

ContrastMixtureTransform(nk=16, keep_background=True, *, shared=False, **kwargs)

Bases: NonFinalTransform

Find intensity modes using a GMM and change their means and covariances.

References
  1. Meyer, M.I., de la Rosa, E., Pedrosa de Barros, N., Paolella, R., Van Leemput, K. and Sima, D.M., 2021. **A contrast augmentation approach to improve multi-scanner generalization in MRI. ** Frontiers in Neuroscience, 15, p.708196.
    @article{meyer2021,
      title={A contrast augmentation approach to improve
             multi-scanner generalization in MRI},
      author={Meyer, Maria Ines and de la Rosa, Ezequiel and
              Pedrosa de Barros, Nuno and Paolella, Roberto and
              Van Leemput, Koen and Sima, Diana M},
      journal={Frontiers in Neuroscience},
      volume={15},
      pages={708196},
      year={2021},
      publisher={Frontiers Media SA},
      url={https://www.frontiersin.org/articles/10.3389/fnins.2021.708196}
    }
    

Parameters:

Name Type Description Default
nk int

Number of classes

16
keep_background bool

Do not change background mean/cov. The background class is the class with minimum mean value.

True

Other Parameters:

Name Type Description
shared (channels, tensors, channels + tensors, '')

Apply the same contrast offset to all channels and/or tensors

Final class-attribute instance-attribute

Final = ContrastMixtureFinalTransform

The transform type returned by make_final.

Next class-attribute instance-attribute

Next = ContrastMixtureFinalTransform

The transform type returned by make_final.

ContrastLookupFinalTransform

ContrastLookupFinalTransform(edges, mu, **kwargs)

Bases: FinalTransform

Binwise intensity shift.

Parameters:

Name Type Description Default
edges (K+1,) tensor

The limits of each input bin.

required
mu (K,) tensor

The new mean value for each bin.

required

ContrastLookupTransform

ContrastLookupTransform(nk=16, keep_background=True, *, shared=False, **kwargs)

Bases: NonFinalTransform

Segment intensities into equidistant bins and change their mean value.

Parameters:

Name Type Description Default
nk int

Number of classes

16
keep_background bool

Do not change background mean/cov. The background class is the class with minimum mean value.

True

Final class-attribute instance-attribute

Final = ContrastLookupFinalTransform

The transform type returned by make_final.

Next class-attribute instance-attribute

Next = ContrastLookupFinalTransform

The transform type returned by make_final.