コード例 #1
0
	def import_data_fn(self):
		deltat= 1000/float(self.text_1)
		#pickle.dump(tif.asarray(), open('extra.p',"wb"))
		ab = self.tif.asarray().astype(np.float64)
		print('shape',ab.shape)
		scanObject(filename,par_obj,[deltat,float(self.text_2)/1000000],ab,0,0);
		win_obj.bleachCorr1 = False
		win_obj.bleachCorr2 = False
		win_obj.label.generateList()
		self.win_obj.image_status_text.showMessage("Correlating carpet: File " +str(self.win_obj.file_import.file_index+1)+' of '+str(self.win_obj.file_import.file_list.__len__()))
		self.win_obj.app.processEvents()
		if win_obj.last_in_list == False:
			print ('moving to next file')
			win_obj.file_import.load_next_file()
		else:
			print( 'finished with all files')
			win_obj.file_import.post_initial_import()
コード例 #2
0
	def import_data_fn(self):
		deltat= 1000/float(self.text_1)
		data_array = tif_fn.imread(str(filename),key=0)
		scanObject(filename,par_obj,[deltat,float(self.text_2)/1000000],data_array,0,0);
		win_obj.bleachCorr1 = False
		win_obj.bleachCorr2 = False
		win_obj.DeltatEdit.setText(str(deltat));
		win_obj.label.generateList()
		
		self.win_obj.image_status_text.showMessage("Correlating carpet: File " +str(self.win_obj.file_import.file_index+1)+' of '+str(self.win_obj.file_import.file_list.__len__()))
		self.win_obj.app.processEvents()

		if win_obj.last_in_list == False:
			print( 'moving to next file')
			win_obj.file_import.load_next_file()
		else:
			print ('finished with all files')
			win_obj.file_import.post_initial_import()
コード例 #3
0
    def import_data_fn(self):
        """Populates the scannning FCS software with the data."""
        self.imDataDesc[7] = self.stack_ind['name']
        self.imDataDesc[6] = float(self.text_2) / 1000000
        self.imDataDesc[3] = self.stack_ind['size']
        self.imDataDesc[4] = [1.0 / float(self.text_1)]
        self.imDataDesc[2] = ['Red']

        scanObject(self.stack_ind['title'], self.par_obj, self.imDataDesc,
                   self.stack_ind['image'].astype(np.float64), 0, 0)
        self.win_obj.bleachCorr1 = False
        self.win_obj.bleachCorr2 = False

        self.win_obj.label.generateList()
        self.par_obj.objectRef[-1].cb.setChecked(True)
        self.par_obj.objectRef[-1].plotOn = True

        self.win_obj.image_status_text.showMessage(
            "Correlating carpet: " + str(self.ind) + " of " +
            str(self.selList.__len__()) + ". File " +
            str(self.win_obj.file_import.file_index + 1) + ' of ' +
            str(self.win_obj.file_import.file_list.__len__()))

        if self.ind < self.selList.__len__():

            self.ind = self.ind + 1
            if self.ind == self.selList.__len__():
                self.win_obj.last_in_file = True
            self.next_index(self.ind - 1)

        else:
            self.win_obj.app.processEvents()
            #Is it the last file in the list
            if self.win_obj.last_in_list == False:
                print('moving to next file')

                self.win_obj.file_import.load_next_file()
            else:
                print('finished with all files')
                self.win_obj.file_import.post_initial_import()
コード例 #4
0
    def import_lif_sing(self, selList):
        """Loads the individual lif raw data in to the scanning software"""

        self.imDataStore = []
        self.imDataDesc = []
        count_loaded = 0
        #Memory reading happens once.
        while True:

            #Unpacks header for pixel encoding memory.
            try:
                struct.unpack('i', self.f.read(4))[0]
            except:
                break
            struct.unpack('i', self.f.read(4))[0]
            self.f.read(1)

            if platform.system() == 'Darwin':
                memSize = struct.unpack('l', self.f.read(8))[0]
            elif platform.system() == 'Windows':
                memSize = struct.unpack('l', self.f.read(4))[0]
                memSize2 = struct.unpack('l', self.f.read(4))[0]
            else:
                memSize = struct.unpack('l', self.f.read(8))[0]

            self.f.read(1)
            c = struct.unpack('i', self.f.read(4))[0]

            memDesc = bytearray()
            for i in range(0, c * 2):
                memDesc.extend(bytes(self.f.read(1)))
            #print struct.unpack('i', f.read(4))[0]

            #Read a memory block of the correct size.
            #imBinData = self.f.read(memSize)
            memDesc = memDesc.translate(None, b'\x00').decode("utf-8")
            #loadImBool = (memDesc in memId )
            loadImBool = False

            #Catch data if it happens to be in array
            for b in selList:

                #print memDesc+' '+temp[0]

                if self.meta_array[b]['memid'] == memDesc:
                    loadImBool = True
                    bytesInc = self.meta_array[b]['bytesinc']

                    count_loaded += 1
                    self.win_obj.image_status_text.showMessage(
                        "Processing carpet: " + str(count_loaded) + " of " +
                        str(selList.__len__()) + ". From file: " +
                        str(self.win_obj.file_import.file_num + 1) + " of " +
                        str(self.win_obj.file_import.file_list.__len__()) +
                        ".")

                    self.win_obj.app.processEvents()
                    break

            #If memDesc and temp are in list.
            if memSize > 0 and loadImBool == True:

                #This is where the actual data is read in.

                imBinData = self.f.read(memSize)
                if bytesInc == 1:
                    imData = [0] * imBinData.__len__()
                    for iv in range(0, imBinData.__len__(), 1):
                        byteData = struct.unpack('B', imBinData[iv:iv + 1])[0]
                        imData[iv] = byteData
                if bytesInc == 2:
                    imData = [0] * int(imBinData.__len__() / 2)

                    cc = 0
                    for iv in range(0, imBinData.__len__(), 2):
                        byteData = struct.unpack('H', imBinData[iv:iv + 2])[0]
                        imData[cc] = byteData
                        cc = cc + 1

                self.imDataStore.append(imData)
                self.imDataDesc.append(self.meta_array[b])

            else:

                if count_loaded == selList.__len__():
                    break
                footer = self.f.tell()
                self.f.seek(footer + memSize)

        s = []
        self.f.close()
        self.win_obj.update_correlation_parameters()
        self.parObj.total_sub_files = self.imDataDesc.__len__()
        for i in range(self.imDataDesc.__len__()):
            self.parObj.file_sub = i
            self.win_obj.image_status_text.showMessage(
                "Correlating carpet: " + str(i + 1) + " of " +
                str(self.imDataDesc.__len__()) + ". From file: " +
                str(self.win_obj.file_import.file_num + 1) + " of " +
                str(self.win_obj.file_import.file_list.__len__()) + ".")

            self.win_obj.fit_obj.app.processEvents()
            s.append(
                scanObject(self.fname, self.parObj, self.imDataDesc[i],
                           self.imDataStore[i], 0, 0))

        self.win_obj.bleachCorr1 = False
        self.win_obj.bleachCorr2 = False
        self.win_obj.label.generateList()
        self.win_obj.image_status_text.showMessage("Data plotted.")