Ejemplo n.º 1
0
    def mouse_move(self, event):
        """ Captura posición del mouse sobre imagen (menú imágenes)

        :param self: instancia de la clase MainApp
        :type self: titi_app.MainApp
        :returns: Sin retorno
        :rtype: --
        """
        valorCB = str(self.ventana.comboBox.currentText())
        if not event.inaxes:
            return
        if (valorCB != "SAC-D/Aquarius"):
            # solo si se encuentra en imagesMenu
            #if (self.ventana.verticalLayout_3.count() == 0):
                ## no se agrego la figura de zoom aun
                ## entonces se agrega el figure
            x, y = event.xdata, event.ydata
            #self.ventana.label_2.setText(str(x) + " " + str(y))
            if (0 <= x <= self.XSize) and (0 <= y <= self.YSize):
                # se obtiene el colormap seleccionado
                colorMap = str(self.imagesMenu.comboBox.currentText())
                colorValue = eval("cm." + colorMap)
                ## Load small zoom
                self.figure2.clear()
                self.ax2 = self.figure2.add_subplot(111)
                image2 = self.ax2.imshow(self.data[y-8:y+8,x-8:x+8], cmap = colorValue)
                self.canvas2.draw()
            # statusBar
            col, row = int(x), int(y)
            lat, lon = module.getLatLon(row,col, self.lat0, self.lon0, self.dlat, self.dlon)
            sms = "Row,Col = [" + str(row) + "," + str(col) + "]     |     Lat,Lon =  [" + str(lat) + "," + str(lon) + "]"
            sms += "    |    Value = " + str(self.data[row,col])
            self.statusBar().showMessage(sms)
Ejemplo n.º 2
0
    def extract(self):
        """ Extrae el valor de un pixel de la imagen (menú imagenes)

        :param self: instancia de la clase MainApp
        :type self: titi_app.MainApp
        :returns: Sin retorno
        :rtype: --
        """
        # Get the value from image
        if (self.imagesMenu.radioButton.isChecked()):
            # esta seleccionada "Lat/Lon"
            lat = float(self.imagesMenu.lineEdit.text())
            lon = float(self.imagesMenu.lineEdit_2.text())
            ## Image indexes
            row,col = module.getRowCol(lat,lon,self.lat0, self.lon0, self.dlat, self.dlon)

        else:
            row = float(self.imagesMenu.lineEdit.text())
            col = float(self.imagesMenu.lineEdit_2.text())
            ## Only to be logged
            lat, lon = module.getLatLon(row,col,self.lat0, self.lon0, self.dlat, self.dlon)
        ## Format the info to be logged
        sms = "\n+ Extract operation \n"
        sms += "     Lat = " + str(lat) + "\n"
        sms += "     Lon = " + str(lon) + "\n"
        sms += "     Row = " + str(row) + "\n"
        sms += "     Col = " + str(col) + "\n"
        self.ventana.textEdit.append(sms)
        if (self.YSize < row or row < 0) or (self.XSize < col or col < 0):
            # if row or col are out of bounds
            self.ventana.textEdit.append("\n Error: Row or column out of bouds")
        else:
            self.imagesMenu.lineEdit_3.setText(str(self.data[row][col]))
            self.ventana.textEdit.append("     Extracted value = " + str(self.data[row][col]))