main.py 1.85 KB
Newer Older
1 2 3 4 5 6 7
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
"""
  Nome: pynovisao.py
  Autor: Alessandro dos Santos Ferreira ( santosferreira.alessandro@gmail.com )

8
  Descricão: Arquivo main do programa.
9
"""
10
import argparse
11 12 13 14 15

from Pynovisao import Act

from interface import *

16 17 18 19 20 21 22 23 24 25 26 27

def get_args():
    ap = argparse.ArgumentParser()

    ap.add_argument("-d", "--dataset", required=False, help="Dataset path", default="../data/demo", type=str)
    
    ap.add_argument("-cl", "--classes", required=False, help="Classes names", default=None, type=str)
    ap.add_argument("-co", "--colors", required=False, help="Classes colors (X11 color)", default=None, type=str)
    
    return vars(ap.parse_args())


28 29 30 31
if __name__ == "__main__":
    
    tk = TkInterface.TkInterface("Pynovisao")
    
32
    act = Act(tk, get_args())
33 34 35 36
    
    tk.add_menu("File")
    tk.add_command("Open a image", act.open_image, 'O') 
    tk.add_separator()
37 38
    tk.add_command("Add new class", act.add_class, 'A')
    tk.add_command("Set dataset path", act.set_dataset_path, 'd')
39
    tk.add_separator()
40
    tk.add_check_button("Show log", tk.toogle_log)
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
    tk.add_separator()
    tk.add_command("Close image", act.close_image, 'W') 
    tk.add_separator()
    tk.add_command("Quit", tk.quit, 'Q')
    
    tk.add_menu("Segmentation")
    tk.add_command("Configure", act.config_segmentation, 'g')
    tk.add_separator()
    tk.add_command("Execute", act.run_segmentation, 'S')
    
    tk.add_menu("Feature Extraction")
    tk.add_command("Configure", act.func_not_available)
    tk.add_separator()
    tk.add_command("Execute", act.func_not_available, 'E')
    
    tk.add_menu("Classification")
    tk.add_command("Configure", act.func_not_available)
    tk.add_separator()
    tk.add_command("Execute", act.func_not_available, 'C')
    
    tk.render_menu()
    
    tk.add_panel_classes( act.classes )
    
    tk.open_log()
    
    tk.show()