SIMG 726-972 Syllabus

Computing for Imaging Science (SIMG-726) Rolando V. Raqueo 1 Friday, February 28, 2020 Gift Quiz - Who is RTM? What did his father do? Rolando V. Raqueo 2

Friday, February 28, 2020 Syllabus after Holiday Break Class #6 - Today Widget Programming Review Assignment #2 (Check Website for details) Combine Assignment #1 into Assignment #2 Create a widget program that will read in a PGM file that will display the image statistics of a user defined rectangular region. Pay particular attention to non-interactive interface Program the one-dimensional and two-dimensional special functions Rect and Gaus

Rolando V. Raqueo 3 Friday, February 28, 2020 Syllabus Class #7 Widget Programming Event Handlers Rolando V. Raqueo 4

Friday, February 28, 2020 Syllabus Class #8 Assignment #1 Due Shell Programming UNIX Quotes Making UNIX commands of IDL Programs

Mystery Image Techniques QUIZ Topics dd, od, strings, which, wc Rolando V. Raqueo 5 Friday, February 28, 2020 Syllabus Class #9 Debugging in IDL

More Widget Examples Rolando V. Raqueo 6 Friday, February 28, 2020 Syllabus Class #10 Special Function Implementation Midterm Exam Review Quiz

Rolando V. Raqueo 7 Friday, February 28, 2020 Syllabus Class #11 Midterm Exam (Take home 1 week to do) Image Processing Implementations Rolando V. Raqueo 8

Friday, February 28, 2020 Syllabus Class #12 Image Processing Implementations AWK, SED, and Makefiles Quiz Rolando V. Raqueo 9 Friday, February 28, 2020

Syllabus Class #13 Final Project Updates IDL Pointers Rolando V. Raqueo 10 Friday, February 28, 2020 Syllabus Class #14 Assignment #2 Due Modal Widgets

Rolando V. Raqueo 11 Friday, February 28, 2020 Syllabus Class #15 3D Graphics Concepts Rolando V. Raqueo 12

Friday, February 28, 2020 Syllabus Class #16 More 3D Graphics Rolando V. Raqueo 13 Friday, February 28, 2020 Syllabus Class #17 Open Class Time for Project Consulting

Rolando V. Raqueo 14 Friday, February 28, 2020 Syllabus Class #18 Project Presentation Session #1 Rolando V. Raqueo 15

Friday, February 28, 2020 Syllabus Class #19 Project Presentation Session #2 Final Project Submissions Due Rolando V. Raqueo 16 Friday, February 28, 2020 Widget Events

Rolando V. Raqueo 17 Friday, February 28, 2020 Widget Event A widget event is basically a reaction to some form of user input Mouse clicks, drags, and movement Keyboard input Button push An widget event generates a structure which identifies the widget that caused the event

and other relevant information. Rolando V. Raqueo 18 Friday, February 28, 2020 IDL Event Structure All IDL Events will generate a named structure that is guaranteed to have the following A structure name The ID of the widget that generated the event The ID of the base to which the above widget belongs

The ID of the widget with which an event handler is associated. 19 Rolando V. Raqueo Friday, February 28, 2020 Event Handler Special Processing functions (Event Handlers) capture and appropriately interpret those events. single button program beep when pressed.

First, need to create and destroy a widget by creating a Quit Button Rolando V. Raqueo 20 Friday, February 28, 2020 Create the Quit Button Widget pro quit_button base=Widget_Base(column=1,title=Quit Button) button = Widget_Button( base, value=Quit ) Widget_Control, base, /realize end

Rolando V. Raqueo 21 Friday, February 28, 2020 Quit Button Widget Event Handler Method #1 pro quit_button_event, event Widget_Control, event.top, /destroy end

pro quit_button base=Widget_Base(column=1,title=Quit Button) button = Widget_Button( base, value=Quit) Widget_Control, base, /realize Xmanager, quit_button', base, event_handler=quit_button_event' end Rolando V. Raqueo 22 Friday, February 28, 2020 Quit Button Widget Event Handler Method #2

pro quitter, event Widget_Control, event.top, /destroy end pro quit_button_event, event end pro quit_button base=Widget_Base(column=1,title=Quit Button) button=Widget_Button(base, value=Quit, event_pro=quitter ) Widget_Control, base, /realize Xmanager, quit_button', base,event_handler=quit_button_e end Rolando V. Raqueo

23 Friday, February 28, 2020 Button Widget Example For the sake of presentation space, we will not be including the quit button in the following code. You should, however, include it so that you can gracefully get rid of the widgets. Rolando V. Raqueo

24 Friday, February 28, 2020 Create the Button Widget pro beeper base=Widget_Base(column=1, title="Beep" ) button=Widget_Button(base,value="Press Here") Widget_Control, base, /realize end Rolando V. Raqueo 25

