mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-11 11:25:30 +08:00
added save_to_variable functionality.
This commit is contained in:
@@ -28,6 +28,7 @@ else:
|
||||
|
||||
app = None
|
||||
|
||||
variable_saved_image = None
|
||||
|
||||
class LabelImage(QLabel):
|
||||
def __init__(self, parent, arr):
|
||||
@@ -166,17 +167,31 @@ else:
|
||||
|
||||
self.save_file = QtGui.QPushButton('Save to File')
|
||||
self.save_file.clicked.connect(self.save_to_file)
|
||||
#self.save_variable = QtGui.QPushButton('Save to Variable')
|
||||
self.save_variable = QtGui.QPushButton('Save to Variable')
|
||||
self.save_variable.clicked.connect(self.save_to_variable)
|
||||
self.save_file.show()
|
||||
#self.save_variable.show()
|
||||
self.save_variable.show()
|
||||
|
||||
#self.layout.addWidget(self.save_variable, 1, 1)
|
||||
self.layout.addWidget(self.save_variable, 1, 1)
|
||||
self.layout.addWidget(self.save_file, 1, 2)
|
||||
|
||||
|
||||
def update_histograms(self):
|
||||
self.rgbv_hist.update_hists(self.arr)
|
||||
|
||||
def save_to_variable(self):
|
||||
global variable_saved_image
|
||||
variable_saved_image = self.arr.copy()
|
||||
msg = QLabel('The image has been saved. Call *** to retrieve.')
|
||||
dialog = QtGui.QDialog()
|
||||
ok = QtGui.QPushButton('OK', msg)
|
||||
ok.clicked.connect(dialog.accept)
|
||||
ok.setDefault(True)
|
||||
dialog.layout = QtGui.QGridLayout(dialog)
|
||||
dialog.layout.addWidget(msg, 0, 0, 1, 3)
|
||||
dialog.layout.addWidget(ok, 1, 1)
|
||||
dialog.exec_()
|
||||
|
||||
def save_to_file(self):
|
||||
from scikits.image import io
|
||||
filename = str(QtGui.QFileDialog.getSaveFileName())
|
||||
@@ -232,6 +247,10 @@ else:
|
||||
|
||||
iw.show()
|
||||
|
||||
def retrieve_saved_image():
|
||||
global variable_saved_image
|
||||
return variable_saved_image
|
||||
|
||||
def _app_show():
|
||||
global app
|
||||
if app and window_manager.has_windows():
|
||||
|
||||
Reference in New Issue
Block a user