There's significant overlap between LinearStretching and a family of related, non-deprecated functions in ImageCore (https://juliaimages.org/latest/function_reference/#ImageCore.scaleminmax, etc.). However, the overlap isn't complete (there's no analogue here for scalesigned(min, center, max), and the APIs don't match, which may become a source of confusion. To reduce the size of the API surface, the missing methods should be added to ImageContrastAdjustment, and the corresponding functions in ImageCore should be deprecated.
To incorporate scalesigned(min, center, max) and scalesigned(maxabs) into LinearStretching, the source -> target intensity mapping can be generalized to accept three (or more) intensity levels, representing a piecewise-linear intensity transformation. Johnny's recent PR #28 is a good base (thanks!), but the function and interface would need to be further overhauled for piecewise-linear maps.
I'd also like to cover the use-case described by @bjarthur in issue #27:
My sole use case is imadjustintensity(img, quantile(img,[0.01,0.99])), which i find quite good at eliminating outliers when adjusting the brightness.
I've typed out the exact same function call countless times in various projects over the last few years. For a more Julian interface, let's look to Percentile. For example,
LinearStretching(Percentiles(1, 99))
LinearStretching(Quantiles(.015, .985))
LinearStretching(Percentiles(0, 50, 100), (-1, 0, 1)) would replace scalesigned(min, center, max)
LinearStretching(maxabs, (-1, 0, 1)) would replace scalesigned(maxabs)
There's significant overlap between
LinearStretchingand a family of related, non-deprecated functions inImageCore(https://juliaimages.org/latest/function_reference/#ImageCore.scaleminmax, etc.). However, the overlap isn't complete (there's no analogue here forscalesigned(min, center, max), and the APIs don't match, which may become a source of confusion. To reduce the size of the API surface, the missing methods should be added to ImageContrastAdjustment, and the corresponding functions in ImageCore should be deprecated.To incorporate
scalesigned(min, center, max)andscalesigned(maxabs)intoLinearStretching, the source -> target intensity mapping can be generalized to accept three (or more) intensity levels, representing a piecewise-linear intensity transformation. Johnny's recent PR #28 is a good base (thanks!), but the function and interface would need to be further overhauled for piecewise-linear maps.I'd also like to cover the use-case described by @bjarthur in issue #27:
I've typed out the exact same function call countless times in various projects over the last few years. For a more Julian interface, let's look to
Percentile. For example,LinearStretching(Percentiles(1, 99))LinearStretching(Quantiles(.015, .985))LinearStretching(Percentiles(0, 50, 100), (-1, 0, 1))would replacescalesigned(min, center, max)LinearStretching(maxabs, (-1, 0, 1))would replacescalesigned(maxabs)