diff --git a/script/device/Image.py b/script/device/Image.py index 5ff5820..923b0c1 100644 --- a/script/device/Image.py +++ b/script/device/Image.py @@ -6,43 +6,43 @@ class Image(DeviceBase, Readable): self.pixel = pixel - def get_int(threshold1= None, threshold2= None, threshold3= None, threshold4= None, filename = None): - if threshold1 is None: - threshold1 = self.pixel.PIX_THRESH1 - if threshold2 is None: - threshold2 = self.pixel.PIX_THRESH2 - if threshold3 is None: - threshold3 = self.pixel.PIX_THRESH3 - if threshold4 is None: - threshold4 = self.pixel.PIX_THRESH4 - if filename is None: - filename = self.pixel.get_image_filename() - tmp_file = "/tmp/ls ..dat" - copyfile(filename, tmp_file) + def get_int(self, threshold1= None, threshold2= None, threshold3= None, threshold4= None, filename = None): + if threshold1 is None: + threshold1 = self.pixel.PIX_THRESH1 + if threshold2 is None: + threshold2 = self.pixel.PIX_THRESH2 + if threshold3 is None: + threshold3 = self.pixel.PIX_THRESH3 + if threshold4 is None: + threshold4 = self.pixel.PIX_THRESH4 + if filename is None: + filename = self.pixel.get_image_filename() + tmp_file = "/tmp/spec_image_info.dat" + copyfile(filename, tmp_file) - - #unixCommand = "%s%s %s %d %d %d %d -median 30" % (commandDir,"/bin/image_get_int.py","/tmp/spec_image_info.dat", \ - # threshold1, threshold2, threshold3, threshold4) - ret = run("image_get_int.py", ["/tmp/spec_image_info.dat", threshold1, threshold2, threshold3, threshold4, "-median", 30]) - (I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret - print ret - return I_sum + + #unixCommand = "%s%s %s %d %d %d %d -median 30" % (commandDir,"/bin/image_get_int.py","/tmp/spec_image_info.dat", \ + # threshold1, threshold2, threshold3, threshold4) + ret = run("image_get_int.py", [None, tmp_file, threshold1, threshold2, threshold3, threshold4, "-median", 30]) + (I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret + print ret + return I_sum - """ - IMAGE_I_SUM = "" - IMAGE_AREA_SIG = "" - IMAGE_THRESH1_COUNT = "" - IMAGE_THRESH2_COUNT = "" - IMAGE_THRESH3_COUNT = "" - IMAGE_I_BG = "" - IMAGE_AREA_BG = "" - } - if (IMAGE_AREA_BG > 0){ - IMAGE_I_SIG = IMAGE_I_SUM - ((IMAGE_I_BG / IMAGE_AREA_BG) * IMAGE_AREA_SIG) - } else { - IMAGE_I_SIG = IMAGE_I_SUM - } - """ + """ + IMAGE_I_SUM = "" + IMAGE_AREA_SIG = "" + IMAGE_THRESH1_COUNT = "" + IMAGE_THRESH2_COUNT = "" + IMAGE_THRESH3_COUNT = "" + IMAGE_I_BG = "" + IMAGE_AREA_BG = "" + } + if (IMAGE_AREA_BG > 0){ + IMAGE_I_SIG = IMAGE_I_SUM - ((IMAGE_I_BG / IMAGE_AREA_BG) * IMAGE_AREA_SIG) + } else { + IMAGE_I_SIG = IMAGE_I_SUM + } + """ def read(self):