Friday, February 28, 2020 Button Widget Event Handler pro beeper_event, event print,"Beep",string(7B) end pro beeper base=Widget_Base( column=1, title="Beep" ) button=Widget_Button(base,value="Press Here") Widget_Control, base, /realize Xmanager, 'beeper', base, event_handler='beeper_event' end Rolando V. Raqueo

26 Friday, February 28, 2020 If Your Widget Program Crashes First type IDL> RETALL Followed by IDL> XMANAGER You may then edit and recompile as necessary

Rolando V. Raqueo 27 Friday, February 28, 2020 Analyzing the Beep Event Handler You can strategically put help and print commands in beep_event and beep to study the values of the variables and the resulting structures. When pressed, the word Beep should print out in the IDL command window.

Rolando V. Raqueo 28 Friday, February 28, 2020 Beep Counter Let us modify the event handler to count the number of times we depressed the button during a session An initial solution might be the following Rolando V. Raqueo 29

Friday, February 28, 2020 Wrong Beep Counter pro beeper_event, event count = count + 1 print,Beeped , count, Times end pro beeper base=Widget_Base(column=1, title="Beep") button=Widget_Button(base,value="Press Here") Widget_Control, base, /realize Xmanager, 'beeper', base, event_handler='beeper_event' end

Rolando V. Raqueo 30 Friday, February 28, 2020 It Does Not Work Because... The scope of most of the variables (e.g. count) are local to each of the routines. We need a mechanism to maintain, pass, and keep variables persistent across events and routines. This can be done using the uvalue of a given widget as in the following.

Rolando V. Raqueo 31 Friday, February 28, 2020 Working Beep Counter pro beeper_event, event Widget_Control,event.id,get_uvalue=count count = count + 1 print,"Beeped ", count, " Times" Widget_Control,event.id,set_uvalue=count end

pro beeper base = Widget_Base( column=1, title="Beep" ) button = Widget_Button( base, value="Press Here" ) Widget_Control, base, /realize Widget_Control,button,set_uvalue=0 Xmanager, 'beeper', base, event_handler='beeper_event' end Rolando V. Raqueo 32 Friday, February 28, 2020

An Improved Beep Counter pro beeper_event, event Widget_Control, event.id, get_uvalue=count count = count + 1 Widget_Control, event.id, set_uvalue=count Widget_Control, event.id, set_value=string(count) end pro beeper base = Widget_Base( column=1, title="Beep" ) button = Widget_Button( base, value="Press Here" ) Widget_Control, base, /realize

Widget_Control, button, set_uvalue=0 Xmanager, 'beeper', base, event_handler='beeper_event' end Rolando V. Raqueo 33 Friday, February 28, 2020 Beep Counter Controlling a Text Widget pro beeper_event, Widget_Control, count = count +

Widget_Control, event event.id, get_uvalue=count 1 event.id, set_uvalue=count Widget_Control, event.top, get_uvalue=widget_id Widget_Control, widget_id, set_value=string(count) end pro beeper base = Widget_Base( column=1, title="Beep" ) button = Widget_Button( base, value="Press Here" ) text = Widget_Text( base )

Widget_Control, base, /realize Widget_Control, base, set_uvalue=text Widget_Control, button, set_uvalue=0 Xmanager, 'beeper', base, event_handler='beeper_event' end Rolando V. Raqueo 34 Friday, February 28, 2020 Beeper Counter using Text Widget

In this situation, we use the uvalue of the base widget as a container to hold the ID of the text widget. We can now access this information from any widget that is contained in this base through the event.top field Rolando V. Raqueo 35 Friday, February 28, 2020 Slider Multiply Example Create two floating sliders and multiply

the values and deposit this in a text widget. Make the floating point widgets editable Rolando V. Raqueo 36 Friday, February 28, 2020 Slider Multiply Widget Definition pro fslider_multiply base=Widget_Base(column=1) fslider1 = CW_Fslider(base,/edit)

fslider2 = CW_Fslider( base,/edit ) text= Widget_Text( base ) Widget_Control, base, /realize widget_ids = { slider1:fslider1, slider2:fslider2, text:text } Widget_Control, base, set_uvalue=widget_ids end Rolando V. Raqueo 37 Friday, February 28, 2020 Slider Multiply Event Handler Definition

pro fslider_multiply base=Widget_Base(column=1) fslider1 = CW_Fslider(base,/edit) fslider2 = CW_Fslider( base,/edit ) text= Widget_Text( base ) Widget_Control, base, /realize widget_ids = { slider1:fslider1, slider2:fslider2, text:text } Widget_Control, base, set_uvalue=widget_ids Xmanager, 'fslider_multiply', base, event_handler='fslider_multiply_event' end Rolando V. Raqueo

38 Friday, February 28, 2020 Slider Multiply Event Handler Definition pro fslider_multiply_event, event Widget_Control, event.top, get_uvalue=widgets slider1 = widgets.slider1 slider2 = widgets.slider2 text = widgets.text Widget_Control, slider1, get_value=slider1_value Widget_Control, slider2, get_value=slider2_value answer= slider1_value * slider2_value Widget_Control, text, set_value=string(answer)

