Last active
December 16, 2019 18:36
-
-
Save hanslovsky/54f5533cba68b1a3626aaa3c732ebae1 to your computer and use it in GitHub Desktop.
pyimagej-from-qt-thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def main(): | |
import threading | |
ij = [None] | |
def start_qt_and_ij(): | |
from PyQt5 import QtCore, QtWidgets | |
app = QtWidgets.QApplication([]) | |
app.setQuitOnLastWindowClosed(True) | |
def start_ij(): | |
import imagej | |
print(1) | |
ij[0] = imagej.init('sc.fiji:fiji+net.imagej:imagej-legacy', headless=False) | |
print(2) | |
QtCore.QTimer.singleShot(0, start_ij) | |
app.exec_() | |
threading.Thread(target=start_qt_and_ij).start() | |
while ij[0] is None: | |
time.sleep(0.5) | |
ij[0].launch() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment