Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyNutil
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Harry Carey
PyNutil
Commits
e763c3c8
Commit
e763c3c8
authored
7 months ago
by
Sharon Christine Yates
Browse files
Options
Downloads
Patches
Plain Diff
Update PyNutilGUI.py
Link buttons to commands
parent
56efb743
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PyNutilGUI.py
+31
-8
31 additions, 8 deletions
PyNutilGUI.py
with
31 additions
and
8 deletions
PyNutilGUI.py
+
31
−
8
View file @
e763c3c8
...
@@ -5,8 +5,10 @@ from tkinter import ttk
...
@@ -5,8 +5,10 @@ from tkinter import ttk
import
brainglobe_atlasapi
import
brainglobe_atlasapi
import
PyNutil
import
PyNutil
from
tkinter.filedialog
import
askopenfilename
from
tkinter.filedialog
import
askopenfilename
from
tkinter.filedialog
import
askdirectory
from
tkinter
import
colorchooser
from
tkinter
import
colorchooser
from
PyNutil
import
PyNutil
#Basic GUI example
#Basic GUI example
root
=
Tk
()
root
=
Tk
()
...
@@ -17,8 +19,11 @@ root.wm_iconbitmap("Logo_PyNutil.ico")
...
@@ -17,8 +19,11 @@ root.wm_iconbitmap("Logo_PyNutil.ico")
#root.wm_iconphoto(False, photo)
#root.wm_iconphoto(False, photo)
arguments
=
{
arguments
=
{
"
reference_atlas
"
:
None
,
"
registration_json
"
:
None
,
"
registration_json
"
:
None
,
"
object_colour
"
:
None
"
object_colour
"
:
None
,
"
segmentation_dir
"
:
None
,
"
output_dir
"
:
None
}
}
atlas
=
brainglobe_atlasapi
.
list_atlases
.
get_all_atlases_lastversions
()
atlas
=
brainglobe_atlasapi
.
list_atlases
.
get_all_atlases_lastversions
()
...
@@ -44,16 +49,34 @@ def about_pynutil():
...
@@ -44,16 +49,34 @@ def about_pynutil():
def
open_registration_json
():
def
open_registration_json
():
value
=
askopenfilename
()
value
=
askopenfilename
()
arguments
[
"
registration_json
"
]
=
value
arguments
[
"
registration_json
"
]
=
value
print
(
arguments
)
print
(
arguments
[
"
registration_json
"
]
)
def
choose_colour
():
def
choose_colour
():
value
=
colorchooser
.
askcolor
()
value
=
colorchooser
.
askcolor
()
arguments
[
"
object_colour
"
]
=
value
arguments
[
"
object_colour
"
]
=
value
print
(
list
(
value
[
0
]))
print
(
list
(
value
[
0
]))
def
open_segmentation_dir
():
value
=
askdirectory
()
arguments
[
"
segmentation_dir
"
]
=
value
print
(
arguments
[
"
segmentation_dir
"
])
def
select_output_dir
():
value
=
askdirectory
()
arguments
[
"
output_dir
"
]
=
value
print
(
arguments
[
"
output_dir
"
])
def
start_analysis
():
def
start_analysis
():
#your code here
pnt
=
PyNutil
(
return
segmentation_folder
=
open_segmentation_dir
,
#'../tests/test_data/big_caudoputamen_test/',
alignment_json
=
open_registration_json
,
#'../tests/test_data/big_caudoputamen.json',
colour
=
choose_colour
,
#[0, 0, 0],
atlas_name
=
'
allen_mouse_25um
'
)
pnt
.
get_coordinates
(
object_cutoff
=
0
)
pnt
.
quantify_coordinates
()
pnt
.
save_analysis
(
"
../tests/outputs/test9_PyNutil_bigcaudoputamen_new
"
)
#Creating a menu
#Creating a menu
root
.
option_add
(
'
*tearOff
'
,
FALSE
)
root
.
option_add
(
'
*tearOff
'
,
FALSE
)
...
@@ -93,12 +116,12 @@ ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column
...
@@ -93,12 +116,12 @@ ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column
#Select registration JSON
#Select registration JSON
ttk
.
Label
(
mainframe
,
text
=
"
Select registration JSON:
"
,
width
=
25
).
grid
(
column
=
1
,
row
=
2
,
sticky
=
W
)
ttk
.
Label
(
mainframe
,
text
=
"
Select registration JSON:
"
,
width
=
25
).
grid
(
column
=
1
,
row
=
2
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
width
=
16
,
text
=
"
Browse...
"
,
command
=
open_registration_json
).
grid
(
column
=
2
,
row
=
2
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
width
=
16
,
text
=
"
Browse...
"
,
command
=
open_registration_json
).
grid
(
column
=
2
,
row
=
2
,
sticky
=
W
)
Text
(
mainframe
,
height
=
1
,
width
=
40
).
grid
(
column
=
3
,
row
=
2
,
sticky
=
W
)
Text
(
mainframe
,
height
=
1
,
width
=
40
).
grid
(
column
=
3
,
row
=
2
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
text
=
"
Help
"
,
width
=
8
,
command
=
"
buttonpressed
"
).
grid
(
column
=
4
,
row
=
2
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
text
=
"
Help
"
,
width
=
8
,
command
=
"
buttonpressed
"
).
grid
(
column
=
4
,
row
=
2
,
sticky
=
W
)
#Select segmentation folder
#Select segmentation folder
ttk
.
Label
(
mainframe
,
text
=
"
Select segmentation folder:
"
,
width
=
25
).
grid
(
column
=
1
,
row
=
3
,
sticky
=
W
)
ttk
.
Label
(
mainframe
,
text
=
"
Select segmentation folder:
"
,
width
=
25
).
grid
(
column
=
1
,
row
=
3
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
width
=
16
,
text
=
"
Browse...
"
,
command
=
"
buttonpressed
"
).
grid
(
column
=
2
,
row
=
3
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
width
=
16
,
text
=
"
Browse...
"
,
command
=
open_segmentation_dir
).
grid
(
column
=
2
,
row
=
3
,
sticky
=
W
)
Text
(
mainframe
,
height
=
1
,
width
=
40
).
grid
(
column
=
3
,
row
=
3
,
sticky
=
W
)
Text
(
mainframe
,
height
=
1
,
width
=
40
).
grid
(
column
=
3
,
row
=
3
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
text
=
"
Help
"
,
width
=
8
,
command
=
"
buttonpressed
"
).
grid
(
column
=
4
,
row
=
3
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
text
=
"
Help
"
,
width
=
8
,
command
=
"
buttonpressed
"
).
grid
(
column
=
4
,
row
=
3
,
sticky
=
W
)
...
@@ -110,7 +133,7 @@ ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column
...
@@ -110,7 +133,7 @@ ttk.Button(mainframe, text="Help", width=8, command="buttonpressed").grid(column
#Select output directory
#Select output directory
ttk
.
Label
(
mainframe
,
text
=
"
Select output directory:
"
,
width
=
25
).
grid
(
column
=
1
,
row
=
5
,
sticky
=
W
)
ttk
.
Label
(
mainframe
,
text
=
"
Select output directory:
"
,
width
=
25
).
grid
(
column
=
1
,
row
=
5
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
width
=
16
,
text
=
"
Browse...
"
,
command
=
"
buttonpressed
"
).
grid
(
column
=
2
,
row
=
5
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
width
=
16
,
text
=
"
Browse...
"
,
command
=
select_output_dir
).
grid
(
column
=
2
,
row
=
5
,
sticky
=
W
)
Text
(
mainframe
,
height
=
1
,
width
=
40
).
grid
(
column
=
3
,
row
=
5
,
sticky
=
W
)
Text
(
mainframe
,
height
=
1
,
width
=
40
).
grid
(
column
=
3
,
row
=
5
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
text
=
"
Help
"
,
width
=
8
,
command
=
"
buttonpressed
"
).
grid
(
column
=
4
,
row
=
5
,
sticky
=
W
)
ttk
.
Button
(
mainframe
,
text
=
"
Help
"
,
width
=
8
,
command
=
"
buttonpressed
"
).
grid
(
column
=
4
,
row
=
5
,
sticky
=
W
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment