;
;   TIM - DEMO        0.4    DFRD
;
;****************************************************
#include helpdefs.h

parms
 int windisplay
 file timdemo
 int hmode
endparms
int choice
int autorun = 0
int err

on error goto ermsg

repeat          ;repeat ... until
if autorun == 0
 cls
 print @8 @i "      <<TIM>> DEMO          FREE RUNNING DEMO'S           " @n @r
 print @8 "To the previous menu  . . . . . . . . . . . . . . . . .0", @r
 print @8 "HOLO       - (pre)processing a hologram image . . . . .1"
 print @8 "PARTS      - classifying electronic components  . . . .2"
 print @8 "RNOISE     - removing shot noise from an image. . . . .3"
 print @8 "LABEL      - sorting objects. . . . . . . . . . . . . .4"
 print @8 "SWITCH     - performing good/bad tests. . . . . . . . .5"
 print @8 "FILL       - filling up holes in objects. . . . . . . .6"
 print @8 "DISTORT    - geometrical distortion using general i.p. 7"
 print @8 "MAZE       - find a path through the maze . . . . . .  8"
 print @8 "DISTRANS   - application of distance transforms . . .  9"
 print @8 "AUTORUN    - run all demo's continuously . . . . . . .10" @r
 ;print @8 "INTERFERO  - analysis of interferograms . . . . . . . 11"
 ;print @8 "LABEL256   - labeling more than 256 objects . . . . . 13", @r   
 choice = "        Enter your choice . . . . . . . . . . . . . . . . .   "
else
  choice = ((choice % 10) + 1)
endif

 cls
 zoom 0
 /init
 dest p
; *windispl h (windisplay+1)
; *windispl i (windisplay+1)

 switch choice
   case 1
       copy holo a
       help timdemo DfrdHolo, hmode
       *dholo windisplay timdemo hmode
 
   case 2
     copy parts a
       help timdemo DfrdParts, hmode
       *dparts  windisplay

   case 3
    dest a
    cstr miss
    help timdemo DfrdRnoise, hmode
    *rnoise   windisplay
 
   case 4
     copy cermet a
       help timdemo DfrdLabel, hmode
       *label2  windisplay

   case 5
       copy bswitch
       help timdemo DfrdSwitch, hmode
       *switchd  windisplay
       *switch1  windisplay

   case 6
     help timdemo DfrdFill, hmode
     *dfill
	 /selut 4
     *dfill1  windisplay
     call waitres
     *dfill2  windisplay
 
   case 7
     copy miss a
       help timdemo DfrdDistort, hmode
       *distort   windisplay
       call waitres
       *dspaak windisplay
 
   case 8
     *dmaze windisplay timdemo DfrdMaze hmode

   case 9
     copy muntsq a
        help timdemo DfrdDistrans, hmode
        *dcoins   windisplay
   case 10
     autorun = 1
 endsw
 call waitres
until choice == 0

stop

ermsg:
  beep
  seterror "\nImage not found."
  wait
stop


waitres:
  if (choice > 0) && (choice < 10)
    if autorun == 0
       pause
       print @z
    else
       wait 5
    endif
  endif
  return

     
