def LoadImage(self): global Image print('loading image...') fnametmp = QFileDialog.getOpenFileName(self, 'Open file', './') fname = fnametmp[0] print("filename", fname) Image = imgtl.Load(fname) Refresh()
def LoadBackground(self): global Background print('background') fnametmp = QFileDialog.getOpenFileName(self, 'Open file', './') fname = fnametmp[0] print("filename", fname) Background = imgtl.Load(fname) Refresh()
# parameters bbox = 200 cal = 1 fudge = 0.3 threshold = 0. # scan over the number of data point # fileonly = rootname+"-"+str(1+i)+".png" # filename = UpperDir+"/"+SubDir+"/"+fileonly filenameBeam = FileDir + FilenameBeam filenameBkgd = FileDir + FilenameBkgd # load the image if test == 0: IMGbeam = imgtl.Load(filenameBeam) IMGbkgd = imgtl.Load(filenameBkgd) IMG = 1. * IMGbeam - IMGbkgd # IMG=ndimage.gaussian_filter(IMGT, 2) # ndimage.gaussian_filter(IMGT, sigma=3) if test == 1: # this makes a test image # a gaussian curve # IMG = 10.+np.random.rand((1296,1606)) IMGT = np.zeros((1296, 1606)) BKGD = np.zeros((1296, 1606)) IMG = np.zeros((1296, 1606)) s = np.shape(IMG) v = np.linspace(0, s[0], s[0]) h = np.linspace(0, s[1], s[1])
import ImageTool as imtl import numpy as np import pylab as pyl import matplotlib.pyplot as plt import pydefaults # directory upperfile = "/Users/piot/ASTA_commissioning/quadscan/X121_20150601//tight_focus/" filename = "nml-2015-06-01-2205-23-13076.png" # in um/pixel cal = 9. thres = 0.02 A = imtl.Load(upperfile + filename) B = imtl.AutoCrop(A, 100) C = imtl.Threshold(B, thres) #imtl.DisplayCalibrated(B, cal) imtl.DisplayCalibratedProj(B, cal, 0.3) plt.xlabel('x ($\mu$m)', fontsize=24) plt.ylabel('y ($\mu$m)', fontsize=24) plt.title(filename, fontsize=24) plt.tight_layout() plt.show()
#A. Halavanau. DeKalb, IL (2017) / Menlo Park, CA (2018) import numpy as np import matplotlib.pyplot as plt from scipy.ndimage import rotate import ImageTool as imtl from statistical import * from parameters import * i = 1 pwd = 'examples/Normal_quad_scan_L2/' filename = pwd + 'X111_YAG_' + str(i) + '_bkg_0.png' filenamebg = pwd + 'X111_YAG_' + str(i) + '_img_0.png' data = imtl.Load(filename) bg = imtl.Load(filenamebg) data = data - bg data = data[0:2000, 0:2000] data = imtl.Normalize(data) #experimental data_rot = data.copy() data_rot = rotate(data, skew, reshape=False) x, y = imtl.ImageFit(data_rot, 1.0, True) print "Image center is at: ", int(x[0]), int(y[0]) print "Gaussian fit sizes (px): ", int(x[2]), int(y[2]) print "Gaussian fit sizes (m): ", cal * x[2], cal * y[2] sigma_max = int(np.max((x[2], y[2]))) sigma_min = int(np.min((x[2], y[2])))