make decorrelation stretch algorithm a renderer

Issue #813 resolved
Andreas Janz created an issue

As discussed in #450.

Comments (12)

  1. Andreas Janz reporter

    @Agustin Lobo FYI - implemented it as a renderer. I guess we can remove the algo version, right?

  2. Royden Yates

    Firstly, THANK YOU for developing this!

    Is this not working with QGIS Master?

    Your Example data works via “Visualization → Decorr Stretch” but not through the renderer. I get:

    TypeError: __init__() got an unexpected keyword argument 'clip'

    Traceback (most recent call last):
      File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/renderer/decorrelationstretchrenderer.py", line 217, in onApplyClicked
        self.layer.setRenderer(self.currentRenderer())
      File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/typeguard/__init__.py", line 903, in wrapper
        retval = func(*args, **kwargs)
      File "/home/royden/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/renderer/decorrelationstretchrenderer.py", line 197, in currentRenderer
        scaler2 = MinMaxScaler(feature_range=[0, 255], clip=True)
      File "/usr/lib/python3/dist-packages/sklearn/utils/validation.py", line 72, in inner_f
        return f(**kwargs)
    TypeError: __init__() got an unexpected keyword argument 'clip'
    

    Python version: 3.9.5 (default, May 11 2021, 08:20:37) [GCC 10.3.0]
    QGIS version: 3.23.0-Master Master, 8e46f2ca6a

  3. Andreas Janz reporter

    Your Scikit-Learn is outdated I would guess. Please check in the console:

    import sklearn
    sklearn.__version__
    '0.24.2'
    

    You need 0.24 or higher.

  4. Andreas Janz reporter

    Regarding the running DCS: instead of doing it blockwise and blend the blocks together. You can already maximize the local variation by zooming to a location and use the “Current canvas” option:

  5. Royden Yates

    Found that - very useful.

    So the Visualisation algo route is the only way to get the decorr stretch into QGIS? “Save as” for the rendered decorr just saves the pre-rendered image.

  6. Andreas Janz reporter

    I think you are right. Unfortunately, QGIS doesn’t support custom raster renderer to be registered to QGIS. Because of this we loose the renderer when moving (i.e. cloning) the layer from the EnMAP-Box to QGIS.

  7. Andreas Janz reporter

    Or maybe not, just tested to move a raster layer with a standard renderer from EnMAP-Box to QGIS via drag&drop. Here I also loose the current renderer. I’ll create a new issue for that.

  8. Log in to comment