-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresult_viewer.py
More file actions
80 lines (65 loc) · 3.18 KB
/
result_viewer.py
File metadata and controls
80 lines (65 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This file is part of DeepSpinePreprocessing
# Copyright (C) 2021 VG-Lab (Visualization & Graphics Lab), Universidad Rey Juan Carlos
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import numpy as np
import matplotlib.pyplot as plt
from gmrv_utils.plots import colorDict, createColorMap
from gmrv_utils.image import load_tiff_from_folder, multiChannel2SingleChannel
from gmrv_utils.cmpPlot import CmpPlot
from seg_utils.dataLoading import loadTiffStacks
from PyQt5 import Qt
# =============================================================================
# Inicialización
# =============================================================================
path = './testDataGTnewRadius/'
dataSet = 0
clear = False
# =============================================================================
# Carga de todos los datos
# =============================================================================
files2Load = ('LABEL_' + str(dataSet), 'PRED_' + str(dataSet), 'RAW_' + str(dataSet))
data = loadTiffStacks(path, files2Load, False, False)
label = data['LABEL_' + str(dataSet)]
pred = data['PRED_' + str(dataSet)]
raw = data['RAW_' + str(dataSet)]
class SegmentationComparatorView(Qt.QWidget):
def __init__(self, parent=None, rawImg=None, labelImg=None, predImg=None):
Qt.QMainWindow.__init__(self, parent)
self.raw = rawImg
self.label = labelImg
self.pred = predImg
self.vl = Qt.QVBoxLayout(self)
self.plotData()
# =============================================================================
# Plot de restultados
# =============================================================================
def plotData(self):
# =============================================================================
# Plot de resultados
# =============================================================================
cmcmp3 = createColorMap('cmcmp3', colorDict['cmp3'])
cm3 = createColorMap('cm3', [(0.99, 0.99, 0.99), (0, 0.8, 0), (0, 0.5, 1)])
cmc = createColorMap('cmc', [(0.95, 1, 0.95, 1), (0, 1, 0, 1)], N=255)
cmap = (cm3, cm3, cmc, cmcmp3)
cp = []
cmpdata = (self.label, self.pred, self.raw, self.pred + self.label * 3)
title = ["GT", "PRED", "RAW", "CMP"]
cp.append(CmpPlot(cmpdata, 2, title=title, cmap=cmap, widget=self))
if __name__ == '__main__':
app = Qt.QApplication([])
segmentationComparatorView = SegmentationComparatorView(rawImg=raw,
labelImg=label, predImg=pred)
segmentationComparatorView.show()
app.exec_()