def updateImage(self,mask = False,Stack = False): # acquire image from camera, this should not be the case, you get images multiple times # like this if Stack: # get the last image that was saved in the folder images print("Stack") # experiment_folder_path = self.main_widget.get_experiment_folder_path() # image_path = experiment_folder_path + '/images/' # file_names = [] # index = [] # for file in os.listdir(image_path): # index.append(int(file.split('_')[-1])) # file_names.append(file) # print(file_names) # print(np.argmax(np.asarray(index))) # max_index = np.argmax(np.asarray(index)) # im = Image.open(experiment_folder_path + '/images/' + file_names[max_index]) # im = np.array(im.getdata()).reshape(im.size[0], im.size[1]) # self.img = im.astype('uint16') # retval = 1 else: if mask == False: self.img,retval = self.main_widget.setup.camera.get_raw_img() else: img,retval = self.main_widget.setup.camera.get_raw_img() self.img = processing.processed_image(img) self.img *= 1024 retval = None # if there was an error, display a text box if retval == -1: msg = QtGui.QMessageBox() msg.setWindowTitle("Camera Error") msg.setIcon(QtGui.QMessageBox.Critical) msg.setStandardButtons(QtGui.QMessageBox.Ok) msg.setText("Cannot fetch image from camera") msg.setInformativeText("You must restart the program to fix the issue, your current position will be saved") msg.exec_() else: self.settings.set_Magnification(int(str(self.microscopy_mag.currentText()))) self.im.set_data(self.img) self.scale_bar() #self.molo_circle() molo_intensity,Airy_disk_radius, bkg_mean,bkg_std = mologram_processing.calc_IntAiryDisk(self.img) self.molo_intensity.setText(str(molo_intensity)) self.bg_int.setText(str(bkg_mean) + ',' + str(bkg_std)) self.sum_int.setText(str(np.sum(self.img)/(2560*1920))) self.max_pixel.setText(str(np.max(self.img))) print(self.settings.magnification) # draw a circle, where you detect the mologram # update the image self.canvas.draw()