Commit 10e10e12 authored by Lars Bittrich's avatar Lars Bittrich

relative import fix. Gepard can now be imported as a module.

IMPORTANT: start Gepard by: "python -m gepard" outside of the module directory
parent 8fc15b1e
...@@ -18,13 +18,13 @@ You should have received a copy of the GNU General Public License ...@@ -18,13 +18,13 @@ You should have received a copy of the GNU General Public License
along with this program, see COPYING. along with this program, see COPYING.
If not, see <https://www.gnu.org/licenses/>. If not, see <https://www.gnu.org/licenses/>.
""" """
from PyQt5 import QtCore, QtWidgets, QtGui
from sampleview import SampleView
from scalebar import ScaleBar
from ramancom.ramancontrol import defaultPath
from ramancom.ramanSwitch import RamanSwitch
from colorlegend import ColorLegend
import os import os
from PyQt5 import QtCore, QtWidgets, QtGui
from .sampleview import SampleView
from .scalebar import ScaleBar
from .ramancom.ramancontrol import defaultPath
from .ramancom.ramanSwitch import RamanSwitch
from .colorlegend import ColorLegend
class MeasureParticleWindow(QtWidgets.QMainWindow): class MeasureParticleWindow(QtWidgets.QMainWindow):
...@@ -116,7 +116,7 @@ class MeasureParticleWindow(QtWidgets.QMainWindow): ...@@ -116,7 +116,7 @@ class MeasureParticleWindow(QtWidgets.QMainWindow):
def createActions(self): def createActions(self):
fname = os.path.join(os.path.split(__file__)[0], fname = os.path.join(os.path.split(__file__)[0],
os.path.join("data","brand.png")) os.path.join('data', 'brand.png'))
self.aboutAct = QtWidgets.QAction(QtGui.QIcon(fname), self.aboutAct = QtWidgets.QAction(QtGui.QIcon(fname),
"About Particle Measurment", self) "About Particle Measurment", self)
self.aboutAct.triggered.connect(self.about) self.aboutAct.triggered.connect(self.about)
......
...@@ -21,7 +21,7 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -21,7 +21,7 @@ If not, see <https://www.gnu.org/licenses/>.
import os import os
import numpy as np import numpy as np
import operator import operator
from dataset import loadData, recursiveDictCompare from ..dataset import loadData, recursiveDictCompare
def readDataStats(fname): def readDataStats(fname):
......
...@@ -22,7 +22,7 @@ import os ...@@ -22,7 +22,7 @@ import os
import pickle import pickle
import numpy as np import numpy as np
import cv2 import cv2
from helperfunctions import cv2imread_fix, cv2imwrite_fix from .helperfunctions import cv2imread_fix, cv2imwrite_fix
from copy import copy from copy import copy
currentversion = 2 currentversion = 2
......
...@@ -20,7 +20,7 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -20,7 +20,7 @@ If not, see <https://www.gnu.org/licenses/>.
""" """
import numpy as np import numpy as np
from PyQt5 import QtCore, QtWidgets, QtGui from PyQt5 import QtCore, QtWidgets, QtGui
from segmentation import Segmentation from .segmentation import Segmentation
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from threading import Thread from threading import Thread
......
...@@ -23,10 +23,10 @@ from PyQt5 import QtCore, QtWidgets ...@@ -23,10 +23,10 @@ from PyQt5 import QtCore, QtWidgets
import numpy as np import numpy as np
from multiprocessing import Process, Queue, Event from multiprocessing import Process, Queue, Event
import queue import queue
from imagestitch import imageStacking from .imagestitch import imageStacking
import os import os
import cv2 import cv2
from helperfunctions import cv2imread_fix, cv2imwrite_fix from .helperfunctions import cv2imread_fix, cv2imwrite_fix
from time import time from time import time
import datetime import datetime
import sys import sys
......
...@@ -43,19 +43,19 @@ except KeyError: ...@@ -43,19 +43,19 @@ except KeyError:
pass pass
if interface == "SIMULATED_RAMAN_CONTROL": if interface == "SIMULATED_RAMAN_CONTROL":
from ramancom.simulatedraman import SimulatedRaman from .simulatedraman import SimulatedRaman
RamanControl = SimulatedRaman RamanControl = SimulatedRaman
print("WARNING: using only simulated raman control!") print("WARNING: using only simulated raman control!")
simulatedRaman = True simulatedRaman = True
elif interface == "WITEC_CONTROL": elif interface == "WITEC_CONTROL":
from ramancom.WITecCOM import WITecCOM from .WITecCOM import WITecCOM
RamanControl = WITecCOM RamanControl = WITecCOM
RamanControl.magn = int(config["General Microscope Setup"]["magnification"]) # not yet implemented in WITecCOM, but would probably be a good idea... RamanControl.magn = int(config["General Microscope Setup"]["magnification"]) # not yet implemented in WITecCOM, but would probably be a good idea...
simulatedRaman = False simulatedRaman = False
elif interface == "RENISHAW_CONTROL": elif interface == "RENISHAW_CONTROL":
from ramancom.renishawcom import RenishawCOM from .renishawcom import RenishawCOM
RamanControl = RenishawCOM RamanControl = RenishawCOM
RamanControl.magn = int(config["General Microscope Setup"]["magnification"]) RamanControl.magn = int(config["General Microscope Setup"]["magnification"])
try: try:
......
...@@ -24,7 +24,7 @@ Simualted Raman interface module for testing without actual raman system connect ...@@ -24,7 +24,7 @@ Simualted Raman interface module for testing without actual raman system connect
from time import sleep from time import sleep
import numpy as np import numpy as np
from shutil import copyfile from shutil import copyfile
from ramancom.ramanbase import RamanBase from .ramanbase import RamanBase
class SimulatedRaman(RamanBase): class SimulatedRaman(RamanBase):
......
...@@ -24,7 +24,7 @@ import numpy as np ...@@ -24,7 +24,7 @@ import numpy as np
from multiprocessing import Process, Queue, Event from multiprocessing import Process, Queue, Event
import queue import queue
from time import time from time import time
from external import tsp from .external import tsp
import datetime import datetime
import sys import sys
import os import os
......
...@@ -21,17 +21,17 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -21,17 +21,17 @@ If not, see <https://www.gnu.org/licenses/>.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
import numpy as np import numpy as np
import os import os
from dataset import DataSet, loadData from .dataset import DataSet, loadData
from ramancom.ramancontrol import RamanControl, simulatedRaman from .ramancom.ramancontrol import RamanControl, simulatedRaman
from opticalscan import OpticalScan from .opticalscan import OpticalScan
from ramanscanui import RamanScanUI from .ramanscanui import RamanScanUI
from detectionview import ParticleDetectionView from .detectionview import ParticleDetectionView
from analysis.analysisview import ParticleAnalysis from .analysis.analysisview import ParticleAnalysis
from zeissimporter import ZeissImporter from .zeissimporter import ZeissImporter
from viewitems import FitPosIndicator, Node, Edge, ScanIndicator, RamanScanIndicator, SegmentationContours from .viewitems import FitPosIndicator, Node, Edge, ScanIndicator, RamanScanIndicator, SegmentationContours
from helperfunctions import polygoncovering, cv2imread_fix from .helperfunctions import polygoncovering, cv2imread_fix
import cv2 import cv2
from ramancom.configRaman import RamanConfigWin from .ramancom.configRaman import RamanConfigWin
class SampleView(QtWidgets.QGraphicsView): class SampleView(QtWidgets.QGraphicsView):
ScalingChanged = QtCore.pyqtSignal(float) ScalingChanged = QtCore.pyqtSignal(float)
...@@ -168,10 +168,12 @@ class SampleView(QtWidgets.QGraphicsView): ...@@ -168,10 +168,12 @@ class SampleView(QtWidgets.QGraphicsView):
if mode is None: if mode is None:
return return
assert mode in ["OpticalScan", "ParticleDetection", "RamanScan", "ParticleAnalysis"] assert mode in ["OpticalScan", "ParticleDetection", "RamanScan", "ParticleAnalysis"]
print("switching to mode:", mode, flush=True)
self.oscanwidget.setVisible(False) self.oscanwidget.setVisible(False)
if self.detectionwidget is not None: if self.detectionwidget is not None:
self.detectionwidget.close() self.detectionwidget.close()
self.detectionwidget.destroy() self.detectionwidget.destroy()
self.detectionwidget = None
self.ramanwidget.setVisible(False) self.ramanwidget.setVisible(False)
self.contouritem.resetContours([]) self.contouritem.resetContours([])
self.mode = mode self.mode = mode
...@@ -186,6 +188,7 @@ class SampleView(QtWidgets.QGraphicsView): ...@@ -186,6 +188,7 @@ class SampleView(QtWidgets.QGraphicsView):
self.detectionwidget.show() self.detectionwidget.show()
self.detectionwidget.imageUpdate.connect(self.detectionUpdate) self.detectionwidget.imageUpdate.connect(self.detectionUpdate)
self.detectionwidget.detectionFinished.connect(self.activateMaxMode) self.detectionwidget.detectionFinished.connect(self.activateMaxMode)
self.detectionwidget.setVisible(True)
elif mode == "RamanScan": elif mode == "RamanScan":
self.ramanwidget.resetDataset(self.dataset) self.ramanwidget.resetDataset(self.dataset)
...@@ -313,8 +316,8 @@ class SampleView(QtWidgets.QGraphicsView): ...@@ -313,8 +316,8 @@ class SampleView(QtWidgets.QGraphicsView):
x, y, z = self.dataset.mapToLengthRaman([p0.x(), p0.y()], x, y, z = self.dataset.mapToLengthRaman([p0.x(), p0.y()],
microscopeMode=self.microscopeMode, microscopeMode=self.microscopeMode,
noz=(False if self.mode=="RamanScan" else True)) noz=(False if self.mode=="RamanScan" else True))
if z is not None: #if z is not None:
assert z>-100. # assert z>-100.
self.ramanctrl.moveToAbsolutePosition(x, y, z) self.ramanctrl.moveToAbsolutePosition(x, y, z)
elif event.button()==QtCore.Qt.LeftButton and self.mode=="ParticleDetection": elif event.button()==QtCore.Qt.LeftButton and self.mode=="ParticleDetection":
p0 = self.mapToScene(event.pos()) p0 = self.mapToScene(event.pos())
......
...@@ -20,11 +20,11 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -20,11 +20,11 @@ If not, see <https://www.gnu.org/licenses/>.
""" """
import os import os
from PyQt5 import QtCore, QtWidgets from PyQt5 import QtCore, QtWidgets
from zeissxml import ZeissHandler, make_parser from .zeissxml import ZeissHandler, make_parser
from opticalscan import PointCoordinates from .opticalscan import PointCoordinates
from helperfunctions import cv2imread_fix, cv2imwrite_fix from .helperfunctions import cv2imread_fix, cv2imwrite_fix
from ramancom.ramancontrol import defaultPath from .ramancom.ramancontrol import defaultPath
from dataset import DataSet from .dataset import DataSet
from scipy.optimize import least_squares from scipy.optimize import least_squares
from itertools import permutations from itertools import permutations
import cv2 import cv2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment