Bsoft  2.1.0
Bernard's software package
bshow_voxels.tcl
Go to the documentation of this file.
1 ##
2 # @file bshow_voxels.tcl
3 #
4 # @brief Procedures to record voxel values in Bshow.
5 #
6 # @author Bernard Heymann
7 # @date Created: 20101202
8 # @date Modified: 20200117
9 
10 ## @brief Handles selections from the image data.
11 #
12 
13 set line_width 1
14 
15 proc Voxels { } {
16  global helv12 theimg
17  global line_width trace_line
18  set c [getImageCanvas $theimg]
19 
20  set w .wvox
21 
22  if ![winfo exists $w] {
23  toplevel $w
24 
25  frame $w.frame
26  pack $w.frame -expand yes -fill both -padx 1 -pady 1
27  text $w.text -width 60 -height 24 -wrap none -undo 1 -background white\
28  -xscrollcommand "$w.xscroll set" \
29  -yscrollcommand "$w.yscroll set" \
30  -setgrid 1 -highlightthickness 0 -pady 2 -padx 3
31  scrollbar $w.xscroll -command "$w.text xview" \
32  -highlightthickness 0 -orient horizontal
33  scrollbar $w.yscroll -command "$w.text yview" \
34  -highlightthickness 0 -orient vertical
35 
36  grid $w.text -in $w.frame -padx 1 -pady 1 \
37  -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
38  grid $w.xscroll -in $w.frame -padx 1 -pady 1 \
39  -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
40  grid $w.yscroll -in $w.frame -padx 1 -pady 1 \
41  -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
42  grid rowconfig $w.frame 0 -weight 1 -minsize 0
43  grid columnconfig $w.frame 0 -weight 1 -minsize 0
44 
45  frame $w.type
46  checkbutton $w.type.line -text "Line" -variable trace_line
47  setupEntry $w.type.width "Width" double $line_width "Width of line"
48 
49  frame $w.buttons
50  button $w.buttons.save -text Save -command "saveAsTextFile $w.text"
51 # button $w.buttons.clear -text Clear -command "$w.text delete 1.0 end"
52  button $w.buttons.clear -text Clear -command "clearVoxelText $w"
53  button $w.buttons.close -text Close -command "destroy $w"
54 
55  pack $w.type.line $w.type.width -side left -expand 1
56 # pack $w.type.line -side left -expand 1
57  pack $w.buttons.save $w.buttons.clear $w.buttons.close -side left -expand 1
58  pack $w.buttons $w.type -side bottom -fill x -pady 2m
59 
60  } else {
61  wm deiconify $w
62  raise $w
63  }
64  wm title $w "Record voxels"
65  wm iconname $w "Voxels"
66  .menuBar.window entryconfigure "Voxels" -state normal
67  bind $c <1> "mousePressed %W %x %y"
68  bind $w <Control-w> { destroy $w }
69 }
70 
71 proc clearVoxelText { w } {
72  $w.text delete 1.0 end
73 }
74