diff --git a/dzetsaka.py b/dzetsaka.py
index 909f5d4..ec00fe6 100644
--- a/dzetsaka.py
+++ b/dzetsaka.py
@@ -33,10 +33,12 @@
import os
from scripts import mainfunction
import tempfile
-
+import scipy as sp
+import gdal
# load dock
from ui.dzetsaka_dock import Ui_DockWidget
-from ui import filters_dock, historical_dock, help_dock
+from ui import filters_dock, historical_dock, help_dock, confusion_dock
+
# Load main widget
@@ -66,9 +68,8 @@ def __init__(self, iface):
self.iface = iface
QDialog.__init__(self)
sender = self.sender()
-
+
# Save reference to the QGIS interface
-
legendInterface = self.iface.legendInterface()
# initialize plugin directory
@@ -105,7 +106,9 @@ def __init__(self, iface):
self.dockwidget = None
self.dockwidget = dzetsakaDockWidget()
-
+ self.historicalmap = historical_dock()
+ self.filters_dock = filters_dock()
+ self.confusiondock = confusion_dock()
## Init to choose file (to load or to save)
self.dockwidget.outRaster.clear()
self.dockwidget.outRasterButton.clicked.connect(self.select_output_file)
@@ -123,37 +126,31 @@ def __init__(self, iface):
self.dockwidget.checkOutMatrix.clicked.connect(self.checkbox_state)
self.dockwidget.inField.clear()
- self.dockwidget.inShape.currentIndexChanged[int].connect(self.onChangedLayer)
+
self.dockwidget.inField.clear()
# Then we fill it with new selected Layer
- if self.dockwidget.inField.currentText() == '' and self.dockwidget.inShape.currentLayer() and self.dockwidget.inShape.currentLayer()!='NoneType':
- activeLayer = self.dockwidget.inShape.currentLayer()
- provider = activeLayer.dataProvider()
- fields = provider.fields()
- listFieldNames = [field.name() for field in fields]
- self.dockwidget.inField.addItems(listFieldNames)
-
- ##
+ def onChangedLayer():
+ """!@brief If active layer is changed, change column combobox"""
+ # We clear combobox
+ self.dockwidget.inField.clear()
+ # Then we fill it with new selected Layer
+ if self.dockwidget.inField.currentText() == '' and self.dockwidget.inShape.currentLayer() and self.dockwidget.inShape.currentLayer()!='NoneType':
+ activeLayer = self.dockwidget.inShape.currentLayer()
+ provider = activeLayer.dataProvider()
+ fields = provider.fields()
+ listFieldNames = [field.name() for field in fields]
+ self.dockwidget.inField.addItems(listFieldNames)
+
+ #
+ onChangedLayer()
+ self.dockwidget.inShape.currentIndexChanged[int].connect(onChangedLayer)
self.dockwidget.setMaximumHeight(400)
## let's run the classification !
self.dockwidget.performMagic.clicked.connect(self.runMagic)
- def onChangedLayer(self):
- """!@brief If active layer is changed, change column combobox"""
- # We clear combobox
- self.dockwidget.inField.clear()
- # Then we fill it with new selected Layer
- if self.dockwidget.inField.currentText() == '' and self.dockwidget.inShape.currentLayer() and self.dockwidget.inShape.currentLayer()!='NoneType':
- activeLayer = self.dockwidget.inShape.currentLayer()
- provider = activeLayer.dataProvider()
- fields = provider.fields()
- listFieldNames = [field.name() for field in fields]
- self.dockwidget.inField.addItems(listFieldNames)
-
-
def select_output_file(self):
"""!@brief Select file to save, and gives the right extension if the user don't put it"""
@@ -166,8 +163,7 @@ def select_output_file(self):
if not fileName:
return
-
- # If user give right file extension, we don't add it
+ # If user give right file extension, we don't add it
fileName,fileExtension=os.path.splitext(fileName)
if sender == self.dockwidget.outRasterButton:
@@ -185,14 +181,11 @@ def select_output_file(self):
self.historicalmap.outShp.setText(fileName+'.shp')
else:
self.historicalmap.outShp.setText(fileName+fileExtension)
- try:
- if sender == self.filters_dock.outRasterButton:
- if fileExtension!='.tif':
- self.filters_dock.outRaster.setText(fileName+'.tif')
- else:
- self.filters_dock.outRaster.setText(fileName+fileExtension)
- except:
- print('ko')
+ if sender == self.filters_dock.outRasterButton:
+ if fileExtension!='.tif':
+ self.filters_dock.outRaster.setText(fileName+'.tif')
+ else:
+ self.filters_dock.outRaster.setText(fileName+fileExtension)
def checkbox_state(self):
sender=self.sender()
@@ -406,11 +399,16 @@ def loadMenu(self):
## Separator
filterMenu.addSeparator()
- ## Historical map
+ # Historical map
self.menu.historicalMap = QAction(QIcon(":/plugins/dzetsaka/img/historicalmap.png"), "Historical Map Process", self.iface.mainWindow())
QObject.connect(self.menu.historicalMap, SIGNAL("triggered()"), self.loadHistoricalMap)
self.menu.addAction(self.menu.historicalMap)
-
+
+ # Confusion matrix
+ self.menu.confusionDock = QAction(QIcon(":/plugins/dzetsaka/img/table.png"), "Confusion matrix", self.iface.mainWindow())
+ QObject.connect(self.menu.confusionDock, SIGNAL("triggered()"), self.loadConfusion)
+ self.menu.addAction(self.menu.confusionDock)
+
# Help
self.menu.help = QAction(QIcon(":/plugins/dzetsaka/img/icon.png"), "Help", self.iface.mainWindow())
QObject.connect(self.menu.help, SIGNAL("triggered()"), self.helpPage)
@@ -420,6 +418,80 @@ def loadMenu(self):
menuBar = self.iface.mainWindow().menuBar()
menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu)
+ def loadConfusion(self):
+ self.confusiondock = confusion_dock()
+ self.confusiondock.show()
+
+
+ def onChangedLayer():
+ self.confusiondock.inField.clear()
+ # Then we fill it with new selected Layer
+ if self.confusiondock.inField.currentText() == '' and self.confusiondock.inShape.currentLayer() and self.confusiondock.inShape.currentLayer()!='NoneType':
+ activeLayer = self.confusiondock.inShape.currentLayer()
+ provider = activeLayer.dataProvider()
+ fields = provider.fields()
+ listFieldNames = [field.name() for field in fields]
+ self.confusiondock.inField.addItems(listFieldNames)
+
+ # automatic find column
+ onChangedLayer()
+ # if layer change, update
+ self.confusiondock.inShape.currentIndexChanged[int].connect(onChangedLayer)
+
+ # verif process
+ self.confusiondock.compare.clicked.connect(self.performConfusion)
+
+ def performConfusion(self):
+ message =''
+
+ try:
+ self.confusiondock.inRaster.currentLayer().dataProvider().dataSourceUri()
+ except:
+ message = "Sorry, you need a raster to make a classification."
+
+ inRaster=self.confusiondock.inRaster.currentLayer()
+ inRaster=inRaster.dataProvider().dataSourceUri()
+ datasrc = gdal.Open(inRaster)
+ if datasrc.RasterCount>1:
+ message='Your prediction must have only one dimension (no multi bands support)'
+
+ if message != '':
+ QtGui.QMessageBox.warning(self, 'Information missing or invalid', message, QtGui.QMessageBox.Ok)
+
+ else:
+
+ inShape = self.confusiondock.inShape.currentLayer()
+ # Remove layerid=0 from SHP Path
+ inShape=inShape.dataProvider().dataSourceUri().split('|')[0]
+
+ inField = self.confusiondock.inField.currentText()
+
+ worker=mainfunction.confusionMatrix()
+ worker.computeStatistics(inRaster,inShape,inField)
+ self.confusiondock.OA.setText(str(round(worker.OA*100,2))+str('%'))
+ self.confusiondock.kappa.setText(str(round(worker.Kappa*100,2))+str('%'))
+
+ ## Create and save CSV
+ import csv
+ outCsv = tempfile.mktemp('.csv')
+ sp.savetxt(outCsv,worker.confusion_matrix,delimiter=',',fmt='%1.4d')
+
+ self.model = QStandardItemModel(self)
+ ## add csv to Qtable
+
+ with open(outCsv, "rb") as fileInput:
+ for row in csv.reader(fileInput):
+ items = [
+ QStandardItem(field)
+ for field in row
+ ]
+ self.model.appendRow(items)
+
+ self.confusiondock.confusionTable.setModel(self.model)
+
+ # Auto adapt size to width
+ header = self.confusiondock.confusionTable.horizontalHeader()
+ header.setResizeMode(QHeaderView.Stretch)
def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS GUI."""
@@ -579,8 +651,11 @@ def runFilter(self):
def loadHistoricalMap(self):
self.historicalmap = historical_dock()
+
self.historicalmap.show()
-
+
+
+
# save raster
self.historicalmap.outRasterButton.clicked.connect(self.select_output_file)
self.historicalmap.outShpButton.clicked.connect(self.select_output_file)
diff --git a/img/filter.svg b/img/filter.svg
deleted file mode 100644
index ffe59fa..0000000
--- a/img/filter.svg
+++ /dev/null
@@ -1,615 +0,0 @@
-
-
diff --git a/img/table.png b/img/table.png
new file mode 100644
index 0000000..15b546b
Binary files /dev/null and b/img/table.png differ
diff --git a/metadata.txt b/metadata.txt
index c8ab973..ec2d272 100644
--- a/metadata.txt
+++ b/metadata.txt
@@ -10,7 +10,7 @@
name=dzetsaka : Classification tool
qgisMinimumVersion=2.0
description=Fast and Easy Classification plugin for Qgis
-version=1.1
+version=1.2
author=Nicolaï Van Lennepkade
email=karasiak.nicolas@gmail.com
@@ -23,8 +23,7 @@ repository=http://www.github.com/lennepkade/dzetsaka
# Recommended items:
# Uncomment the following line and add your changelog:
-changelog= filters for image (closing, median...), and new historical map process (for automatic vectorizing forest from old maps)
-
+changelog= New module : Compare prediction with truth (performs kappa, overall accuracy and confusion matrix)
# Tags are comma separated with spaces allowed
tags=classification,automatic,gaussian,mixture,model
diff --git a/resources.py b/resources.py
index 86aaaeb..bad7d4e 100644
--- a/resources.py
+++ b/resources.py
@@ -2,7 +2,7 @@
# Resource object code
#
-# Created: dim. juin 5 19:07:05 2016
+# Created: dim. juin 12 19:20:45 2016
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
@@ -1291,6 +1291,177 @@
\xe6\xde\x3f\x07\xd2\x93\xf2\xb9\x49\xb9\xfb\xe0\x1d\xb6\xef\x43\
\x97\xca\x0b\x75\x76\x75\x76\xc1\xbf\xb2\x76\x75\xf6\x7f\x8e\x04\
\x11\x7d\
+\x00\x00\x0a\x8d\
+\x89\
+\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
+\x00\x00\xf0\x00\x00\x00\xf0\x08\x06\x00\x00\x00\x3e\x55\xe9\x92\
+\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\
+\xa7\x93\x00\x00\x0a\x42\x49\x44\x41\x54\x78\x9c\xed\xdd\x5b\xac\
+\x5c\x55\x1d\xc7\xf1\xef\xa1\xf4\x06\x14\x5a\x2e\x2d\x89\xdc\x45\
+\x5a\xc5\x0b\xc1\x02\xa2\x82\x11\x7c\x32\x4a\x0d\x0a\x12\xd1\xca\
+\x83\x42\x42\x50\x94\x18\x7d\x31\x18\xa3\x31\x91\x17\x83\x48\x8c\
+\xc6\x7a\x01\x0a\x46\xe2\x85\x28\x4a\x08\x11\x24\x62\x02\x4a\x50\
+\x04\x94\x8b\x96\x3b\x81\x50\x40\xda\x02\xa5\xf4\x1c\x1f\x16\xc4\
+\x82\x3d\x73\xce\x9a\xf9\xaf\x3d\xf3\x9f\x7e\x3f\xc9\x4e\x4e\x32\
+\x33\xff\xbd\xf6\x3a\xfb\x37\xb3\x67\x9d\x7d\xd6\x02\x49\x92\x24\
+\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\
+\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\
+\x24\x49\x92\x24\x49\x02\x26\x3a\xda\xcf\x52\xe0\x04\xe0\xdd\xc0\
+\x21\xc0\x41\xc0\x1e\xc0\x62\x60\x97\x8e\xda\x20\xb5\xb6\x19\xf8\
+\x0f\xf0\x0c\xf0\x30\xb0\x0e\xb8\x19\xb8\xee\xe5\x9f\xc3\xb5\x0c\
+\xf0\x42\xe0\xe3\xc0\xc7\x80\xe3\x81\x9d\x1a\xee\x4b\x1a\x75\x7f\
+\x03\xae\x00\xd6\x00\x4f\x0e\xb9\x2d\x3d\xcd\x07\xbe\x08\x3c\x0e\
+\x4c\xb9\xb9\xb9\xbd\x6a\xdb\x08\x7c\x0b\x58\xc2\x08\x3a\x0e\xb8\
+\x9b\xe1\x77\x92\x9b\xdb\xa8\x6f\x4f\x50\xae\x4e\x07\x32\x67\xd0\
+\x02\xdb\x38\x17\x58\x0b\xec\x13\x58\x53\x1a\x57\xbb\x02\x1f\xa6\
+\xe4\xe5\x3a\x60\x6b\x3f\x45\x22\xbe\x03\xef\x4c\xb9\xae\x5f\x1d\
+\x50\x4b\xda\x11\xfd\x01\x58\x45\x19\x00\xab\x32\x68\x80\x77\x02\
+\x7e\x42\x19\xac\x92\xd4\xbf\x5b\x80\xf7\x01\x1b\x6a\x5e\x34\xe8\
+\xc8\xf0\x45\x18\x5e\x29\xc2\xd1\xc0\xaf\x28\x83\xc0\xb3\x36\x48\
+\x80\xbf\x00\x9c\x3d\xc0\xeb\x25\xbd\xda\x09\xc0\x8f\x6a\x5e\xd0\
+\xef\x20\xd6\x4a\xca\x80\x55\xe4\x20\x98\x24\x78\x0b\xf0\x6f\xe0\
+\xf6\xd9\x3c\xb9\x9f\xef\xc0\x73\x81\xdb\x80\xc3\xfb\x78\xad\xa4\
+\x99\x3d\x0d\xac\xa0\xfc\xa9\xa9\xa7\x7e\x2e\xa1\xcf\xc0\xf0\x4a\
+\x2d\x2d\x01\xce\x9f\xcd\x13\x6b\x3f\x81\xe7\x01\xf7\x01\xfb\xd7\
+\xb6\x48\x52\x95\x2d\xc0\xa1\xc0\x83\xbd\x9e\x54\xfb\x09\xfc\x41\
+\x0c\xaf\xd4\x85\xb9\xc0\xa7\x67\x7a\x52\x6d\x80\xcf\xe8\xab\x29\
+\x92\xfa\xb1\x9a\x19\xae\x92\x6b\x2e\xa1\x77\xa1\x7c\xb9\x9e\x37\
+\x48\x8b\x24\x55\x39\x92\x32\x68\xbc\x5d\x35\x9f\xc0\xef\xc2\xf0\
+\x4a\x5d\x3b\xb1\xd7\x83\x35\x01\x3e\x6a\xc0\x86\x48\xaa\xd7\x33\
+\x77\x35\x01\x5e\x3e\x60\x43\x24\xd5\xeb\x99\xbb\x9a\x00\x3b\xfa\
+\x2c\x75\xaf\x67\xee\x6a\x02\xbc\xdb\x80\x0d\x91\x54\x6f\x51\xaf\
+\x07\x6b\x02\xbc\x70\xc0\x86\x48\xaa\x37\xf7\xe5\x6d\xbb\x6a\x02\
+\xdc\xd5\x0c\x96\x92\x5e\x6d\xda\x9c\x3a\x53\xa4\x94\x98\x01\x96\
+\x12\x33\xc0\x52\x62\x06\x58\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\
+\x03\x2c\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\
+\x52\x62\x3b\x0f\x69\xbf\x77\x02\x3f\x05\x1e\x02\x9e\x1b\x52\x1b\
+\x6a\x2d\x04\xf6\x03\x4e\x05\xde\x16\x5c\x7b\x2b\x70\x25\xf0\x47\
+\x60\x3d\x7d\xae\x54\x37\x04\x7b\x52\xfa\x62\x35\x65\xb5\xbd\x48\
+\x0f\x01\x97\x50\x26\x39\xaf\x5a\x2f\x68\x88\xe6\x03\xcb\x80\x93\
+\x28\x8b\xda\x8f\x94\x3b\x88\x59\x17\xf5\x07\x0c\xef\x8d\x23\xc2\
+\x1c\xe0\x42\xe2\xd6\x89\x7d\x16\x78\x4f\xa7\x47\x10\xef\x50\x4a\
+\xd0\xa2\xfa\xe4\x1a\xf2\xff\xfb\xea\xb9\xc4\xf5\x47\xd5\x7a\x49\
+\xd3\x89\x08\xf0\x6d\x8c\xc7\x72\x2c\x13\xc0\x4d\xc4\xfc\x72\x3e\
+\xd5\x71\xdb\x5b\x39\x0a\x98\x64\xf0\xfe\x78\x9c\x19\xfe\x07\x36\
+\x91\x4b\x18\xb3\x00\x9f\x17\xd1\x90\x11\x71\x16\x83\xf7\xc7\x66\
+\xca\x6c\x9f\xe3\x22\xe2\x1c\xf9\x6e\xe7\xad\x6e\xe7\x44\x1a\x07\
+\xb8\xeb\x41\xac\x07\x3a\xde\x5f\x4b\xeb\x02\x6a\x3c\x49\x9e\x31\
+\x80\xd9\xb8\x3f\xa0\x86\xe7\x48\x85\xae\x03\x9c\x65\x70\x66\x36\
+\x5e\x1a\x91\x1a\xa3\x64\x4b\x40\x0d\xcf\x91\x0a\xfe\x19\x49\x4a\
+\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\x66\x80\xa5\xc4\x0c\
+\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\x06\x58\x4a\xcc\x00\x4b\
+\x89\x19\x60\x29\x31\x03\x2c\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\
+\x01\x96\x12\x33\xc0\x52\x62\x06\x58\x4a\xcc\x00\x4b\x89\x19\x60\
+\x29\x31\x03\x2c\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\
+\x33\xc0\x52\x62\x5d\x07\x38\xf3\xa2\x66\xaf\x35\x37\xa0\xc6\x38\
+\xf5\x07\xc4\xf4\xc9\x38\xac\x9d\xf5\x8a\x88\xfe\xe8\xa9\xeb\x00\
+\x1f\xd2\xf1\xfe\x5a\x3a\x34\xa0\xc6\x3e\x8c\xcf\x42\x5e\x10\xd3\
+\x27\xaf\x0f\xa8\x31\x2a\x22\xfa\x23\x4c\xc4\xc2\x55\x77\xd1\xc1\
+\xbb\x52\x07\xe6\x00\xb7\x12\xb3\x70\xd5\x67\x3a\x6e\x7b\x2b\xc7\
+\x13\xd3\x1f\x4f\x01\x4b\x3a\x6e\x7b\x2b\x57\xd2\x78\x71\xb3\x1a\
+\x51\xeb\x03\xff\x90\xdc\x97\x8e\x73\x80\x8b\x88\xe9\x8b\x29\x60\
+\x23\xe3\xb1\x3e\xf0\xfd\xc4\xf5\xc9\xb5\xe4\x5f\x1f\xf8\xf3\xc4\
+\xf5\xc7\xb4\x01\x9e\xa8\x68\xd0\x1d\xc0\xe1\x95\x07\x31\x9d\x7f\
+\x01\x6b\x81\x47\x82\xea\x75\x65\x5f\xe0\x74\xe0\xb0\xe0\xba\x93\
+\xc0\xd5\x94\x13\xf7\xc5\xe0\xda\x2d\x4d\x00\xc7\x02\x1f\x05\x16\
+\x04\xd7\x7e\x1c\xb8\x14\xb8\x37\xb8\x6e\x6b\x8b\x81\x53\x80\x95\
+\x81\x35\x17\x50\x96\xa2\xfd\x3f\xc3\x0a\xb0\xa4\xd9\x9b\x36\xc0\
+\xfe\x19\x49\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\x66\
+\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\x06\x58\
+\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\x66\x80\xa5\xc4\
+\x0c\xb0\x94\x98\x01\x96\x12\x1b\xe6\xcc\x18\x0f\xbd\xbc\x3d\x37\
+\xc4\x36\xd4\x58\x08\xec\x07\x1c\xd8\xa8\xfe\x16\xe0\x1f\xc0\x7a\
+\x60\x6b\xa3\x7d\x44\xdb\x13\x58\x0e\xec\xda\xa8\xfe\x13\xc0\x3a\
+\x60\x43\xa3\xfa\xd1\xe6\x03\xcb\x88\x9f\xf0\x21\x44\xd4\x94\x3a\
+\x0f\x92\x7b\x0a\x99\x63\x81\xfb\x88\x9b\x2e\x65\x0a\xb8\x04\xd8\
+\xab\xcb\x83\x08\xb4\x00\xf8\x0a\xe5\x4d\x27\xaa\x3f\x9e\x01\x4e\
+\xa5\x6e\xc2\x89\x51\xb2\x02\xb8\x99\x0e\xa6\xd4\xa9\x11\x11\xe0\
+\x4d\x94\x77\xec\xec\x0e\xa4\x9c\x64\x11\xbf\x9c\x9f\x93\xf7\x44\
+\xdd\xd6\xf9\xc4\xf4\xc7\x24\xf0\xde\x8e\xdb\xde\xc2\xee\x94\xa9\
+\xa3\xc6\x2a\xc0\x17\x47\x34\x64\x44\x5c\x40\xcc\x2f\x67\x45\xd7\
+\x0d\x6f\x64\x01\x31\x6f\x6a\xd7\x76\xdd\xf0\x86\xce\xa4\x71\x80\
+\xbb\x1e\xc4\xfa\x53\xc7\xfb\x6b\xe9\xa6\x80\x1a\xeb\x81\x7f\x06\
+\xd4\x19\x05\x2f\x50\xa6\xda\x1d\x94\xe7\x48\x85\xae\x03\xbc\xa9\
+\xe3\xfd\xb5\x14\x31\xb0\x32\x4e\xfd\x01\xf0\x6c\x40\x8d\x71\xea\
+\x93\xe6\x83\x6f\xfe\x19\x49\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\
+\x03\x2c\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\
+\x52\x62\x06\x58\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\
+\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\x06\
+\x58\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\x66\x80\xa5\
+\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\x06\x78\xb8\xc6\
+\x61\x4d\xa4\x6d\x8d\xdb\xf1\x0c\xaa\x79\x7f\x74\x1d\xe0\x25\x1d\
+\xef\xaf\xa5\xbd\x03\x6a\x2c\x66\xbc\x4e\xfa\x88\x3e\x19\xa7\x73\
+\xa4\xf9\x8a\x93\x5d\x07\xf8\x84\x8e\xf7\xd7\x52\xc4\xb1\x2c\x02\
+\x56\x06\xd4\x19\x05\x8b\x81\x23\x03\xea\x78\x8e\x34\x12\xb1\x3a\
+\xe1\x16\xc6\x63\xe9\xc8\x77\x50\x16\xf3\x8a\x58\x79\xee\x26\xca\
+\xe2\xe1\x99\x4d\x00\x6b\x88\xe9\x8f\x29\xe0\x8c\x4e\x5b\xdf\xc6\
+\xc1\x94\x05\xca\x9b\xae\x4e\x58\x23\x6a\x81\xef\xe7\x81\xf3\x80\
+\xa5\x11\x8d\xea\xd8\xde\xc0\x39\xc0\x46\xe2\x4e\xd6\x29\xe0\x2f\
+\x94\x37\xb6\xb9\xdd\x1d\x4a\x88\x09\xe0\x08\xe0\x2a\x62\xfb\x63\
+\x2b\xf0\x4d\xe0\x80\xee\x0e\x25\xcc\x22\xe0\x74\xe0\x31\xe2\xfa\
+\x63\xda\x00\xd7\x7c\xff\xba\x03\x38\xbc\xea\x50\x24\x45\x58\x00\
+\x6c\xde\xde\x03\x8e\x42\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\x66\
+\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\x06\x58\
+\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\x25\x66\x80\xa5\xc4\
+\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\x06\x58\x4a\x6c\xe7\
+\x21\xed\xf7\x77\xc0\x65\xc0\x9d\xc0\x86\x21\xb5\xa1\xd6\xae\x94\
+\x09\x0d\x4e\x03\x56\x05\xd7\x7e\x16\xf8\x0e\x70\x3d\xf0\x00\x65\
+\x46\x8a\x0c\x5e\x07\x1c\x03\x9c\x0b\xec\x17\x5c\xfb\x16\xe0\x7b\
+\xc0\xed\xc0\x53\xc1\xb5\x5b\x99\x0f\x2c\xa7\x9c\x1f\xab\x19\xb1\
+\x0f\xc8\xa8\x29\x75\xbe\xdc\x75\xc3\x1b\xf8\x1c\x71\xd3\xa5\x3c\
+\x0a\xac\xe8\xb6\xf9\xe1\xf6\x02\xfe\x4c\x5c\x9f\xac\x01\xe6\x74\
+\x7a\x04\xf1\x3e\x44\x99\x03\xae\xe9\x94\x3a\x35\x22\x02\x7c\x43\
+\x44\x43\x46\xc4\xd5\xc4\xfc\x72\x4e\xee\xba\xe1\x8d\x1c\x46\xb9\
+\x72\x18\xb4\x3f\xd6\x91\x6f\x6e\xb0\xe9\x5c\x48\xe3\x00\x77\xfd\
+\x11\x7f\x65\xc7\xfb\x6b\x29\xe2\x58\x5e\x00\x7e\x13\x50\x67\x14\
+\xdc\x03\xfc\x35\xa0\xce\x55\x94\x4f\xae\x71\xd0\xfc\x7c\xef\x3a\
+\xc0\x8f\x75\xbc\xbf\x96\x1e\x09\xa8\xf1\x24\xf0\x62\x40\x9d\x51\
+\x11\xd1\x27\x9e\x23\x15\xba\x0e\xf0\x64\xc7\xfb\x6b\x29\x62\xa0\
+\x69\x9c\xfa\x03\xec\x93\xd7\x6a\x3e\x18\x39\x52\xa3\x64\x92\xea\
+\x18\x60\x29\x31\x03\x2c\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\
+\x96\x12\x33\xc0\x52\x62\x06\x58\x4a\xcc\x00\x4b\x89\x19\x60\x29\
+\x31\x03\x2c\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\
+\xc0\x52\x62\x06\x58\x4a\xcc\x00\x4b\x89\x19\x60\x29\x31\x03\x2c\
+\x25\x66\x80\xa5\xc4\x0c\xb0\x94\x98\x01\x96\x12\x33\xc0\x52\x62\
+\x06\x58\x4a\xac\x26\xc0\x11\x93\x54\xcf\x0b\xa8\x31\x2a\x16\x04\
+\xd4\x18\xa7\xfe\x00\xfb\xe4\xb5\x22\xfa\x03\xe0\xa5\xe9\x1e\xa8\
+\x09\xf0\xa6\x80\x86\xbc\x31\xa0\xc6\xa8\x88\x38\x96\xa5\x94\x95\
+\xfd\xc6\xc5\x9b\x02\x6a\x64\x5f\xa9\x71\x5b\x11\xfd\xf1\x3c\x41\
+\x2b\x3c\xfc\x96\xc1\x57\x59\x7b\x10\xd8\x2d\xa2\x31\x43\xb6\x10\
+\xb8\x97\x98\x95\xe7\xbe\xda\x71\xdb\x5b\x39\x99\x98\xfe\xd8\x04\
+\x1c\xd0\x71\xdb\x5b\x98\x00\x7e\xcf\xe0\xfd\x11\xb6\xbe\xd2\x45\
+\x01\x8d\x99\x02\xae\x01\x96\x44\x35\x6a\x08\x76\x07\x7e\x49\x4c\
+\x5f\x4c\x51\x56\xe2\xfb\x64\xa7\x47\x10\xef\x78\x60\x3d\x71\x7d\
+\x72\x1b\xb9\x43\x3c\x0f\xf8\x36\x31\x7d\x71\x63\xaf\x1d\x4d\x54\
+\x34\xea\x6c\xe0\xe2\x8a\xe7\xf7\xb2\x81\xb2\x8c\x64\xf3\xd5\xdb\
+\x82\xed\x4b\x59\x7d\x7d\x71\x83\xda\x77\x02\xd7\x92\x6b\xb5\xc2\
+\x09\xe0\x58\xe0\xb8\x06\xb5\x5f\xa4\x2c\xbd\x7a\x6f\x83\xda\x2d\
+\x2d\xa6\x9c\x23\xfb\x06\xd5\xfb\x3e\x70\xd6\x74\x0f\xd6\x04\xf8\
+\xcd\xc0\xdf\x07\x6e\x8e\xa4\x1a\xa7\x03\x97\x4f\xf7\x60\x4d\x80\
+\x77\xa2\xac\xdd\xba\x74\xd0\x16\x49\x9a\x95\x49\x60\x7f\xe0\xd1\
+\xe9\x9e\x50\x33\x0a\x3d\x09\xac\x1d\xb4\x45\x92\x66\xed\x06\x7a\
+\x84\x17\xea\x6f\xe4\xb8\xb4\xef\xa6\x48\xaa\x35\x63\xde\x6a\x2e\
+\xa1\x5f\x71\x35\xf0\xfe\x3e\x5e\x27\x69\xf6\xee\x07\xde\x40\x8f\
+\x9b\x38\xa0\xbf\x5b\x29\xbf\x46\x19\xde\x96\xd4\xce\x37\x98\x21\
+\xbc\x00\x73\xfa\x28\xfc\x30\x65\x88\x7c\x65\x1f\xaf\x95\x34\xb3\
+\x1b\x81\xcf\xce\xe6\x89\xfd\x5c\x42\x43\xb9\x11\xe3\x56\xe0\xe0\
+\x3e\x5f\x2f\x69\xfb\x36\x02\xc7\x00\x77\xcd\xe6\xc9\xfd\xfe\x37\
+\xd2\xd3\xc0\x29\x94\xfb\x34\x25\xc5\x98\x02\xce\x64\x96\xe1\x85\
+\xc1\xfe\x9d\xf0\x56\xe0\x03\xc0\xe6\x01\x6a\x48\xfa\x9f\x73\x80\
+\x2b\x6a\x5e\xd0\xcf\x77\xe0\x6d\xad\xa3\xdc\xea\xb6\x2a\xa0\x96\
+\xb4\x23\xfb\x3a\x70\xc1\xb0\x76\x7e\x12\xe5\x72\x3a\xea\x66\x76\
+\x37\xb7\x1d\x65\x9b\x04\xbe\x44\x9f\xfa\x1d\xc4\xda\x9e\xe5\xc0\
+\xcf\x80\xb7\x06\xd6\x94\xc6\xd9\x63\x94\x7b\x9d\xaf\xef\xb7\x40\
+\xe4\x65\xef\x7a\xe0\x32\x60\x2e\x70\x74\x70\x6d\x69\xdc\x5c\x01\
+\x7c\x84\x11\xfd\x07\xa1\xc3\x80\x35\x94\x01\xae\x61\x5f\xa2\xb8\
+\xb9\x8d\xca\x36\x09\xfc\x1a\x78\x27\x41\x22\x2f\xa1\xb7\x67\x19\
+\xf0\x09\xe0\x34\xe0\x08\xfc\x54\xd6\x8e\xe9\x6e\xe0\x17\xc0\x8f\
+\x81\x7b\x22\x0b\xb7\x0e\xf0\xb6\x16\x01\x6f\xa7\xdc\xfc\x71\x10\
+\xb0\x07\x65\x6a\x1a\x69\x9c\x6c\x01\x9e\xa1\xdc\xb1\xb8\x8e\x32\
+\xbb\xc8\x13\x43\x6d\x91\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\
+\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\x92\x24\x49\
+\x92\x24\x49\x92\xc6\xcc\x7f\x01\xd7\xa6\x01\x38\x1f\x0e\x1c\xa8\
+\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0a\xfe\
\x3c\
\x3f\x78\x6d\x6c\x20\x76\x65\x72\x73\x69\x6f\x6e\x3d\x22\x31\x2e\
@@ -11678,6 +11849,10 @@
\x00\x63\
\x00\x6f\x00\x6c\x00\x75\x00\x6d\x00\x6e\x00\x2e\x00\x73\x00\x76\x00\x67\
\x00\x09\
+\x09\x28\xa3\xa7\
+\x00\x74\
+\x00\x61\x00\x62\x00\x6c\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\
+\x00\x09\
\x0a\xbf\xb2\x67\
\x00\x6d\
\x00\x6f\x00\x64\x00\x65\x00\x6c\x00\x2e\x00\x73\x00\x76\x00\x67\
@@ -11721,18 +11896,19 @@
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
-\x00\x00\x00\x2a\x00\x02\x00\x00\x00\x0b\x00\x00\x00\x04\
-\x00\x00\x00\x98\x00\x00\x00\x00\x00\x01\x00\x00\x68\x59\
-\x00\x00\x00\xc4\x00\x00\x00\x00\x00\x01\x00\x01\x90\x25\
-\x00\x00\x00\xda\x00\x00\x00\x00\x00\x01\x00\x01\x9c\x58\
-\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x5a\xcb\
+\x00\x00\x00\x2a\x00\x02\x00\x00\x00\x0c\x00\x00\x00\x04\
+\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x01\x00\x00\x72\xea\
+\x00\x00\x00\xdc\x00\x00\x00\x00\x00\x01\x00\x01\x9a\xb6\
\x00\x00\x00\x6a\x00\x00\x00\x00\x00\x01\x00\x00\x4f\xc9\
+\x00\x00\x00\xf2\x00\x00\x00\x00\x00\x01\x00\x01\xa6\xe9\
+\x00\x00\x00\x9a\x00\x00\x00\x00\x00\x01\x00\x00\x65\x5c\
+\x00\x00\x00\x82\x00\x00\x00\x00\x00\x01\x00\x00\x5a\x5a\
\x00\x00\x00\x36\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
-\x00\x00\x00\xfc\x00\x01\x00\x00\x00\x01\x00\x01\xef\xc0\
-\x00\x00\x01\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x78\x60\
-\x00\x00\x01\x58\x00\x00\x00\x00\x00\x01\x00\x02\x84\x1c\
+\x00\x00\x01\x14\x00\x01\x00\x00\x00\x01\x00\x01\xfa\x51\
+\x00\x00\x01\x56\x00\x01\x00\x00\x00\x01\x00\x02\x82\xf1\
+\x00\x00\x01\x70\x00\x00\x00\x00\x00\x01\x00\x02\x8e\xad\
\x00\x00\x00\x50\x00\x01\x00\x00\x00\x01\x00\x00\x44\x52\
-\x00\x00\x01\x16\x00\x00\x00\x00\x00\x01\x00\x01\xf7\xd4\
+\x00\x00\x01\x2e\x00\x00\x00\x00\x00\x01\x00\x02\x02\x65\
"
def qInitResources():
diff --git a/resources.qrc b/resources.qrc
index 19ae1cf..5a91162 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -11,5 +11,6 @@
img/historicalmap.png
img/help.png
img/historical_logo.jpg
+ img/table.png
diff --git a/scripts/accuracy_index.py b/scripts/accuracy_index.py
index c225e3c..bbbc99a 100644
--- a/scripts/accuracy_index.py
+++ b/scripts/accuracy_index.py
@@ -32,36 +32,4 @@ def compute_confusion_matrix(self,yp,yr):
nc = sp.sum(self.confusion_matrix,axis=0)
self.Kappa = ((n**2)*self.OA - sp.sum(nc*nl))/(n**2-sp.sum(nc*nl))
- # TBD Variance du Kappa
-if __name__=='__main__':
- import function_dataraster as dataraster
- # Convert vector to raster
- from osgeo import ogr, gdal
- import tempfile
- import os
- temp_folder = tempfile.mkdtemp()
- filename = os.path.join(temp_folder, 'temp.tif')
- inRaster = '/home/lennepkade/Bureau/datapag/02-Results/02-Data/spot/pansharp-Spot7.tif'
- data = gdal.Open(inRaster,gdal.GA_ReadOnly)
- inVector = '/home/lennepkade/Bureau/datapag/02-Results/02-Data/spot/pansharp-Spot7.shp'
-
- shp = ogr.Open(inVector)
-
- lyr = shp.GetLayer()
- driver = gdal.GetDriverByName('GTiff')
- dst_ds = driver.Create(filename,data.RasterXSize,data.RasterYSize, 1,gdal.GDT_Byte)
- dst_ds.SetGeoTransform(data.GetGeoTransform())
- dst_ds.SetProjection(data.GetProjection())
- OPTIONS = 'ATTRIBUTE='+'class'
- gdal.RasterizeLayer(dst_ds, [1], lyr, None,options=[OPTIONS])
- data,dst_ds,shp,lyr=None,None,None,None
-
- X,Y = dataraster.get_samples_from_roi(inRaster,filename)
-
- yp=sp.random.randint(5,10,500).reshape(100,5)
- yt=sp.random.randint(5,10,500).reshape(100,5)
- CONF=CONFUSION_MATRIX()
- CONF.compute_confusion_matrix(yp,yt)
- print CONF.confusion_matrix
- print CONF.OA
- print CONF.Kappa
\ No newline at end of file
+ # TBD Variance du Kappa
\ No newline at end of file
diff --git a/scripts/function_dataraster.py b/scripts/function_dataraster.py
index 915debf..826b0cd 100644
--- a/scripts/function_dataraster.py
+++ b/scripts/function_dataraster.py
@@ -412,3 +412,13 @@ def smooth_image(raster_name,mask_name,output_name,l,t):
mask = None
dst_ds = None
+if __name__=="__main__":
+ Raster="/home/lennepkade/test/testSpot7.tif"
+ ROI="/tmp/tmp4i1jQ_/temp.tif"
+ X,Y=get_samples_from_roi(Raster,ROI)
+
+ import accuracy_index as ai
+ print(X.shape)
+ print(Y.shape)
+ worker=ai.CONFUSION_MATRIX()
+ worker.compute_confusion_matrix(X,Y)
\ No newline at end of file
diff --git a/scripts/mainfunction.py b/scripts/mainfunction.py
index 75f809f..2baa548 100644
--- a/scripts/mainfunction.py
+++ b/scripts/mainfunction.py
@@ -473,37 +473,41 @@ def reset(self):
self.iface.messageBar().clearWidgets()
self.iface.mapCanvas().refresh()
QApplication.restoreOverrideCursor()
-
-#if __name__=='__main__':
-
+class confusionMatrix():
- # Image to work on
-#
-# inImage='img/samples/map.tif'
-#
-# inFile,inExtension = os.path.splitext(inImage) # Split filename and extension
-# outFilter=inFile+'_filtered'+inExtension
-#
-# # Filtering....
-# filtered=historicalFilter(inImage,outFilter,inShapeGrey=11,inShapeMedian=11, iterMedian=1)
-# print 'Image saved as : '+outFilter
-#
-## #Learn Model...
-## inVector='img/samples/train.shp'
-## inClassifier='GMM'
-# outModel='/home/sigma/test/modelGMM'
-## inSeed=0
-##
-## model=learnModel('img/samples/map_filtered.tif','img/samples/train.shp',inField='Class',inSplit=0.5,inSeed=0,outModel='img/samples/model',outMatrix='img/samples/matrix.csv',inClassifier=inClassifier)
-## print 'Model saved as : '+outModel
-## print 'Confusion matrix saved as : '+str(inFile)+'_'+str(inClassifier)+'_'+str(inSeed)+'_confu.csv'
-
- #Classify image...
-
-# outShpFile='img/samples/SHP/vectorized.shp'
-# classifyImage('/home/sigma/test/map_fltr.tif','/home/sigma/test/modelGMM','/home/sigma/test/vec.shp',None,5000,-10000,1)
- #classified=classifyImage(outFilter,outModel,outShpFile,None,6000,-10000,1)
-
-# inFilteredStep3,inTrainingStep3,outRasterClass,None,inMinSize,None,'Class',inNODATA=-10000
-# inRaster,inModel,outRaster,inMask=None,inMinSize=6,outShpFolder='img/samples/outSHP/',inField='Class',inNODATA=-10000
\ No newline at end of file
+ def __init__(self):
+ self.confusion_matrix= None
+ self.OA= None
+ self.Kappa = None
+
+
+ def computeStatistics(self,inRaster,inShape,inField):
+ progress = progressBar('Computing statistics...',0)
+ rasterized = self.rasterize(inRaster,inShape,inField)
+ Yp,Yt = dataraster.get_samples_from_roi(inRaster,rasterized)
+ CONF = ai.CONFUSION_MATRIX()
+ CONF.compute_confusion_matrix(Yp,Yt)
+ self.confusion_matrix = CONF.confusion_matrix
+ self.Kappa = CONF.Kappa
+ self.OA = CONF.OA
+ progress.reset()
+
+
+ def rasterize(self,inRaster,inShape,inField):
+ filename = tempfile.mktemp('.tif')
+ data = gdal.Open(inRaster,gdal.GA_ReadOnly)
+ shp = ogr.Open(inShape)
+
+ lyr = shp.GetLayer()
+
+ driver = gdal.GetDriverByName('GTiff')
+ dst_ds = driver.Create(filename,data.RasterXSize,data.RasterYSize, 1,gdal.GDT_Byte)
+ dst_ds.SetGeoTransform(data.GetGeoTransform())
+ dst_ds.SetProjection(data.GetProjection())
+ OPTIONS = 'ATTRIBUTE='+inField
+ gdal.RasterizeLayer(dst_ds, [1], lyr, None,options=[OPTIONS])
+ data,dst_ds,shp,lyr=None,None,None,None
+
+
+ return filename
\ No newline at end of file
diff --git a/ui/__init__.py b/ui/__init__.py
index ee2707e..90e98b6 100644
--- a/ui/__init__.py
+++ b/ui/__init__.py
@@ -3,6 +3,7 @@
from filters_dock import Ui_filterMenu
from historicalfilter_dock import Ui_historicalMenu
from help_dock import Ui_helpDock
+from confusion_dock import Ui_confusionDock
class filters_dock(QDialog, Ui_filterMenu):
def __init__(self, parent=None):
@@ -11,8 +12,6 @@ def __init__(self, parent=None):
self.setWindowFlags(Qt.Window)
self.setupUi(self)
-
-
class historical_dock(QDialog, Ui_historicalMenu):
def __init__(self, parent=None):
super(historical_dock, self).__init__(parent)
@@ -27,3 +26,12 @@ def __init__(self, parent=None):
QDockWidget.__init__(self)
self.setWindowFlags(Qt.Window)
self.setupUi(self)
+
+class confusion_dock(QDialog, Ui_confusionDock):
+ def __init__(self, parent=None):
+ super(confusion_dock, self).__init__(parent)
+ QDockWidget.__init__(self)
+ self.setWindowFlags(Qt.Window)
+ self.setupUi(self)
+
+#confusion_dock.kappa.setText('Hello!')
\ No newline at end of file
diff --git a/ui/confusion_dock.py b/ui/confusion_dock.py
new file mode 100644
index 0000000..55f61d8
--- /dev/null
+++ b/ui/confusion_dock.py
@@ -0,0 +1,117 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'confusion_dock.ui'
+#
+# Created: Sun Jun 12 16:28:12 2016
+# by: PyQt4 UI code generator 4.10.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+try:
+ _fromUtf8 = QtCore.QString.fromUtf8
+except AttributeError:
+ def _fromUtf8(s):
+ return s
+
+try:
+ _encoding = QtGui.QApplication.UnicodeUTF8
+ def _translate(context, text, disambig):
+ return QtGui.QApplication.translate(context, text, disambig, _encoding)
+except AttributeError:
+ def _translate(context, text, disambig):
+ return QtGui.QApplication.translate(context, text, disambig)
+
+class Ui_confusionDock(object):
+ def setupUi(self, confusionDock):
+ confusionDock.setObjectName(_fromUtf8("confusionDock"))
+ confusionDock.resize(488, 394)
+ self.gridLayout = QtGui.QGridLayout(confusionDock)
+ self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
+ self.label_3 = QtGui.QLabel(confusionDock)
+ self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
+ self.label_3.setObjectName(_fromUtf8("label_3"))
+ self.gridLayout.addWidget(self.label_3, 0, 0, 1, 2)
+ self.inRaster = gui.QgsMapLayerComboBox(confusionDock)
+ self.inRaster.setMinimumSize(QtCore.QSize(200, 0))
+ self.inRaster.setMaximumSize(QtCore.QSize(16777215, 30))
+ self.inRaster.setFilters(gui.QgsMapLayerProxyModel.PluginLayer|gui.QgsMapLayerProxyModel.RasterLayer)
+ self.inRaster.setObjectName(_fromUtf8("inRaster"))
+ self.gridLayout.addWidget(self.inRaster, 0, 2, 1, 3)
+ self.inShape = gui.QgsMapLayerComboBox(confusionDock)
+ self.inShape.setMinimumSize(QtCore.QSize(100, 0))
+ self.inShape.setMaximumSize(QtCore.QSize(16777215, 30))
+ self.inShape.setFilters(gui.QgsMapLayerProxyModel.PluginLayer|gui.QgsMapLayerProxyModel.PolygonLayer)
+ self.inShape.setObjectName(_fromUtf8("inShape"))
+ self.gridLayout.addWidget(self.inShape, 1, 2, 1, 3)
+ self.label_5 = QtGui.QLabel(confusionDock)
+ self.label_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
+ self.label_5.setObjectName(_fromUtf8("label_5"))
+ self.gridLayout.addWidget(self.label_5, 2, 0, 1, 2)
+ self.inField = QtGui.QComboBox(confusionDock)
+ self.inField.setMinimumSize(QtCore.QSize(100, 0))
+ self.inField.setMaximumSize(QtCore.QSize(16777215, 30))
+ self.inField.setObjectName(_fromUtf8("inField"))
+ self.gridLayout.addWidget(self.inField, 2, 2, 1, 3)
+ spacerItem = QtGui.QSpacerItem(258, 20, QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Minimum)
+ self.gridLayout.addItem(spacerItem, 3, 0, 1, 4)
+ self.compare = QtGui.QPushButton(confusionDock)
+ self.compare.setMinimumSize(QtCore.QSize(150, 0))
+ self.compare.setMaximumSize(QtCore.QSize(999, 200))
+ self.compare.setObjectName(_fromUtf8("compare"))
+ self.gridLayout.addWidget(self.compare, 3, 4, 1, 1)
+ self.label = QtGui.QLabel(confusionDock)
+ self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
+ self.label.setObjectName(_fromUtf8("label"))
+ self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
+ self.kappa = QtGui.QLabel(confusionDock)
+ font = QtGui.QFont()
+ font.setPointSize(12)
+ font.setBold(True)
+ font.setWeight(75)
+ self.kappa.setFont(font)
+ self.kappa.setText(_fromUtf8(""))
+ self.kappa.setObjectName(_fromUtf8("kappa"))
+ self.gridLayout.addWidget(self.kappa, 4, 1, 1, 1)
+ self.label_2 = QtGui.QLabel(confusionDock)
+ self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
+ self.label_2.setObjectName(_fromUtf8("label_2"))
+ self.gridLayout.addWidget(self.label_2, 4, 2, 1, 1)
+ self.OA = QtGui.QLabel(confusionDock)
+ font = QtGui.QFont()
+ font.setPointSize(12)
+ font.setBold(True)
+ font.setWeight(75)
+ self.OA.setFont(font)
+ self.OA.setText(_fromUtf8(""))
+ self.OA.setObjectName(_fromUtf8("OA"))
+ self.gridLayout.addWidget(self.OA, 4, 3, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(200, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridLayout.addItem(spacerItem1, 4, 4, 1, 1)
+ self.confusionTable = QtGui.QTableView(confusionDock)
+ font = QtGui.QFont()
+ font.setPointSize(9)
+ self.confusionTable.setFont(font)
+ self.confusionTable.setAlternatingRowColors(True)
+ self.confusionTable.setSortingEnabled(False)
+ self.confusionTable.setObjectName(_fromUtf8("confusionTable"))
+ self.gridLayout.addWidget(self.confusionTable, 5, 0, 1, 5)
+ self.label_4 = QtGui.QLabel(confusionDock)
+ self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
+ self.label_4.setObjectName(_fromUtf8("label_4"))
+ self.gridLayout.addWidget(self.label_4, 1, 0, 1, 2)
+
+ self.retranslateUi(confusionDock)
+ QtCore.QMetaObject.connectSlotsByName(confusionDock)
+
+ def retranslateUi(self, confusionDock):
+ confusionDock.setWindowTitle(_translate("confusionDock", "Confusion Matrix (Kappa/OA)", None))
+ self.label_3.setText(_translate("confusionDock", "Prediction :", None))
+ self.label_5.setText(_translate("confusionDock", "ROI column :", None))
+ self.compare.setText(_translate("confusionDock", "Compare", None))
+ self.label.setText(_translate("confusionDock", "Kappa :", None))
+ self.label_2.setText(_translate("confusionDock", "Overall Accuracy :", None))
+ self.label_4.setText(_translate("confusionDock", "ROI :", None))
+
+from qgis import gui
diff --git a/ui/confusion_dock.ui b/ui/confusion_dock.ui
new file mode 100644
index 0000000..ed7e13b
--- /dev/null
+++ b/ui/confusion_dock.ui
@@ -0,0 +1,223 @@
+
+
+ confusionDock
+
+
+
+ 0
+ 0
+ 488
+ 394
+
+
+
+ Confusion Matrix (Kappa/OA)
+
+
+ -
+
+
+ Prediction :
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 200
+ 0
+
+
+
+
+ 16777215
+ 30
+
+
+
+ QgsMapLayerProxyModel::PluginLayer|QgsMapLayerProxyModel::RasterLayer
+
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+
+ 16777215
+ 30
+
+
+
+ QgsMapLayerProxyModel::PluginLayer|QgsMapLayerProxyModel::PolygonLayer
+
+
+
+ -
+
+
+ ROI column :
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+
+ 16777215
+ 30
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::MinimumExpanding
+
+
+
+ 258
+ 20
+
+
+
+
+ -
+
+
+
+ 150
+ 0
+
+
+
+
+ 999
+ 200
+
+
+
+ Compare
+
+
+
+ -
+
+
+ Kappa :
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 12
+ 75
+ true
+
+
+
+
+
+
+
+ -
+
+
+ Overall Accuracy :
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 12
+ 75
+ true
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 200
+ 20
+
+
+
+
+ -
+
+
+
+ 9
+
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ ROI :
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
+ QgsMapLayerComboBox
+ QComboBox
+
+
+
+
+
+
diff --git a/ui/dzetsaka_dock.py b/ui/dzetsaka_dock.py
index 1801e50..5d308a1 100644
--- a/ui/dzetsaka_dock.py
+++ b/ui/dzetsaka_dock.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'dzetsaka_dock.ui'
#
-# Created: Sun Jun 12 09:26:04 2016
+# Created: Sun Jun 12 19:22:23 2016
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
@@ -160,7 +160,7 @@ def setupUi(self, DockWidget):
self.label_11 = QtGui.QLabel(self.mGroupBox)
self.label_11.setMaximumSize(QtCore.QSize(25, 25))
self.label_11.setText(_fromUtf8(""))
- self.label_11.setPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/dzetsaka/img/model.svg")))
+ self.label_11.setPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/dzetsaka/img/table.png")))
self.label_11.setScaledContents(True)
self.label_11.setObjectName(_fromUtf8("label_11"))
self.gridLayout_3.addWidget(self.label_11, 2, 0, 1, 1)
diff --git a/ui/dzetsaka_dock.ui b/ui/dzetsaka_dock.ui
index b1b0bb8..7b37da3 100644
--- a/ui/dzetsaka_dock.ui
+++ b/ui/dzetsaka_dock.ui
@@ -433,7 +433,7 @@
- :/plugins/dzetsaka/img/model.svg
+ :/plugins/dzetsaka/img/table.png
true