~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/proc/shrink.prg

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
2
!
 
3
! MIDAS procedure shrink.prg for SHRINK/IMAGE
 
4
! K. Banse      970310
 
5
!
 
6
! use via SHRINK/IMAGE input output option
 
7
!     with option = minimum, maximum, mean, median, ...
 
8
!
 
9
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
10
!  
 
11
define/param p1 ? ima "Enter input image:"
 
12
define/param p2 ? ima "Enter output image:"
 
13
define/param p3 mean C "Enter option: "
 
14
define/maxpar 3
 
15
 
16
define/local dim/i/1/1 0
 
17
dim = m$value({p1},naxis)
 
18
if dim .eq. 2 then
 
19
   define/local area/c/1/6 row
 
20
else if dim .eq. 3 then
 
21
   define/local area/c/1/6 plane
 
22
else
 
23
   write/error 100
 
24
endif
 
25
define/local optio/c/1/2 sn
 
26
define/local statval/c/1/6 mean
 
27
define/local statname/c/1/12 "mean    "
 
28
 
29
branch p3(1:3) MIN,MAX,MED,MOM,MOD,STD,TOT MIN,MAX,MED,MOM,MOD,STD,TOT 
 
30
goto run_it                             !all local keyw. defaulted to Mean
 
31
 
32
MIN:
 
33
optio(1:1) = "m"
 
34
statval = "min "
 
35
statname = "minimum "
 
36
goto run_it
 
37
 
38
MAX:
 
39
optio(1:1) = "m"
 
40
statval = "max "
 
41
statname = "maximum "
 
42
goto run_it
 
43
 
44
MED:
 
45
optio(1:1) = "g"                        !get exact median
 
46
statval = "median"
 
47
statname = "median "
 
48
goto run_it
 
49
 
50
MOM:
 
51
optio(1:1) = "r"                        !get 3rd or 4th moment
 
52
if p3(4:4) .eq. "3" then
 
53
   statval = "mom3 "
 
54
   statname = "3. moment "
 
55
else
 
56
   statval = "mom4 "
 
57
   statname = "4. moment "
 
58
endif
 
59
goto run_it
 
60
 
61
MOD:
 
62
optio(1:1) = "f"                        !get 1st mode or mode
 
63
if p3(4:5) .eq. "E1" then
 
64
   statval = "mode1 "
 
65
   statname = "1. mode "
 
66
else
 
67
   statval = "mode "
 
68
   statname = "mode "
 
69
endif
 
70
goto run_it
 
71
 
72
STD:
 
73
optio(1:1) = "s"                        !get standard deviation
 
74
statval = "std"
 
75
statname = "std. dev. "
 
76
goto run_it
 
77
 
78
TOT:
 
79
optio(1:1) = "r"                        !get total intensity
 
80
statval = "tot"
 
81
statname = "tot. intens "
 
82
 
83
RUN_IT:
 
84
statistics/image {p1} {area} ? ? {optio} {p2},i,{statval}
 
85
 
86
write/out image `{p2}' with {statname} of {area}s "of input_image created"