Beispiel #1
0
    def executa(self):

        self.function = FiltroSavitz()

        self.function.console = self.print_text

        self.print_text(u"Inicializando filtro.")

        root_out = self.ui.leOutFolder.text()
        root_out = _fromUtf8(str(root_out) + "\\")
        root_out = str(root_out).replace("\\", "/")

        parametrosIn = self.carregarParamIN()

        self.print_text(u"Filtrando imagens...")
        imagens_filtradas = self.function.executar(parametrosIn)

        if self.funcao_cancelada(): return None
        elif imagens_filtradas == None:
            self.print_text(u"Erro desconhecido.")
            self.finalizar()
        else:
            imagens_filtradas.saveListByRoot(root_path=root_out, ext="tif")
            self.print_text(u"Função concluída")
            self.finalizar()
 def executa(self):
     
     self.function = FiltroSavitz()
     
     self.function.console = self.print_text
     
     self.print_text(u"Inicializando filtro.")
     
     root_out = self.ui.leOutFolder.text()
     root_out = _fromUtf8(str(root_out) + "\\")
     root_out = str(root_out).replace("\\", "/")
     
     parametrosIn = self.carregarParamIN()
     
     self.print_text(u"Filtrando imagens...")
     imagens_filtradas = self.function.executar(parametrosIn)
     
     if self.funcao_cancelada() : return None
     elif imagens_filtradas == None :
         self.print_text(u"Erro desconhecido.")
         self.finalizar()
     else :
         imagens_filtradas.saveListByRoot(root_path=root_out, ext="tif") 
         self.print_text(u"Função concluída")
Beispiel #3
0
class Controller(AbstractController.Controller):
    def findInFolder(self):
        self.findPath(self.ui.leInFolder, "folder")

    def findOutFolder(self):
        self.findPath(self.ui.leOutFolder, "folder")

    def executa(self):

        self.function = FiltroSavitz()

        self.function.console = self.print_text

        self.print_text(u"Inicializando filtro.")

        root_out = self.ui.leOutFolder.text()
        root_out = _fromUtf8(str(root_out) + "\\")
        root_out = str(root_out).replace("\\", "/")

        parametrosIn = self.carregarParamIN()

        self.print_text(u"Filtrando imagens...")
        imagens_filtradas = self.function.executar(parametrosIn)

        if self.funcao_cancelada(): return None
        elif imagens_filtradas == None:
            self.print_text(u"Erro desconhecido.")
            self.finalizar()
        else:
            imagens_filtradas.saveListByRoot(root_path=root_out, ext="tif")
            self.print_text(u"Função concluída")
            self.finalizar()

    def carregarParamIN(self):

        images = SerialFile()
        parametrosIN = TableData()
        root_in = self.ui.leInFolder.text()
        root_in = _fromUtf8(str(root_in) + "\\")
        root_in = str(root_in).replace("\\", "/")

        images.loadListByRoot(root_in)
        self.print_text(u"Numero de imagens encontradas:" + str(len(images)))

        parametrosIN["images"] = images

        conf_algoritimo = TableData()
        conf_algoritimo["window_size"] = self.ui.leWindowSize.text()
        conf_algoritimo["order"] = self.ui.leOrdem.text()
        #if self.ui.checkBox.isChecked() : conf_algoritimo["null_value"] = double(self.ui.leNullValue.text())
        #else : conf_algoritimo["null_value"] = FileData(data= None)

        parametrosIN["conf_algoritimo "] = conf_algoritimo

        return parametrosIN

    def valida_form(self):

        if not os.path.exists(self.ui.leInFolder.text()):
            self.message(
                u"Pasta de entrada das imagens não encontrada, verifique o endereço."
            )
            return False
        if not os.path.exists(self.ui.leOutFolder.text()):
            self.message(
                u"Pasta de saida das imagens não encontrada, verifique o endereço."
            )
            return False
        return True

    def parametros_teste(self):
        self.ui.leInFolder.setText(
            "Dados\\1-Tratamento de dados\\3-Indice de Vegetacao EVI\\1- EVI Modis recortado"
        )
        self.ui.leOutFolder.setText(
            "Dados\\1-Tratamento de dados\\3-Indice de Vegetacao EVI\\2- EVI Modis filtrado"
        )