end Rolando V. Raqueo 39 Friday, February 28, 2020 Another Widget Example Rolando V. Raqueo 40 Friday, February 28, 2020

Display PGM Widget Program Illustrates the use of the pickfile function Shows how to create a draw widget for image display Shows how to access the draw widget and display the image Rolando V. Raqueo 41 Friday, February 28, 2020 Components of

Display PGM Widget read_pgm procedure pickfile function size function wset procedure tv procedure widget_control procedure widget_draw function xmanager procedure Rolando V. Raqueo 42 Friday, February 28, 2020

Display PGM Widget Definition pro simple_image_display base = Widget_Base( column=1 ) button1=Widget_Button(base,value='Display PGM Image') window1 = Widget_Draw(base, xsize=256, ysize=256 ) Widget_Control, window1, /realize Widget_Control, window1, get_value=window_id Widget_Control, base, set_uvalue=window_id Xmanager, 'simple_image_display', base, Event_handler='simple_image_display_event' end Rolando V. Raqueo

43 Friday, February 28, 2020 Display PGM Widget Rolando V. Raqueo 44 Friday, February 28, 2020 Widget Event Handler pro simple_image_display_event, event widget_control, event.id, get_value=widget_value

case widget_value of 'Display PGM Image' : begin image1_file = pickfile() read_ppm, image1_file, image1_data image_size = size( image1_data ) x_size = image_size( 1 ) & y_size=image_size(2) widget_control, event.top, get_uvalue=window_id wset, window_id & tv,image1_data end ELSE: endcase end Rolando V. Raqueo

45 Friday, February 28, 2020 Pickfile Dialog Box Rolando V. Raqueo 46 Friday, February 28, 2020 Resulting Widget Image Display

Rolando V. Raqueo 47 Friday, February 28, 2020 Summary Quit Button Beep Counter Slider Multiply

PGM Display Rolando V. Raqueo 48 Friday, February 28, 2020

Recently Viewed Presentations

  • Social-Emotional Foundations for Early Learning (SEFEL ...

    Social-Emotional Foundations for Early Learning (SEFEL ...

    Describe the levels of the pyramid . Talk about how Day 1 will address the two bottom tiers: Positive relationships and Supportive Environments, Day 2 will address Teaching Strategies (Add some research information for administrators; how does SEFE support PBIS...
  • PDHymns

    PDHymns

    He looks down from heaven, sees us shine, You in your small corner, and I in mine. 1-2 Words by Anna B. Warner / Music by E. O. Excel Jesus Bids Us Shine 2-2 Jesus bids us shine, then, for...
  • Some Thoughts on e-business - WordPress.com

    Some Thoughts on e-business - WordPress.com

    Salah satu kelebihan FB yang kini digandrungi adalah BlogIt, Aplikasi Blogging di Facebook. Bagi para Facebook mania dan kebetulan juga adalah blogger (entah negatif atau postif) :), produsen TypePad dan Moveable Type, yaitu Six Apart, telah menyediakan aplikasi baru untuk...
  • PowerPoint Presentation

    PowerPoint Presentation

    George Camp, South Carolina, Stew Cleave, Oregon, Rufus Coburn, Austin, Hal . Kritzman, Southern New England, Bob Stevenson, Michigan. In recent years, George Camp and Stew Cleave were replaced by Mike Mueller of Austin and Terry Sturgeon of Victoria. Our...
  • Introduction to Procurement for Public Housing Authorities

    Introduction to Procurement for Public Housing Authorities

    Unit 4 Introduction to Procurement for Public Housing Authorities Small Purchase Procedures Learning Objectives Understand when to use small purchase procedures Understand the basic process and requirements for small purchases Understand basic requirements for micropurchases * Small Purchase Procedures Used...
  • Chain of Survival and EMSC

    Chain of Survival and EMSC

    Cirrhosis of the liver, cataracts, and mental retardation * In what ways can you provide parental support and education? * Discuss the pathophysiology regarding the parent's age and this disorder. Occurs in 9 of 10,000 live births and may increase...
  • Multichannel Nanoreporters for the Oilfield

    Multichannel Nanoreporters for the Oilfield

    Multichannel Nanoreporters for the Oilfield. Chih-Chau "Garry" Hwang,1 Lu Wang,2Gedeng "Gordon" Ruan,1. Zachary Schaefer,3 Wei Lu,1. Michael S.Wong,1,3 Amy T. Kan,2 Mason B. Tomson,2 James M. Tour1. 1Department of Chemistry. 2Department of Civil and Environmental Engineering . 3Department of Chemical...
  • Slide 1

    Slide 1

    joint work with AwsAlbarghouthi and Marsha Chechik from University of Toronto