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'
23# This will get replaced with a git SHA1 when you do a git archive
24__revision__ = '$Format:%H$'
27#from pktools.ExampleAlgorithm import ExampleAlgorithm
29from pktools.pkcomposite import pkcomposite
30from pktools.pkcrop import pkcrop
31from pktools.pkreclass import pkreclass
32from pktools.pkgetmask import pkgetmask
33from pktools.pksetmask import pksetmask
34#raster/vector utilities
35from pktools.pkextract import pkextract
36from pktools.pkextract_grid import pkextract_grid
37from pktools.pkextract_random import pkextract_random
38#Supervised classification utilities
39from pktools.pksvm import pksvm
40from pktools.pkdiff_accuracy import pkdiff_accuracy
42from pktools.pklas2img import pklas2img
43from pktools.pkfilterdem import pkfilterdem
45from pktools.pkfilter_spectral import pkfilter_spectral
46from pktools.pkfilter_spatial import pkfilter_spatial
48from processing.core.AlgorithmProvider import AlgorithmProvider
49from processing.core.ProcessingConfig import Setting, ProcessingConfig
51from PyQt4 import QtGui
52from pktools.pktoolsUtils import pktoolsUtils
55class pktoolsAlgorithmProvider(AlgorithmProvider):
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