#!/usr/local/bin/wish -f # Copyright(c) 1998, Space Science and Engineering Center, UW-Madison # Refer to "McIDAS Software Acquisition and Distribution Policies" # in the file mcidas/data/license.txt # $Id: eu.gui,v 1.19 1999/03/22 15:30:09 rodr Exp $ # eu.gui # # set guipath $env(GUIDIR) set auto_path "$guipath $auto_path" set level 1 setoptions set entries1(0) " " set entries2(0) " " set entries3(0) " " set ptr 0 set low 1 set med 2 set hi 3 # # # GUI for Enhancement Utility # # wm title . "McIDAS: EU" wm iconname . "Image Colors" placegui . frame .frame -borderwidth 10 # # One line explanation of the command # # Create buttons which line up at the top and will pack and # unpack frames depending upon the users level of expertise. # These will not be needed for all commands , as some are # too easy for progressive disclosure. # frame .top button .top.low -text "Low" -command {set level 1; bindit $level pack unpack .frame.med pack unpack .frame.hi pack append .frame \ .frame.low {top fill expand} } button .top.med -text "Medium" -command {set level 2; bindit $level pack unpack .frame.hi pack append .frame.med \ .frame.med.magframe {bottom fill} pack append .frame \ .frame.low {top fill} \ .frame.med {top fill}} button .top.hi -text "High" -command {set level 3; bindit $level pack unpack .frame.med.magframe pack append .frame \ .frame.low {top fill} \ .frame.med {top fill} \ .frame.hi {top fill} } button .top.help -text "Help" -command "mkHelp" pack append .top \ .top.help {right} message .msg -width 600 -font $messfont -borderwidth 1 \ -text "Change Image Colors" frame .frame.low frame .frame.med frame .frame.hi # # Editting options. # frame .frame.low.option radiobutton .frame.low.option.make -anchor w -variable option -text Make \ -value MAKE -command " pack forget .frame.low.restore pack forget .frame.low.save pack .frame.low.make -side top -fill x" radiobutton .frame.low.option.restore -anchor w -variable option -text Restore\ -value REST -command " pack forget .frame.low.save pack forget .frame.low.make pack .frame.low.restore -side top -fill x set ptr 0 addentry $low .frame.low.restore.entry bindit $low" radiobutton .frame.low.option.save -anchor w -variable option -text Save\ -value SAVE -command " pack forget .frame.low.restore pack forget .frame.low.make pack .frame.low.save -side top -fill x set ptr 0 addentry $low .frame.low.save.entry bindit $low" radiobutton .frame.low.option.int -anchor w -variable option -text Interactive\ -value INTERACTIVE -command " pack forget .frame.low.restore pack forget .frame.low.make pack forget .frame.low.save" radiobutton .frame.low.option.reset -anchor w -variable option -text Reset\ -value RESET -command " pack forget .frame.low.restore pack forget .frame.low.make pack forget .frame.low.save" pack .frame.low.option.make .frame.low.option.restore .frame.low.option.save\ .frame.low.option.int .frame.low.option.save \ .frame.low.option.reset -side top -fill x pack .frame.low.option -side top -pady 2m # # Default option # .frame.low.option.reset select frame .frame.low.restore button .frame.low.restore.button -text "Enhancement File Name" -command ListEU entry .frame.low.restore.entry -textvariable enhance -relief sunken -width 12 pack .frame.low.restore.button -side left pack .frame.low.restore.entry -side right frame .frame.low.save label .frame.low.save.label -text "Enhancement File Name" entry .frame.low.save.entry -textvariable enhance -relief sunken -width 12 pack .frame.low.save.label -side left pack .frame.low.save.entry -side right set bred 0 set ered 255 set bgreen 0 set egreen 255 set bblue 0 set eblue 255 set bgray 0 set egray 255 frame .frame.low.make frame .frame.low.make.gray -borderwidth 2 -relief groove label .frame.low.make.gray.label -text "Input Gray Range" frame .frame.low.make.gray.begin label .frame.low.make.gray.begin.label -text "Begin" scale .frame.low.make.gray.begin.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -command "set bgray" pack .frame.low.make.gray.begin.label -side left pack .frame.low.make.gray.begin.scale -side right frame .frame.low.make.gray.end label .frame.low.make.gray.end.label -text "End" scale .frame.low.make.gray.end.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -command "set egray" pack .frame.low.make.gray.end.label -side left pack .frame.low.make.gray.end.scale -side right pack .frame.low.make.gray.label -side top pack .frame.low.make.gray.begin -side top -fill x pack .frame.low.make.gray.end -side top -fill x pack .frame.low.make.gray -side top -fill x .frame.low.make.gray.begin.scale set $bgray .frame.low.make.gray.end.scale set $egray label .frame.low.make.label -text "Output Color Range" pack .frame.low.make.label -side top -pady 4 frame .frame.low.make.how radiobutton .frame.low.make.how.byname -variable how -value byname \ -text "Select Named Color" -command { pack .frame.low.make.bname -side top -fill x pack .frame.low.make.ename -side top -fill x pack forget .frame.low.make.red pack forget .frame.low.make.green pack forget .frame.low.make.blue } radiobutton .frame.low.make.how.byval -variable how -value byval \ -text "Select Color Intensities" -command { pack forget .frame.low.make.bname pack forget .frame.low.make.ename pack .frame.low.make.red -side top -fill x pack .frame.low.make.green -side top -fill x pack .frame.low.make.blue -side top -fill x .frame.low.make.red.begin.scale set $bred .frame.low.make.red.end.scale set $ered .frame.low.make.green.begin.scale set $bgreen .frame.low.make.green.end.scale set $egreen .frame.low.make.blue.begin.scale set $bblue .frame.low.make.blue.end.scale set $eblue } pack .frame.low.make.how.byname -side left pack .frame.low.make.how.byval -side left pack .frame.low.make.how -side top -fill x -pady 10 frame .frame.low.make.bname button .frame.low.make.bname.button -text "Beginning Color Name Range" \ -command {GetNamedColor "X" bcolor} -width 30 entry .frame.low.make.bname.entry -textvariable bcolor -width 12 \ -relief sunken addentry $low .frame.low.make.bname.entry pack .frame.low.make.bname.button -side left pack .frame.low.make.bname.entry -side right frame .frame.low.make.ename button .frame.low.make.ename.button -text "Ending Color Name Range" \ -command {GetNamedColor "X" ecolor} -width 30 entry .frame.low.make.ename.entry -textvariable ecolor -width 12 \ -relief sunken addentry $low .frame.low.make.ename.entry pack .frame.low.make.ename.button -side left pack .frame.low.make.ename.entry -side right frame .frame.low.make.red -borderwidth 2 -relief sunken label .frame.low.make.red.label -text "RED" frame .frame.low.make.red.begin label .frame.low.make.red.begin.label -text "Begin" scale .frame.low.make.red.begin.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -activebackground red -highlightcolor red\ -command "set bred" pack .frame.low.make.red.begin.label -side left pack .frame.low.make.red.begin.scale -side right frame .frame.low.make.red.end label .frame.low.make.red.end.label -text "End" scale .frame.low.make.red.end.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -activebackground red -highlightcolor red\ -command "set ered" pack .frame.low.make.red.end.label -side left pack .frame.low.make.red.end.scale -side right pack .frame.low.make.red.label -side top -fill x pack .frame.low.make.red.begin -side top -fill x pack .frame.low.make.red.end -side top -fill x frame .frame.low.make.green -borderwidth 2 -relief sunken label .frame.low.make.green.label -text "GREEN" frame .frame.low.make.green.begin label .frame.low.make.green.begin.label -text "Begin" scale .frame.low.make.green.begin.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -activebackground green -highlightcolor green\ -command "set bgreen" pack .frame.low.make.green.begin.label -side left pack .frame.low.make.green.begin.scale -side right frame .frame.low.make.green.end label .frame.low.make.green.end.label -text "End" scale .frame.low.make.green.end.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -activebackground green -highlightcolor green\ -command "set egreen" pack .frame.low.make.green.end.label -side left pack .frame.low.make.green.end.scale -side right pack .frame.low.make.green.label -side top -fill x pack .frame.low.make.green.begin -side top -fill x pack .frame.low.make.green.end -side top -fill x frame .frame.low.make.blue -borderwidth 2 -relief sunken label .frame.low.make.blue.label -text "BLUE" frame .frame.low.make.blue.begin label .frame.low.make.blue.begin.label -text "Begin" scale .frame.low.make.blue.begin.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -activebackground blue -highlightcolor blue\ -command "set bblue" pack .frame.low.make.blue.begin.label -side left pack .frame.low.make.blue.begin.scale -side right frame .frame.low.make.blue.end label .frame.low.make.blue.end.label -text "End" scale .frame.low.make.blue.end.scale -from 0 -to 255 \ -length 512 -showvalue YES -orient horizontal \ -activebackground blue -highlightcolor blue\ -command "set eblue" pack .frame.low.make.blue.end.label -side left pack .frame.low.make.blue.end.scale -side right pack .frame.low.make.blue.label -side top -fill x pack .frame.low.make.blue.begin -side top -fill x pack .frame.low.make.blue.end -side top -fill x .frame.low.make.red.begin.scale set $bred .frame.low.make.red.end.scale set $ered .frame.low.make.green.begin.scale set $bgreen .frame.low.make.green.end.scale set $egreen .frame.low.make.blue.begin.scale set $bblue .frame.low.make.blue.end.scale set $eblue # # Default to selecting by name. # .frame.low.make.how.byname select pack .frame.low.make.bname -side top -fill x pack .frame.low.make.ename -side top -fill x pack forget .frame.low.make.red pack forget .frame.low.make.green pack forget .frame.low.make.blue # # Pack all the command widgets into the command frame # if {$level == "1"} { bindit $level pack append .frame \ .frame.low {top fill} } if {$level == 2} { bindit $level pack append .frame \ .frame.low {top fill} \ .frame.med {top fill} } if {$level == 3} { bindit $level pack append .frame \ .frame.low {top fill} \ .frame.med {top fill} \ .frame.hi {top fill} } frame .bottom -relief flat -borderwidth 2 button .bottom.ok -text OK -width 10 -command { # # Form the command. # if {$option == "REST"} { RunCommand "EU REST $enhance" } elseif {$option == "SAVE"} { RunCommand "EU SAVE $enhance" } elseif {$option == "MAKE"} { if {$how == "byname"} { RunCommand "EU MAKE $bgray $egray $bcolor $ecolor" } elseif {$how == "byval"} { RunCommand "EU MAKE $bgray $egray $bblue $eblue \ $bgreen $egreen $bred $ered" } } elseif {$option == "INTERACTIVE"} { InstructENH update RunCommand "ENH &" } elseif {$option == "RESET"} { RunCommand "EU" } } button .bottom.cancel -text Dismiss -width 10 -command {destroy .} pack .bottom.ok -side left -expand true -padx 10 pack .bottom.cancel -side right -expand true -padx 10 initStatus .bottom.status if [winfo exists .bottom.status] { pack .bottom.status -side left -expand true -padx 20 } # # Pack the message, the command and the OK buttons into the base widget # pack append . \ .top {top fill} \ .msg {top fill} \ .frame {top fill} \ .bottom {bottom fill} wm minsize . 10 10 proc mkHelp {} { global level messfont catch {destroy .help} toplevel .help wm title .help "Help - Change Image Colors" wm minsize .help 10 10 placehelp .help message .help.title -width 300 -font $messfont -text\ "Change Image Colors" text .help.low -relief flat -height 50 -width 60 .help.low insert 0.0 { Make make new color enhancement by replacing gray range with selected color names or intensities Restore restore saved color enhancement to current frame Save save current frame's color enhancement to named file Interactive interactively change color enhancement using mouse and arrow keys Reset reset color enhancement to standard grayscale enhancement Input Gray grayscale values to assign Range to output color range Select Named specify named colors for Color output color range Select Color specify red, green, and Intensities blue values for output color range Beginning Color named color to assign to Name Range the beginning gray range; active only when Make and Select Named Color are selected Ending Color named color to assign to Name Range the end of the gray range; active only when Make and Select Named Color are selected Enhancement name of file containing a File Name saved color enhancement; active only when Restore or Save is selected Additional options are available using the EU command from the McIDAS Text and Command Window. See the McIDAS-X User's Guide for more information. } button .help.ok -text " OK " -relief raised \ -borderwidth 2 -command {destroy .help} pack append .help \ .help.title {top } \ .help.low {top } \ .help.ok {bottom } } proc InstructENH {} { global messfont toplevel .instruct wm title .instruct "Image Color Table Editor" wm minsize .instruct 10 10 text .instruct.title -height 3 -width 25 -font $messfont .instruct.title insert 0.0 "\nImage Color Table Editor" text .instruct.low -relief flat -height 25 -width 40 .instruct.low insert 0.0 { To restore the color table to initial startup values, press l. To reset the color table to default values, press r. To exit the interactive editor, press q. Mouse Buttons left controls the red color curve middle controls the green color curve right controls the blue color curve Keypad left arrow shifts color curve left right arrow shifts color curve right up arrow expands color curve down arrow compresses color curve } button .instruct.ok -width 10 -text "OK" -relief raised -borderwidth 2 -command {destroy .instruct} pack append .instruct \ .instruct.title {top } \ .instruct.low {top } \ .instruct.ok {bottom} }