Adicionado radiobutton para seleção de polaridade nos protocolos Basal Unipolar e TBS unipolar.

parent c8dfe35b
......@@ -188,9 +188,17 @@ def protocolSelect(canvas, protocol):
prot_label = Label(canvas, image=prot_photo)
prot_label.image = prot_photo
prot_label.place(relx=0.0, rely=0.24, relwidth=1, relheight=0.275)
n_items_basal = 6
n_items_basal = 7
height_items_basal = 0.5 / n_items_basal
i=0
polarityGroup = LabelFrame(canvas, text = "Selecionar polaridade dos pulsos")
polarityGroup.place(relx=0, rely=0.5+(i*height_items_basal), relwidth=1, relheight=height_items_basal)
polarity = IntVar()
positive = Radiobutton(polarityGroup, text = "positiva", variable = polarity, value = 2)
positive.place(relx=0.2, rely=0, relwidth=0.3, relheight=1)
negative = Radiobutton(polarityGroup, text = "negativa", variable = polarity, value = 1)
negative.place(relx=0.6, rely=0, relwidth=0.3, relheight=1)
i = i+1
T_text = Label(canvas, text="Intervalo T (us):")
T_text.place(relx=0, rely=0.5+(i*height_items_basal), relwidth=0.4, relheight=height_items_basal)
T_entry = Entry(canvas, justify=CENTER, validate='key', vcmd=vcmd)
......@@ -219,7 +227,7 @@ def protocolSelect(canvas, protocol):
dur_lim = Label(canvas, text="Limites: 1min - 30min")
dur_lim.place(relx=0.6, rely=0.5+(i*height_items_basal), relwidth=0.4, relheight=height_items_basal)
i = i+1
button_par_1 = Button(canvas, text="Selecionar parâmetros", command = lambda:BasalUniSelectPar(canvas, T_entry.get(), IPI_entry.get(), ITI_entry.get(), dur_entry.get()))
button_par_1 = Button(canvas, text="Selecionar parâmetros", command = lambda:BasalUniSelectPar(canvas, T_entry.get(), IPI_entry.get(), ITI_entry.get(), dur_entry.get(), polarity.get()))
button_par_1.place(relx=0, rely=0.5+(i*height_items_basal), relwidth=1, relheight=height_items_basal)
i = i+1
if (canvas==canvas1):
......@@ -288,9 +296,17 @@ def protocolSelect(canvas, protocol):
prot_label = Label(canvas, image=prot_photo)
prot_label.image = prot_photo
prot_label.place(relx=0.0, rely=0.24, relwidth=1, relheight=0.275)
n_items_tbs = 9
n_items_tbs = 11
height_items_tbs = 0.5 / n_items_tbs
i=0
polarityGroup = LabelFrame(canvas, text = "Selecionar polaridade dos pulsos")
polarityGroup.place(relx=0, rely=0.5+(i*height_items_tbs), relwidth=1, relheight=2*height_items_tbs)
polarity = IntVar()
positive = Radiobutton(polarityGroup, text = "positiva", variable = polarity, value = 2)
positive.place(relx=0.2, rely=0, relwidth=0.3, relheight=1)
negative = Radiobutton(polarityGroup, text = "negativa", variable = polarity, value = 1)
negative.place(relx=0.6, rely=0, relwidth=0.3, relheight=1)
i=i+2
T_text = Label(canvas, text="Intervalo T (ms):")
T_text.place(relx=0, rely=0.5+(i*height_items_tbs), relwidth=0.4, relheight=height_items_tbs)
T_entry = Entry(canvas, justify=CENTER, validate='key', vcmd=vcmd)
......@@ -333,7 +349,7 @@ def protocolSelect(canvas, protocol):
dur_lim = Label(canvas, text="Limites: 1min - 30min")
dur_lim.place(relx=0.6, rely=0.5+(i*height_items_tbs), relwidth=0.4, relheight=height_items_tbs)
i=i+1
button_par_1 = Button(canvas, text="Selecionar parâmetros", command = lambda:TBSuniSelectPar(canvas, T_entry.get(), IPI_entry.get(), n_ep_entry.get(), IEI_entry.get(), ITI_entry.get(), dur_entry.get()))
button_par_1 = Button(canvas, text="Selecionar parâmetros", command = lambda:TBSuniSelectPar(canvas, T_entry.get(), IPI_entry.get(), n_ep_entry.get(), IEI_entry.get(), ITI_entry.get(), dur_entry.get(), polarity.get()))
button_par_1.place(relx=0, rely=0.5+(i*height_items_tbs), relwidth=1, relheight=height_items_tbs)
i=i+1
if (canvas==canvas1):
......@@ -465,7 +481,7 @@ def protocolSelect(canvas, protocol):
prot3 = "PBS"
#Função para interface de seleção dos parâmetros de protocolo Basal unipolar
def BasalUniSelectPar(canvas, T, IPI, ITI, dur):
def BasalUniSelectPar(canvas, T, IPI, ITI, dur, polarity):
if(canvas==canvas1):
protocolNumber = 0
elif(canvas==canvas2):
......@@ -477,6 +493,7 @@ def BasalUniSelectPar(canvas, T, IPI, ITI, dur):
IPI_f = int(IPI)
ITI_f = int(ITI)
dur_f = int(dur)
polarity_f = int(polarity)
i=5
n_items_basal = 6
height_items_basal = 0.5 / n_items_basal
......@@ -490,20 +507,15 @@ def BasalUniSelectPar(canvas, T, IPI, ITI, dur):
T_f += 256
IPI_f += 256
ITI_f += 256
dur_f += 256
polarity_f += 256
protocolParam[protocolNumber][0] = T_f.to_bytes(2,'little')
protocolParam[protocolNumber][1] = IPI_f.to_bytes(2,'little')
protocolParam[protocolNumber][2] = ITI_f.to_bytes(2,'little')
protocolParam[protocolNumber][3] = int(257).to_bytes(2,'little')
protocolParam[protocolNumber][3] = polarity_f.to_bytes(2,'little')
protocolParam[protocolNumber][4] = int(257).to_bytes(2,'little')
protocolParam[protocolNumber][5] = int(257).to_bytes(2,'little')
print(protocolParam[protocolNumber][0])
print(protocolParam[protocolNumber][1])
print(protocolParam[protocolNumber][2])
print(protocolParam[protocolNumber][3])
print(protocolParam[protocolNumber][4])
print(protocolParam[protocolNumber][5])
writeToLog("Parâmetros definidos.")
except:
writeToLog("Algum erro ocorreu. Tente preencher todos os parâmetros.")
......@@ -549,7 +561,13 @@ def BasalBiSelectPar(canvas, T, IPI, ITI, dur):
#Função para interface de seleção dos parâmetros de protocolo TBS unipolar
def TBSuniSelectPar(canvas, T, IPI, n_ep, IEI, ITI, dur):
def TBSuniSelectPar(canvas, T, IPI, n_ep, IEI, ITI, dur, polarity):
if(canvas==canvas1):
protocolNumber = 0
elif(canvas==canvas2):
protocolNumber = 1
elif(canvas==canvas3):
protocolNumber = 2
try:
T_f = int(T)
IPI_f = int(IPI)
......@@ -557,8 +575,9 @@ def TBSuniSelectPar(canvas, T, IPI, n_ep, IEI, ITI, dur):
IEI_f = int(IEI)
ITI_f = int(ITI)
dur_f = int(dur)
i=7
n_items_tbs = 9
polarity_f = int(polarity)
i=9
n_items_tbs = 11
height_items_tbs = 0.5 / n_items_tbs
n_train_calc = (60*dur_f)/(((4*(T_f+IPI_f)/1000)+IEI_f/1000)*n_ep_f + ITI_f)
n_train_calc = int(n_train_calc)
......@@ -572,31 +591,20 @@ def TBSuniSelectPar(canvas, T, IPI, n_ep, IEI, ITI, dur):
f_p_text.place(relx=0, rely=0.5+(i*height_items_tbs), relwidth=0.5, relheight=height_items_tbs)
f_p_text_var = Label(canvas, text=f_p_calc)
f_p_text_var.place(relx=0.5, rely=0.5+(i*height_items_tbs), relwidth=0.5, relheight=height_items_tbs)
if (canvas==canvas1):
global T_1
global IPI_1
global n_ep_1
global IEI_1
global ITI_1
global dur_1
if (canvas==canvas2):
global T_f_2
global IPI_f_2
global n_ep_f_2
global IEI_f_2
global ITI_f_2
global dur_f_2
if (canvas==canvas3):
global T_f_3
global IPI_f_3
global n_ep_f_3
global IEI_f_3
global ITI_f_3
global dur_f_3
T_f += 256
IPI_f += 256
n_ep_f += 256
IEI_f += 256
ITI_f += 256
polarity_f += 256
protocolParam[protocolNumber][0] = T_f.to_bytes(2,'little')
protocolParam[protocolNumber][1] = IPI_f.to_bytes(2,'little')
protocolParam[protocolNumber][2] = n_ep_f.to_bytes(2,'little')
protocolParam[protocolNumber][3] = IEI_f.to_bytes(2,'little')
protocolParam[protocolNumber][4] = ITI_f.to_bytes(2,'little')
protocolParam[protocolNumber][5] = polarity_f.to_bytes(2,'little')
writeToLog("Parâmetros definidos.")
except:
writeToLog("Algum erro ocorreu. Tente preencher todos os parâmetros.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment