4 *************************************************************************** 5 pktoolsAlgorithmProvider.py 8 Copyright : (C) 2015 by Pieter Kempeneers 9 Email : kempenep at gmail dot com 10 *************************************************************************** 12 * This program is free software; you can redistribute it and/or modify * 13 * it under the terms of the GNU General Public License as published by * 14 * the Free Software Foundation; either version 2 of the License, or * 15 * (at your option) any later version. * 17 *************************************************************************** 20 __author__ =
'Pieter Kempeneers' 21 __date__ =
'April 2015' 22 __copyright__ =
'(C) 2015, Pieter Kempeneers' 24 __revision__ =
'$Format:%H$' 29 from pktools.pkcomposite
import pkcomposite
30 from pktools.pkcrop
import pkcrop
31 from pktools.pkreclass
import pkreclass
32 from pktools.pkgetmask
import pkgetmask
33 from pktools.pksetmask
import pksetmask
35 from pktools.pkextract
import pkextract
36 from pktools.pkextract_grid
import pkextract_grid
37 from pktools.pkextract_random
import pkextract_random
39 from pktools.pksvm
import pksvm
40 from pktools.pkdiff_accuracy
import pkdiff_accuracy
42 from pktools.pklas2img
import pklas2img
43 from pktools.pkfilterdem
import pkfilterdem
45 from pktools.pkfilter_spectral
import pkfilter_spectral
46 from pktools.pkfilter_spatial
import pkfilter_spatial
48 from processing.core.AlgorithmProvider
import AlgorithmProvider
49 from processing.core.ProcessingConfig
import Setting, ProcessingConfig
51 from PyQt4
import QtGui
52 from pktools.pktoolsUtils
import pktoolsUtils
57 MY_DUMMY_SETTING =
"MY_DUMMY_SETTING" 60 AlgorithmProvider.__init__(self)
65 self.
alglist = [pkreclass(),pkcrop(),pkcomposite(),pkgetmask(),pksetmask(),pkextract(),pkextract_grid(),pkextract_random(),pksvm(),pkdiff_accuracy(),pklas2img(),pkfilterdem(),pkfilter_spectral(),pkfilter_spatial()]
74 '''In this method we add settings needed to configure our provider. 75 Do not forget to call the parent method, since it takes care or 76 automatically adding a setting for activating or deactivating the 77 algorithms in the provider 79 AlgorithmProvider.initializeSettings(self)
80 ProcessingConfig.addSetting(Setting(self.
getDescription(), pktoolsUtils.PKTOOLS_FOLDER,
"pktools folder", pktoolsUtils.pktoolsPath()))
88 '''Setting should be removed here, so they do not appear anymore 89 when the plugin is unloaded''' 90 AlgorithmProvider.unload(self)
91 ProcessingConfig.removeSetting(pktoolsAlgorithmProvider.MY_DUMMY_SETTING)
94 '''This is the name that will appear on the toolbox group. 95 It is also used to create the command line name of all the algorithms 101 '''This is the provired full name. 103 return "Utilities for remote sensing image processing" 106 filepath = os.path.dirname(__file__) +
"/logo.png" 107 return QtGui.QIcon(filepath)
109 def _loadAlgorithms(self):
110 '''Here we fill the list of algorithms in self.algs. 111 This method is called whenever the list of algorithms should be updated. 112 If the list of algorithms can change 113 (for instance, if it contains algorithms from user-defined scripts and 114 a new script might have been added), you should create the list again 116 In this case, since the list is always the same, we assign from the pre-made list. 117 This assignment has to be done in this method even if the list does not change, 118 since the self.algs list is cleared before calling this method