def change_camera(self, camera_str): self.freeze.toggle() if self.camera.pixci_opened: self.camera.close() #self.camera.close() self.bitdepth_choice.clear() self.roi_size_choice.clear() if camera_str == "PhotonFocus": self.camera = epix_framegrabber.Camera() self.bitdepth_choice.insertItem(0, "8 bit") self.bitdepth_choice.insertItem(1, "10 bit") self.bitdepth_choice.insertItem(2, "12 bit") self.roi_size_choice.insertItem(0, "1024 x 1024") self.roi_size_choice.insertItem(1, "512 x 512") self.roi_size_choice.insertItem(2, "256 x 256") self.roi_size_choice.insertItem(3, "128 x 128") self.roi_size_choice.insertItem(4, "64 x 64") if camera_str == "Basler": self.camera = epix_framegrabber.Camera() self.bitdepth_choice.insertItem(0, "8 bit") self.roi_size_choice.insertItem(0, "1020 x 1020") if camera_str == "Simulated": self.camera = dummy_image_source.DummyCamera() self.bitdepth_choice.insertItem(0, "8 bit") self.roi_size_choice.insertItem(0, "1024 x 1024") self.reopen_camera()
def revise_camera_settings(self): self.camera.close() if self.camera_choice.currentText() == "PhotonFocus": self.camera = epix_framegrabber.Camera() if self.camera_choice.currentText() == "Basler": self.camera = epix_framegrabber.Camera() if self.camera_choice.currentText() == "Simulated": self.camera = epix_framegrabber.Camera() self.roi_shape = [ int(i) for i in str(self.roi_size_choice.currentText()).split(' x ') ] self.bit_depth = int( str(self.bitdepth_choice.currentText()).split()[0]) self.camera.open(self.bit_depth, self.roi_shape, self.camera_choice.currentText()) self.livebutton.toggle() self.live()
def __init__(self): if epix_available: self.camera = epix_framegrabber.Camera() else: self.camera = dummy_image_source.DummyCamera() super(captureFrames, self).__init__() self.initUI() # we have to set this text after the internals are initialized since the filename is constructed from widget values self.update_filename() # pretend the last save was a timeseries, this just means that # we don't need to increment the dir number before saving the # first timeseries self.last_save_was_series = True QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Q"), self, self.close)
from PySide import QtGui, QtCore from PIL import Image import h5py from multiprocessing import Process from scipy.misc import toimage, fromimage, bytescale import numpy as np import time import yaml import json import dummy_image_source import epix_framegrabber from compress_h5 import compress_h5 try: epix_framegrabber.Camera() epix_available = True except epix_framegrabber.CameraOpenError: epix_available = False from utility import mkdir_p from QtConvenience import (make_label, make_HBox, make_VBox, make_LineEdit, make_button, make_control_group, make_checkbox, CheckboxGatedValue, increment_textbox, zero_textbox, textbox_int, textbox_float, make_combobox, make_tabs) #TODO: construct format file outside of the image grabbing loop, only # when someone changes bit depth or ROI #TODO: automate changing bit depth in PFRemote with the PF Remote DLL and some command like: SetProperty("DataResolution", Value(#1)") #TODO: tie exposure time back to PFRemote ("SetProperty( "ExposureTime",Value(22.234))
from time import sleep #build a QApplication for opening windows if __name__ == '__main__': app = QApplication(sys.argv) parent_QWidget = QWidget() #from HySP_med_led import epix_framegrabber test_mode = 3 if test_mode == 0: try: epix_framegrabber.Camera() epix_available = True except epix_framegrabber.CameraOpenError: epix_available = False #open the camera camera = epix_framegrabber.Camera() aa = camera.open(10, [2048, 1088], camera="PhotonFocus", exposure=10, frametime=100.0) #camera.set_tap_configuration(2) # put the correct settings for camera, correct CLTap, bitdepth