home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / misc / sci / lynx / rexx / sigma.imrx < prev    next >
Encoding:
Text File  |  1995-05-29  |  1.8 KB  |  105 lines

  1. /* Suppression du bruit par la methode de la variance minimum :
  2.    determiner k tel que sigma2(image-k.bruit) minimum, kE[0,1] */
  3.  
  4. SIGNAL on ERROR
  5. SIGNAL on SYNTAX
  6. SIGNAL on BREAK_C
  7.  
  8. ADDRESS 'Lynx'
  9. options results
  10. kkmin = 0.05
  11. kkmax = 0.5
  12. step = 0.025
  13.  
  14. say "kmin ?"
  15. pull kkmin
  16. say "kmax ?"
  17. pull kkmax
  18. say "step ?"
  19. pull step
  20.  
  21. MaskStatus var masque
  22. Mask ON
  23.  
  24. CurrentImageName var nom
  25.  
  26. do k=kkmin to kkmax by step
  27.    SelectImage 'Bruit'
  28.    Mult k
  29.    drop knoise
  30.    AddrCurrentImage var knoise
  31.    SelectImage nom
  32.    Subimage knoise
  33.    drop image_bruit
  34.    AddrCurrentImage var image_bruit
  35.    drop ecart
  36.    Sigma var ecart
  37.    DeleteBuffer knoise
  38.    DeleteBuffer image_bruit
  39.    say "k : " k ",sigma :" ecart
  40.    if k=kkmin then
  41.    do
  42.        kmin = k
  43.        sigmamin = ecart
  44.    end
  45.    if ecart < sigmamin then
  46.    do
  47.        kmin = k
  48.        sigmamin = ecart
  49.        say "* k : " k ",sigma :" ecart
  50.    end
  51. end
  52.  
  53. Mask OFF   
  54.  
  55. SelectImage 'Bruit'             
  56. Mult kmin                          
  57. drop knoise
  58. AddrCurrentImage var knoise
  59. SelectImage nom                 
  60. Subimage knoise                 
  61. drop image_bruit
  62. AddrCurrentImage var image_bruit
  63. DeleteBuffer knoise
  64.  
  65. Mask masque
  66.  
  67. LynxEnd
  68.  
  69. exit
  70.  
  71. /* Gestion des erreurs */
  72.  
  73. ERROR:
  74.   Select
  75.    when RC = 3 then say "*** Error" RC" on line "SIGL": Process Failed"
  76.    when RC = 2 then say "*** Error" RC" on line "SIGL": Invalid entries" 
  77.    when RC = 1 then say "*** Error" RC" on line "SIGL": No image !"
  78.    otherwise say "*** Error "RC" on line "SIGL
  79.   end
  80.  
  81.   say "--> "SourceLine(SIGL)
  82.   say
  83.   say 'Press [RETURN]'
  84.   pull
  85.   LynxEnd
  86.   exit
  87.  
  88. SYNTAX:
  89.   say "*** Syntax error (Code "RC") on line" SIGL
  90.   say "--> "SourceLine(SIGL)
  91.   say
  92.   say 'Press [RETURN]'
  93.   pull
  94.   LynxEnd
  95.   exit
  96.  
  97. BREAK_C:
  98.   say "User Abort"
  99.   say "--> "SourceLine(SIGL)
  100.   say
  101.   say "Press [RETURN]"
  102.   pull
  103.   LynxEnd
  104.   exit
  105.