-
Notifications
You must be signed in to change notification settings - Fork 0
/
guiv30.py
109 lines (81 loc) · 3.45 KB
/
guiv30.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 11:06:51 2019
@author: JOHNJAIRO
"""
import tkinter
from tkinter import *
from tkinter.ttk import *
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from tkinter import filedialog
import numpy as np
import cv2
import pydicom as dicom
from PIL import Image, ImageTk
root = Tk( )
def OpenFile():
root.directory = filedialog.askdirectory()
print (root.directory)
def demo():
#root = tk.Tk()
schedGraphics = tkinter
root = schedGraphics.Tk()
root.title("Testing GUI")
universal_height = 606
menu = Menu(root)
root.config(menu=menu)
file = Menu(menu)
file.add_command(label = 'Escolha pasta do paciente', command = OpenFile)
file.add_command(label = 'Exit', command = lambda:exit())
menu.add_cascade(label = 'Pasta paciente', menu = file)
nb = tkinter.ttk.Notebook(root)
# adding Frames as pages for the ttk.Notebook
# first page, which would get widgets gridded into it
page1 = tkinter.ttk.Frame(nb, width= universal_height,height = (universal_height)/2)
page2 = tkinter.ttk.Frame(nb,width = universal_height,height = (universal_height)/2)
page3 = tkinter.ttk.Frame(nb,width = universal_height,height = (universal_height)/2)
page4 = tkinter.ttk.Frame(nb,width = universal_height,height = (universal_height)/2)
nb.add(page1, text='Tomografia-Dicom')
nb.add(page2, text='Dentes')
nb.add(page3, text='Face')
nb.add(page4, text='Superposição: Tomografia/Dentes ')
# https://www.programcreek.com/python/example/104109/tkinter.ttk.Notebook
# https://stackoverflow.com/questions/16514617/python-tkinter-notebook-widget
# https://stackoverflow.com/questions/44745297/adding-notebook-tabs-in-tkinter-how-do-i-do-it-with-a-class-based-structure
nb.grid(row=2)
day_label = schedGraphics.Label(page1, text="imagems Dicom:")
day_label.pack()
day_label.place(x=0, y=30)
day_label = schedGraphics.Label(page2, text="Dentes: ..........")
day_label.pack()
day_label.place(x=0, y=30)
day_label = schedGraphics.Label(page3, text="Face: ..........")
day_label.pack()
day_label.place(x=0, y=30)
day_label = schedGraphics.Label(page4, text="Superposição ..........")
day_label.pack()
day_label.place(x=0, y=30)
canvas = schedGraphics.Canvas(page1,width = 900, height = universal_height)
canvas.create_rectangle(50,500,300,600,fill = "red")
ds=dicom.dcmread('E:\dicom dentista\paciente zero\Tomografia\pollyanna, florcena 11_20_2015polianaface0571.dcm')
dcm_sample=ds.pixel_array*18
img = ImageTk.PhotoImage(image=Image.fromarray(dcm_sample))
print(type(dcm_sample))
#cv2.imshow('sample image dicom',dcm_sample)
canvas = tkinter.Canvas(page1,width=300,height=300)
canvas.pack()
canvas.create_image(20,20, anchor="nw", image=img)
canvas.grid()
canvas = schedGraphics.Canvas(page2,width = 900, height = universal_height)
canvas.create_rectangle(50,500,300,600,fill = "blue")
canvas.grid()
canvas = schedGraphics.Canvas(page3,width = 900, height = universal_height)
canvas.create_rectangle(50,500,300,600,fill = "green")
canvas.grid()
canvas = schedGraphics.Canvas(page4,width = 900, height = universal_height)
canvas.create_rectangle(50,500,300,600,fill = "black")
canvas.grid()
root.mainloop()
if __name__ == "__main__":
demo()