-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added (Rand)ScaleScaleIntensityFixedMean(d) and modified (Rand)Adjust…
…Contrast(d) (#6542) ### Description This PR adds the intensity transform **ScaleIntensityFixedMean** (including its random and random dictionary version) and modifies the intensity transform **AdjustContrast** and its dictionary version. It adds functionality available in the corresponding nnU-Net transforms [**ContrastAugmentationTransform**](https://github.com/MIC-DKFZ/batchgenerators/blob/7fb802b28b045b21346b197735d64f12fbb070aa/batchgenerators/transforms/color_transforms.py#L25) and [**GammaTransform**](https://github.com/MIC-DKFZ/batchgenerators/blob/7fb802b28b045b21346b197735d64f12fbb070aa/batchgenerators/transforms/color_transforms.py#L132). Specifically, **ScaleIntensityFixedMean** scales the intensity of the input image by a factor _v = v * (1 + factor)_ (same as the existing **ScaleIntensity** transform when used with the factor argument). The added functionality is provided by two arguments: 1. _fixed_mean_: subtract the mean intensity before scaling with _factor_, then add the same value after scaling to ensure that the output has the same mean intensity as the input. 2. _preserve_range_: clips the output array/tensor to the range of the input array/tensor AdjustContrast was modified by adding two arguments: 1. _invert_image_: multiplies all intensity values by -1 before gamma transform and again after gamma transform 2. _retain_stats_: applies a scaling factor and an offset to all intensity values after the gamma transform to ensure that the output intensity distribution has the same mean and standard deviation as the intensity distribution of the input ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Aaron Kujawa <askujawa@gmail.com>
- Loading branch information
1 parent
c33f1ba
commit 52b3ed2
Showing
9 changed files
with
593 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.