Beispiel #4
0
if __name__ == "__main__":
    
    from Modelo import beans
    from Modelo.Funcoes.Filtros import FiltroSavitz
    
    import warnings
    warnings.filterwarnings('ignore')

    
    root_path="C:\\Users\\Paloschi\\Desktop\\data\\Rasters\\TesteFiltro\\entrada_pesada"
    root_out="C:\\Users\\Paloschi\\Desktop\\data\\Rasters\\TesteFiltro\\saida"
    
    images_in = beans.SerialFile(root_path=root_path)
    
    filtro = FiltroSavitz()
    paramIn = dict()
    
    paramIn["images"] = images_in
    
    filtro.data = paramIn
    
    images_filtred = filtro.data["images"]
    
    images_filtred.root_path = root_out
    
    images_filtred.saveListLike1Image(name="teste_pesado", images_bands_matrix=images_filtred.data, ext="tif")
    


class Controller(AbstractController.Controller):
    
    def findInFolder(self):
        self.findPath(self.ui.leInFolder, "folder")
        
    def findOutFolder(self):
        self.findPath(self.ui.leOutFolder, "folder")         
        
    def executa(self):
        
        self.function = FiltroSavitz()
        
        self.function.console = self.print_text
        
        self.print_text(u"Inicializando filtro.")
        
        root_out = self.ui.leOutFolder.text()
        root_out = _fromUtf8(str(root_out) + "\\")
        root_out = str(root_out).replace("\\", "/")
        
        parametrosIn = self.carregarParamIN()
        
        self.print_text(u"Filtrando imagens...")
        imagens_filtradas = self.function.executar(parametrosIn)
        
        if self.funcao_cancelada() : return None
        elif imagens_filtradas == None :
            self.print_text(u"Erro desconhecido.")
            self.finalizar()
        else :
            imagens_filtradas.saveListByRoot(root_path=root_out, ext="tif") 
            self.print_text(u"Função concluída")
        
    def carregarParamIN(self):
        
        images = SerialFile()
        parametrosIN = TableData()
        root_in = self.ui.leInFolder.text()
        root_in = _fromUtf8(str(root_in) + "\\")
        root_in = str(root_in).replace("\\", "/")

        images.loadListByRoot(root_in)
        self.print_text(u"Numero de imagens encontradas:" + str(len(images)))
        
        parametrosIN["images"] = images
        
        conf_algoritimo = TableData()
        conf_algoritimo["window_size"] = self.ui.leWindowSize.text()
        conf_algoritimo["order"] = self.ui.leOrdem.text()
        #if self.ui.checkBox.isChecked() : conf_algoritimo["null_value"] = double(self.ui.leNullValue.text())
        #else : conf_algoritimo["null_value"] = FileData(data= None)
        
        parametrosIN["conf_algoritimo "] = conf_algoritimo
        
        return parametrosIN
    
    def valida_form(self):
        
        if not os.path.exists(self.ui.leInFolder.text()):
            self.message(u"Pasta de entrada das imagens não encontrada, verifique o endereço.")
            return False   
        if not os.path.exists(self.ui.leOutFolder.text()):
            self.message(u"Pasta de saida das imagens não encontrada, verifique o endereço.")
            return False 
        return True
           
Beispiel #6
0
from AbstractFunction import Function as AbstractFunction

if __name__ == "__main__":

    from Modelo import beans
    from Modelo.Funcoes.Filtros import FiltroSavitz

    import warnings
    warnings.filterwarnings('ignore')

    root_path = "C:\\Users\\Paloschi\\Desktop\\data\\Rasters\\TesteFiltro\\entrada_pesada"
    root_out = "C:\\Users\\Paloschi\\Desktop\\data\\Rasters\\TesteFiltro\\saida"

    images_in = beans.SerialFile(root_path=root_path)

    filtro = FiltroSavitz()
    paramIn = dict()

    paramIn["images"] = images_in

    filtro.data = paramIn

    images_filtred = filtro.data["images"]

    images_filtred.root_path = root_out

    images_filtred.saveListLike1Image(name="teste_pesado",
                                      images_bands_matrix=images_filtred.data,
                                      ext="tif")