forked from avikhlinin/wvdecomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smallutil.f
83 lines (69 loc) · 1.87 KB
/
smallutil.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
c-------------------------------------------------------
subroutine image_sigma (x,n,sigma)
implicit none
integer n
real x(n),sigma
integer i
real mean,disp
mean=0.0
disp=0.0
do i=1,n
mean=mean+x(i)
disp=disp+x(i)**2
enddo
mean=mean/n
sigma=sqrt(disp/n-mean**2)
return
end
cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
function if_min (img,nx,ny,i0,j0)
implicit none
logical if_min
integer nx,ny,i0,j0
real img(nx,ny),im0
im0=img(i0,j0)
if_min=
~ (im0.le.img(i0+1,j0)) .and.
~ (im0.le.img(i0-1,j0)) .and.
~ (im0.le.img(i0,j0+1)) .and.
~ (im0.le.img(i0+1,j0+1)) .and.
~ (im0.le.img(i0-1,j0+1)) .and.
~ (im0.le.img(i0-1,j0-1)) .and.
~ (im0.le.img(i0+1,j0-1)) .and.
~ (im0.le.img(i0,j0-1))
return
end
cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
subroutine make_rwvmax_mask (mask,nx,ny,xpeak,ypeak,npeak,r)
implicit none
integer nx,ny
integer mask(nx,ny)
integer npeak
integer xpeak(npeak), ypeak(npeak)
real r
integer idistance,i,j,imin,imax,jmin,jmax,ipeak
integer ir,x,y,ir1
do i=1,nx
do j=1,ny
mask(i,j)=0
enddo
enddo
ir = int(r**2)+1
ir1 = int(r)+1
do ipeak = 1, npeak
x = xpeak(ipeak)
y = ypeak(ipeak)
imin = min(max(x-ir,1),nx)
imax = max(min(x+ir,nx),1)
jmin = min(max(y-ir,1),ny)
jmax = max(min(y+ir,ny),1)
do i=imin,imax
do j=jmin,jmax
if (idistance(x,y,i,j).le.ir) then
mask(i,j)=1
endif
enddo
enddo
enddo
return
end