def __init__(self):
        super().__init__()
        self.ui = ui.MainWindow()
        self.ui.setupMainWindow()
        self.ui.show()
        self.queue = Queue()
        self.frames = []
        self.lines = None
        self.live_thread_flag = None
        self.record_thread_flag = None
        self.filepath = 'D:\\Data\\'
        self.filename = None
        self.rescale_min = 0
        self.rescale_max = 65535
        self.lock = threading.Lock()
        self.hcam = cam.HamamatsuCameraMR(camera_id=0)

        self.ui.shutterButton.clicked.connect(lambda: self.shutterUi())
        self.ui.AOTFButton.clicked.connect(lambda: self.aotfUi())
        self.ui.GalvoButton.clicked.connect(lambda: self.galvoUi())
        self.ui.StageButton.clicked.connect(lambda: self.stageUi())
        self.ui.liveButton.clicked.connect(lambda: self.live_state_change())
        self.ui.recordButton.clicked.connect(
            lambda: self.record_state_change())
        self.ui.IrecordButton.clicked.connect(
            lambda: self.Irecord_state_change())
        self.ui.autoscalebutton.clicked.connect(lambda: self.autoscale())
        self.ui.slider_up.valueChanged.connect(lambda: self.upscale())
        self.ui.slider_down.valueChanged.connect(lambda: self.downscale())

        self.live_thread = threading.Thread(target=self.display,
                                            name='liveThread')
        self.record_thread = threading.Thread(target=self.recording,
                                              name="recordThread")
    def __init__(self, acq_duration, expos_time, focal_start, focal_interval):
        threading.Thread.__init__(
            self
        )  #initialize this class on a new thread for fastest possible capture of stacks
        print " ----------- Starting Acquisition thread ------------- "
        print "--> Initializing Camera Parameters"
        self.hcam = hc.HamamatsuCameraMR(0)
        # Set camera parameters.
        cam_offset = 100
        cam_x = 2048
        cam_y = 2048
        self.hcam.setPropertyValue("defect_correct_mode", "OFF")
        self.hcam.setPropertyValue("exposure_time", expos_time)
        self.hcam.setPropertyValue("subarray_hsize", cam_x)
        self.hcam.setPropertyValue("subarray_vsize", cam_y)
        self.hcam.setPropertyValue("binning", "1x1")
        self.hcam.setPropertyValue("readout_speed", 2)

        #        self.cam.set(16, expos_time) # Exposure propID# is 16 Exposure as appropriate for the fluorescence intensity
        #        print "--> Initializing OptoTune Lens"
        #        self.lens = Opto(port='/dev/cu.usbmodem1411') # Initialize the optotune lens
        #        self.focal_interval = focal_interval
        #        self.lens.connect()
        #        self.lens.focalpower(focal_start) # Set the lens focal power to focus onto the top most z-plane
        self.stop_time = time.time() + acq_duration
Esempio n. 3
0
    def __init__(self, currFoc, first_expos):
        threading.Thread.__init__(self)
        print " ----------- Starting Preview thread ------------- "
        print "--> Initializing Camera Parameters"
        self.hcam = hc.HamamatsuCameraMR(0)
# Set camera parameters.
        cam_offset = 100
        cam_x = 2048
        cam_y = 2048
#        self.expos_time = Queue(maxsize=0)
        self.hcam.setPropertyValue("defect_correct_mode", "OFF")
        self.hcam.setPropertyValue("exposure_time", first_expos)
        self.hcam.setPropertyValue("subarray_hsize", cam_x)
        self.hcam.setPropertyValue("subarray_vsize", cam_y)
        self.hcam.setPropertyValue("binning", "1x1")
        self.hcam.setPropertyValue("readout_speed", 2)
        self.show = True
        
        self.iv = pg.imageview.ImageView()
        
        colors = [
                (0, 0, 0),
                (7, 0, 220),
                (236, 0, 134),
                (246, 246, 0),
                (255, 255, 255),
                (0, 255, 0)
                ]
#        
        cmap = pg.ColorMap(pos=np.linspace(0.0, 1.0, 6), color=colors)
        self.iv.setColorMap(cmap)
        self.iv.setLevels(0,65535)
        self.hist = self.iv.getHistogramWidget()
        self.hist.vb.enableAutoRange(self.hist.vb.YAxis, False)
        self.iv.show()
    def __init__(self, currFoc, first_expos):
        multiprocessing.Process.__init__(self)
        print " ----------- Starting Acquisition thread ------------- "
        print "--> Initializing Camera Parameters"
        self.hcam = hc.HamamatsuCameraMR(0)
# Set camera parameters.
        cam_offset = 100
        cam_x = 2048
        cam_y = 2048
        self.expos_time = multiprocessing.Queue(maxsize=0)
        self.hcam.setPropertyValue("defect_correct_mode", "OFF")
        self.hcam.setPropertyValue("exposure_time", first_expos)
        self.hcam.setPropertyValue("subarray_hsize", cam_x)
        self.hcam.setPropertyValue("subarray_vsize", cam_y)
        self.hcam.setPropertyValue("binning", "1x1")
        self.hcam.setPropertyValue("readout_speed", 2)
        self.show = True
    def __init__(self, **kwargs):
        BaseCamera.__init__(self)
        if 'exposure' not in kwargs.keys():
            raise KeyError('No exposure value specified')

        self.hcam = hc.HamamatsuCameraMR(0)
        self.camera_open = True

        cam_offset = 100
        cam_x = 2048
        cam_y = 2048
        self.hcam.setPropertyValue("defect_correct_mode", "OFF")
        self.hcam.setPropertyValue("subarray_hsize", cam_x)
        self.hcam.setPropertyValue("subarray_vsize", cam_y)
        self.hcam.setPropertyValue("binning", "2x2")
        self.hcam.setPropertyValue("readout_speed", 2)
        self.exposure = kwargs['exposure']
    def __init__(self):
        super().__init__()
        self.ui = ui.MainWindow()
        self.ui.setupMainWindow()
        self.ui.show()
        self.dm = None
        self.queue = Queue(
        )  #init queue that will contain synchronous recording actions
        self.frames = []
        self.lines = None
        self.live_thread_flag = None
        self.record_thread_flag = None
        self.filepath = 'D:\\Data\\'
        self.filename = None
        self.rescale_min = 0
        self.rescale_max = 65535
        self.lock = threading.Lock(
        )  #lock used to protect codes from multi threads
        self.hcam = cam.HamamatsuCameraMR(camera_id=0)  #camera handle
        #connect button to functions
        self.ui.shutterButton.clicked.connect(lambda: self.shutterUi())
        self.ui.AOTFButton.clicked.connect(lambda: self.aotfUi())
        self.ui.GalvoButton.clicked.connect(lambda: self.galvoUi())
        self.ui.StageButton.clicked.connect(lambda: self.stageUi())
        self.ui.DMButton.clicked.connect(lambda: self.DMUi())
        self.ui.liveButton.clicked.connect(lambda: self.live_state_change())
        self.ui.one_record_button.clicked.connect(
            lambda: self.record_one_frame_thread())
        self.ui.recordButton.clicked.connect(
            lambda: self.record_state_change())
        self.ui.IrecordButton.clicked.connect(
            lambda: self.Irecord_state_change())
        self.ui.autoscalebutton.clicked.connect(lambda: self.autoscale())
        self.ui.slider_up.valueChanged.connect(lambda: self.upscale())
        self.ui.slider_down.valueChanged.connect(lambda: self.downscale())
        self.ui.livewindow.click_on_pixel.connect(self.getIntensityInfo)
        self.ui.set_expo.clicked.connect(lambda: self.set_expo())
        self.ui.set_record_expo.clicked.connect(lambda: self.set_record_expo)
        self.stop_record_signal.connect(lambda: self.stop_record())

        self.live_thread = threading.Thread(target=self.display,
                                            name='liveThread')
        self.record_thread = threading.Thread(target=self.recording,
                                              name="recordThread")
Esempio n. 7
0
    def __init__(self):
        super().__init__()
        self.ui = ui.MainWindow()
        self.ui.setupMainWindow()
        self.ui.show()
        self.message = message.Message()
        self.frames = []
        self.lines = None
        self.live_thread_flag = None
        self.record_thread_flag = None
        self.waiting_thread_flag = None
        self.filename = None
        self.rescale_min = 0
        self.rescale_max = 65535
        self.file = None
        self.lock = threading.Lock()
        self.hcam = cam.HamamatsuCameraMR(camera_id=0)
        '''try:
            self.hcam.setPropertyValue("trigger_source",2)
        except:
            print("camera set external trigger mode failed")
        try:
            self.hcam.setPropertyValue("trigger_polarity",2)
            #print(self.hcam.getPropertyText("trigger_polarity"))
        except:
            print("camera set positive polarity failed")'''

        self.ui.shutterButton.clicked.connect(lambda: self.shutterUi())
        self.ui.AOTFButton.clicked.connect(lambda: self.aotfUi())
        self.ui.GalvoButton.clicked.connect(lambda: self.galvoUi())
        self.ui.StageButton.clicked.connect(lambda: self.stageUi())
        self.ui.set_parameter.clicked.connect(
            lambda: self.set_parameter_button_pushed())
        self.ui.exposurebutton.clicked.connect(lambda: self.set_exposure())
        self.ui.liveButton.clicked.connect(lambda: self.live_state_change())
        self.ui.recordButton.clicked.connect(
            lambda: self.record_state_change())
        self.ui.autoscalebutton.clicked.connect(lambda: self.autoscale())

        self.live_thread = threading.Thread(target=self.living,
                                            name='liveThread')
        self.record_thread = threading.Thread(target=self.recording,
                                              name="recordThread")
Esempio n. 8
0
the sum of x*x for every pixel in every frame.

Hazen 10/13
"""

import numpy
import sys
import time

import hamamatsu_camera as hc

if (len(sys.argv) != 3):
    print("usage: <filename> <number frames>")
    exit()

hcam = hc.HamamatsuCameraMR(camera_id=0)

# Set camera parameters.
cam_offset = 0
hcam.setPropertyValue("defect_correct_mode", "OFF")
hcam.setPropertyValue("exposure_time", 0.01)
hcam.setPropertyValue("binning", "1x1")
hcam.setPropertyValue("readout_speed", 2)

if False:
    cam_x = 2048
    cam_y = 2048
    hcam.setPropertyValue("subarray_hsize", cam_x)
    hcam.setPropertyValue("subarray_vsize", cam_y)

if True:
Esempio n. 9
0
# the sum of x*x for every pixel in every frame.
#
# Hazen 10/13
#

import numpy
import sys
import time

import hamamatsu_camera as hc

if (len(sys.argv) != 3):
    print "usage: <filename> <number frames>"
    exit()

hcam = hc.HamamatsuCameraMR(0)

# Set camera parameters.
cam_offset = 100
hcam.setPropertyValue("defect_correct_mode", "OFF")
hcam.setPropertyValue("exposure_time", 0.01)
hcam.setPropertyValue("binning", "1x1")
hcam.setPropertyValue("readout_speed", 2)

if 1:
    cam_x = 2048
    cam_y = 2048
    hcam.setPropertyValue("subarray_hsize", cam_x)
    hcam.setPropertyValue("subarray_vsize", cam_y)

if 0: