Commit 63f87eae authored by Raman's avatar Raman
Browse files

Bugfix in WITec Interface

Bugfix in Segmentation
parent acfdc767
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -48,15 +48,19 @@ class WITecCOM(RamanBase):
        
        IBUCSCore = win32com.client.CastTo(self.IBUCSAccess, 'IBUCSCore')
        self.VersionInterface = IBUCSCore.GetSubSystemDefaultInterface("Status|Software|Application|ProgramVersion")
        self.VersionMan = win32com.client.CastTo(self.ImageNameInterface, 'IBUCSString')
        version = self.VersionMan.GetValue()
        print(version)
        self.VersionMan = win32com.client.CastTo(self.VersionInterface, 'IBUCSStatusContainer')
        self.VersionMan.Update()
        version = self.VersionMan.GetSingleValueAsString()[1]
        try:
            vnr = version.split(",")[1].split(" Release")[0].strip()
        except:
            vnr = ""                
        try:
            vnr = float(vnr)
        except ValueError:
            print("WITec: unknown version format:", version)
            vnr = 0.0 # version format unknown        
        self.version = vnr
        
        self.PosXInterface = IBUCSCore.GetSubSystemDefaultInterface("UserParameters|SamplePositioning|AbsolutePositionX")
        self.PosYInterface = IBUCSCore.GetSubSystemDefaultInterface("UserParameters|SamplePositioning|AbsolutePositionY")
@@ -89,16 +93,16 @@ class WITecCOM(RamanBase):
            self.ImageRotationInterface = IBUCSCore.GetSubSystemDefaultInterface("MultiComm|MicroscopeControl|Video|Calibration|RotationDegrees")
            self.ImageRotationMan = win32com.client.CastTo(self.ImageRotationInterface, 'IBUCSFloat')
        else:
            self.ImageNameInterface = IBUCSCore.GetSubSystemDefaultInterface("Video|VideoImageFileName")
            self.ImageNameInterface = IBUCSCore.GetSubSystemDefaultInterface("MultiComm|MicroscopeControl|Video|VideoImageFileName")
            self.ImageNameMan = win32com.client.CastTo(self.ImageNameInterface, 'IBUCSString')
            self.ImageSaveInterface = IBUCSCore.GetSubSystemDefaultInterface("Video|AquireVideoImageToFile")
            self.ImageSaveInterface = IBUCSCore.GetSubSystemDefaultInterface("MultiComm|MicroscopeControl|Video|AcquireVideoImageToFile")
            self.ImageSaveMan = win32com.client.CastTo(self.ImageSaveInterface, 'IBUCSTrigger')
            
            self.ImageHeightInterface = IBUCSCore.GetSubSystemDefaultInterface("Video|Calibration|ImageHeightMicrons")
            self.ImageHeightInterface = IBUCSCore.GetSubSystemDefaultInterface("MultiComm|MicroscopeControl|Video|Calibration|ImageHeightMicrons")
            self.ImageHeightMan = win32com.client.CastTo(self.ImageHeightInterface, 'IBUCSFloat')
            self.ImageWidthInterface = IBUCSCore.GetSubSystemDefaultInterface("Video|Calibration|ImageWidthMicrons")
            self.ImageWidthInterface = IBUCSCore.GetSubSystemDefaultInterface("MultiComm|MicroscopeControl|Video|Calibration|ImageWidthMicrons")
            self.ImageWidthMan = win32com.client.CastTo(self.ImageWidthInterface, 'IBUCSFloat')
            self.ImageRotationInterface = IBUCSCore.GetSubSystemDefaultInterface("Video|Calibration|RotationDegrees")
            self.ImageRotationInterface = IBUCSCore.GetSubSystemDefaultInterface("MultiComm|MicroscopeControl|Video|Calibration|RotationDegrees")
            self.ImageRotationMan = win32com.client.CastTo(self.ImageRotationInterface, 'IBUCSFloat')
        
        self.SequencerStartInterface = IBUCSCore.GetSubSystemDefaultInterface("UserParameters|SequencerSingleSpectrum|Start")
+1 −2
Original line number Diff line number Diff line
@@ -23,9 +23,8 @@ import configparser

__all__ = ["RamanControl", "defaultPath", "simulatedRaman"]


config = configparser.ConfigParser()
config.read('gepard.cfg')
config.read('D://Projekte//Gepard//gepard//gepard.cfg')             #absolute path to config file

interface = "SIMULATED_RAMAN_CONTROL"
defaultPath = os.path.split(__file__)[0]
+4 −2
Original line number Diff line number Diff line
@@ -345,11 +345,12 @@ class Segmentation(object):
        sure_bg = self.closeHoles(sure_bg)
        
        # modify sure_fg and sure_bg with seedpoints and deletepoints
        
        if len(deletepoints)>0:
            h, w = sure_fg.shape[:2]
            mask = np.zeros((h+2, w+2), np.uint8)
        for p in np.int32(deletepoints):
            if p[0] > 0 and p[1] > 0:
            if 0 < p[0] < h and 0 < p[1] < w:         #point has to be within image, otherwise the floodFill fails
               cv2.floodFill(sure_fg, mask, tuple([p[0], p[1]]), 0)
            
        for p in np.int32(seedpoints):
@@ -358,6 +359,7 @@ class Segmentation(object):
            cv2.circle(sure_fg, tuple([p[0], p[1]]), int(p[2]), 0, -1)
            cv2.circle(sure_bg, tuple([p[0], p[1]]), int(p[2]), 0, -1)

        
        print("sure_fg, sure_bg")
        if self.cancelcomputation:
            return None, None, None