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
along with this program, see COPYING.
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
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):
......@@ -116,7 +116,7 @@ class MeasureParticleWindow(QtWidgets.QMainWindow):
def createActions(self):
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),
"About Particle Measurment", self)
self.aboutAct.triggered.connect(self.about)
......@@ -330,4 +330,4 @@ if __name__ == '__main__':
meas.showMaximized()
ret = app.exec_()
if fp is not None:
fp.close()
\ No newline at end of file
fp.close()
......@@ -21,7 +21,7 @@ If not, see <https://www.gnu.org/licenses/>.
import os
import numpy as np
import operator
from dataset import loadData, recursiveDictCompare
from ..dataset import loadData, recursiveDictCompare
def readDataStats(fname):
......@@ -215,4 +215,4 @@ class DataStats(object):
def testRead(self):
statsread = readDataStats(self.dataset.fname)
return recursiveDictCompare(self.__dict__, statsread.__dict__)
\ No newline at end of file
......@@ -22,7 +22,7 @@ import os
import pickle
import numpy as np
import cv2
from helperfunctions import cv2imread_fix, cv2imwrite_fix
from .helperfunctions import cv2imread_fix, cv2imwrite_fix
from copy import copy
currentversion = 2
......
......@@ -20,7 +20,7 @@ If not, see <https://www.gnu.org/licenses/>.
"""
import numpy as np
from PyQt5 import QtCore, QtWidgets, QtGui
from segmentation import Segmentation
from .segmentation import Segmentation
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
import matplotlib.pyplot as plt
from threading import Thread
......@@ -690,4 +690,4 @@ if __name__ == "__main__":
view = ParticleDetectionView(img, ds, None)
view.setDataSet(ds)
view.show()
app.exec_()
\ No newline at end of file
app.exec_()
......@@ -23,10 +23,10 @@ from PyQt5 import QtCore, QtWidgets
import numpy as np
from multiprocessing import Process, Queue, Event
import queue
from imagestitch import imageStacking
from .imagestitch import imageStacking
import os
import cv2
from helperfunctions import cv2imread_fix, cv2imwrite_fix
from .helperfunctions import cv2imread_fix, cv2imwrite_fix
from time import time
import datetime
import sys
......@@ -636,4 +636,4 @@ if __name__ == "__main__":
ds = DataSet('Test')
optscan = OpticalScan(SimulatedRaman(), ds)
optscan.show()
sys.exit(app.exec_())
\ No newline at end of file
sys.exit(app.exec_())
......@@ -43,19 +43,19 @@ except KeyError:
pass
if interface == "SIMULATED_RAMAN_CONTROL":
from ramancom.simulatedraman import SimulatedRaman
from .simulatedraman import SimulatedRaman
RamanControl = SimulatedRaman
print("WARNING: using only simulated raman control!")
simulatedRaman = True
elif interface == "WITEC_CONTROL":
from ramancom.WITecCOM import WITecCOM
from .WITecCOM import WITecCOM
RamanControl = WITecCOM
RamanControl.magn = int(config["General Microscope Setup"]["magnification"]) # not yet implemented in WITecCOM, but would probably be a good idea...
simulatedRaman = False
elif interface == "RENISHAW_CONTROL":
from ramancom.renishawcom import RenishawCOM
from .renishawcom import RenishawCOM
RamanControl = RenishawCOM
RamanControl.magn = int(config["General Microscope Setup"]["magnification"])
try:
......
......@@ -24,7 +24,7 @@ Simualted Raman interface module for testing without actual raman system connect
from time import sleep
import numpy as np
from shutil import copyfile
from ramancom.ramanbase import RamanBase
from .ramanbase import RamanBase
class SimulatedRaman(RamanBase):
......@@ -117,4 +117,4 @@ class SimulatedRaman(RamanBase):
print("Scan number:", num)
sleep(.1)
if num==self.timeseries-1:
self.timeseries = False
\ No newline at end of file
self.timeseries = False
......@@ -24,7 +24,7 @@ import numpy as np
from multiprocessing import Process, Queue, Event
import queue
from time import time
from external import tsp
from .external import tsp
import datetime
import sys
import os
......@@ -289,4 +289,4 @@ class RamanScanUI(QtWidgets.QWidget):
self.close()
return
self.timer.start(100.)
\ No newline at end of file
......@@ -21,17 +21,17 @@ If not, see <https://www.gnu.org/licenses/>.
from PyQt5 import QtCore, QtGui, QtWidgets
import numpy as np
import os
from dataset import DataSet, loadData
from ramancom.ramancontrol import RamanControl, simulatedRaman
from opticalscan import OpticalScan
from ramanscanui import RamanScanUI
from detectionview import ParticleDetectionView
from analysis.analysisview import ParticleAnalysis
from zeissimporter import ZeissImporter
from viewitems import FitPosIndicator, Node, Edge, ScanIndicator, RamanScanIndicator, SegmentationContours
from helperfunctions import polygoncovering, cv2imread_fix
from .dataset import DataSet, loadData
from .ramancom.ramancontrol import RamanControl, simulatedRaman
from .opticalscan import OpticalScan
from .ramanscanui import RamanScanUI
from .detectionview import ParticleDetectionView
from .analysis.analysisview import ParticleAnalysis
from .zeissimporter import ZeissImporter
from .viewitems import FitPosIndicator, Node, Edge, ScanIndicator, RamanScanIndicator, SegmentationContours
from .helperfunctions import polygoncovering, cv2imread_fix
import cv2
from ramancom.configRaman import RamanConfigWin
from .ramancom.configRaman import RamanConfigWin
class SampleView(QtWidgets.QGraphicsView):
ScalingChanged = QtCore.pyqtSignal(float)
......@@ -168,10 +168,12 @@ class SampleView(QtWidgets.QGraphicsView):
if mode is None:
return
assert mode in ["OpticalScan", "ParticleDetection", "RamanScan", "ParticleAnalysis"]
print("switching to mode:", mode, flush=True)
self.oscanwidget.setVisible(False)
if self.detectionwidget is not None:
self.detectionwidget.close()
self.detectionwidget.destroy()
self.detectionwidget = None
self.ramanwidget.setVisible(False)
self.contouritem.resetContours([])
self.mode = mode
......@@ -186,6 +188,7 @@ class SampleView(QtWidgets.QGraphicsView):
self.detectionwidget.show()
self.detectionwidget.imageUpdate.connect(self.detectionUpdate)
self.detectionwidget.detectionFinished.connect(self.activateMaxMode)
self.detectionwidget.setVisible(True)
elif mode == "RamanScan":
self.ramanwidget.resetDataset(self.dataset)
......@@ -313,8 +316,8 @@ class SampleView(QtWidgets.QGraphicsView):
x, y, z = self.dataset.mapToLengthRaman([p0.x(), p0.y()],
microscopeMode=self.microscopeMode,
noz=(False if self.mode=="RamanScan" else True))
if z is not None:
assert z>-100.
#if z is not None:
# assert z>-100.
self.ramanctrl.moveToAbsolutePosition(x, y, z)
elif event.button()==QtCore.Qt.LeftButton and self.mode=="ParticleDetection":
p0 = self.mapToScene(event.pos())
......@@ -534,4 +537,4 @@ class SampleView(QtWidgets.QGraphicsView):
self.scene().removeItem(item)
self.ramanscanitems = []
\ No newline at end of file
......@@ -20,11 +20,11 @@ If not, see <https://www.gnu.org/licenses/>.
"""
import os
from PyQt5 import QtCore, QtWidgets
from zeissxml import ZeissHandler, make_parser
from opticalscan import PointCoordinates
from helperfunctions import cv2imread_fix, cv2imwrite_fix
from ramancom.ramancontrol import defaultPath
from dataset import DataSet
from .zeissxml import ZeissHandler, make_parser
from .opticalscan import PointCoordinates
from .helperfunctions import cv2imread_fix, cv2imwrite_fix
from .ramancom.ramancontrol import defaultPath
from .dataset import DataSet
from scipy.optimize import least_squares
from itertools import permutations
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