| pktools 2.6.7 Processing Kernel for geospatial data

Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qgis.pkdiff_accuracy.pkdiff_accuracy Class Reference
Inheritance diagram for qgis.pkdiff_accuracy.pkdiff_accuracy:
[legend]
Collaboration diagram for qgis.pkdiff_accuracy.pkdiff_accuracy:
[legend]

## Public Member Functions
def | cliName (self)
def | defineCharacteristics (self)
def | processAlgorithm (self, progress)
Public Member Functions inherited from qgis.pktoolsAlgorithm.pktoolsAlgorithm
def | getIcon (self)
def | checkBeforeOpeningParametersDialog (self)
def | help (self)

## Public Attributes
| name
| group

## Static Public Attributes
string | INPUT = "INPUT"
string | REFERENCE = "REFERENCE"
string | ITERATE = "ITERATE"
string | LABELREF = "LABELREF"
string | NODATA = "NODATA"
string | OUTPUT = "OUTPUT"
string | CMOUTPUT = "CMOUTPUT"
list | CMFORMAT_OPTIONS = ["ascii", "latex"]
string | CMFORMAT = "CMFORMAT"
string | FORMAT = "FORMAT"
string | LABELCLASS = "LABELCLASS"
string | EXTRA = 'EXTRA'

## Detailed Description

Definition at line 93 of file pkdiff_accuracy.py.

## Member Function Documentation

## ◆ cliName()

def qgis.pkdiff_accuracy.pkdiff_accuracy.cliName | ( |  | self | ) |

Definition at line 110 of file pkdiff_accuracy.py.

110 def cliName(self):
111 return "pkdiff"
112

## ◆ defineCharacteristics()

def qgis.pkdiff_accuracy.pkdiff_accuracy.defineCharacteristics | ( |  | self | ) |

Definition at line 113 of file pkdiff_accuracy.py.

113 def defineCharacteristics(self):
114 self.name = "Accuracy assessment with ground reference"
115 self.group = "[pktools] supervised classification"
116 self.addParameter(ParameterRaster(self.INPUT, 'Classification result (raster map)'))
117 self.addParameter(ParameterVector(self.REFERENCE, 'Labeled reference vector data set'))
118 self.addParameter(ParameterBoolean(self.ITERATE, "Iterate over all layers",True))
119 self.addParameter(ParameterString(self.LABELREF, "Attribute name of the reference label","label"))
120 self.addParameter(ParameterString(self.NODATA, "No data value(s) in input or reference dataset to ignore (e.g., 0;255)","0"))
121 self.addOutput(OutputFile(self.CMOUTPUT, self.tr("Confusion matrix output file ")))
122 self.addParameter(ParameterSelection(self.CMFORMAT,"Format for confusion matrix output",self.CMFORMAT_OPTIONS, 0))
123
124# self.addOutput(OutputTable(self.TABLE, self.tr('Confusion matrix table')))
125 self.addOutput(OutputVector(self.OUTPUT, 'Assessment output vector data set'))
126 self.addParameter(ParameterSelection(self.FORMAT,
127 'Assessment output vector Format', FORMATS))
128 self.addParameter(ParameterString(self.LABELCLASS, "Attribute name of classified (map) label","class"))
129 self.addParameter(ParameterString(self.EXTRA,
130 'Additional parameters', '', optional=True))
131

## ◆ processAlgorithm()

def qgis.pkdiff_accuracy.pkdiff_accuracy.processAlgorithm | ( |  | self,
|  |  | progress
| ) |  |

Definition at line 132 of file pkdiff_accuracy.py.

132 def processAlgorithm(self, progress):
133 cliPath = '"' + os.path.join(pktoolsUtils.pktoolsPath(), self.cliName()) + '"'
134 commands = [cliPath]
135 #outputtable = self.getOutputFromName(self.TABLE)
136
137 input=self.getParameterValue(self.INPUT)
138 commands.append('-i')
139 commands.append('"' + input + '"')
140
141 reference=self.getParameterValue(self.REFERENCE)
142 if self.getParameterValue(self.ITERATE):
143 if str(reference).find('|')>0:
144 referencename=str(reference)[:str(reference).find('|')]
145 else:
146 referencename=str(reference)
147 else:
148 referencename=str(reference).replace("|layername"," -ln")
149 commands.append('-ref')
150 commands.append(referencename)
151
152 commands.append('-lr');
153 commands.append(self.getParameterValue(self.LABELREF))
154
155 nodata=self.getParameterValue(self.NODATA)
156 if nodata != "none":
157 nodataValues = nodata.split(';')
158 for nodataValue in nodataValues:
159 commands.append('-nodata')
160 commands.append(nodataValue)
161
162 commands.append("-cm")
163 commands.append("-cmf")
164 commands.append(self.CMFORMAT_OPTIONS[self.getParameterValue(self.CMFORMAT)])
165 commands.append("-cmo")
166 commands.append(self.getOutputValue(self.CMOUTPUT))
167
168 output = self.getOutputFromName(self.OUTPUT)
169 outFile = output.value
170 formatIdx = self.getParameterValue(self.FORMAT)
171 outFormat = '"' + FORMATS[formatIdx] + '"'
172 commands.append('-f')
173 commands.append(outFormat)
174 ext = EXTS[formatIdx]
175 if not outFile.endswith(ext):
176 outFile += ext
177 output.value = outFile
178 commands.append('-o')
179 commands.append('"' + outFile + '"')
180 commands.append('-lc');
181 commands.append(self.getParameterValue(self.LABELCLASS))
182
183 extra = str(self.getParameterValue(self.EXTRA))
184 if len(extra) > 0:
185 commands.append(extra)
186
187 pktoolsUtils.runpktools(commands, progress)

## Member Data Documentation

## ◆ CMFORMAT

string qgis.pkdiff_accuracy.pkdiff_accuracy.CMFORMAT = "CMFORMAT"
| static

Definition at line 104 of file pkdiff_accuracy.py.

## ◆ CMFORMAT_OPTIONS

list qgis.pkdiff_accuracy.pkdiff_accuracy.CMFORMAT_OPTIONS = ["ascii", "latex"]
| static

Definition at line 103 of file pkdiff_accuracy.py.

## ◆ CMOUTPUT

string qgis.pkdiff_accuracy.pkdiff_accuracy.CMOUTPUT = "CMOUTPUT"
| static

Definition at line 102 of file pkdiff_accuracy.py.

## ◆ EXTRA

string qgis.pkdiff_accuracy.pkdiff_accuracy.EXTRA = 'EXTRA'
| static

Definition at line 108 of file pkdiff_accuracy.py.

## ◆ FORMAT

string qgis.pkdiff_accuracy.pkdiff_accuracy.FORMAT = "FORMAT"
| static

Definition at line 106 of file pkdiff_accuracy.py.

## ◆ group

qgis.pkdiff_accuracy.pkdiff_accuracy.group

Definition at line 115 of file pkdiff_accuracy.py.

## ◆ INPUT

string qgis.pkdiff_accuracy.pkdiff_accuracy.INPUT = "INPUT"
| static

Definition at line 95 of file pkdiff_accuracy.py.

## ◆ ITERATE

string qgis.pkdiff_accuracy.pkdiff_accuracy.ITERATE = "ITERATE"
| static

Definition at line 97 of file pkdiff_accuracy.py.

## ◆ LABELCLASS

string qgis.pkdiff_accuracy.pkdiff_accuracy.LABELCLASS = "LABELCLASS"
| static

Definition at line 107 of file pkdiff_accuracy.py.

## ◆ LABELREF

string qgis.pkdiff_accuracy.pkdiff_accuracy.LABELREF = "LABELREF"
| static

Definition at line 98 of file pkdiff_accuracy.py.

## ◆ name

qgis.pkdiff_accuracy.pkdiff_accuracy.name

Definition at line 114 of file pkdiff_accuracy.py.

## ◆ NODATA

string qgis.pkdiff_accuracy.pkdiff_accuracy.NODATA = "NODATA"
| static

Definition at line 99 of file pkdiff_accuracy.py.

## ◆ OUTPUT

string qgis.pkdiff_accuracy.pkdiff_accuracy.OUTPUT = "OUTPUT"
| static

Definition at line 101 of file pkdiff_accuracy.py.

## ◆ REFERENCE

string qgis.pkdiff_accuracy.pkdiff_accuracy.REFERENCE = "REFERENCE"
| static

Definition at line 96 of file pkdiff_accuracy.py.

The documentation for this class was generated from the following file:

- /tmp/slackdce/slackrepo.NvCr9x/build_pktools/PKTOOLS-2.6.7.6/qgis/pkdiff_accuracy.py