-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGSSI_PROGRAM.f90
81 lines (51 loc) · 1.95 KB
/
GSSI_PROGRAM.f90
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
Program GSSI_PROGRAM
IMPLICIT NONE
INTEGER, PARAMETER :: DISTANCE=3324
REAL, DIMENSION(4096,DISTANCE) :: B_SCAN_IMAGE
REAL, DIMENSION(4096,1) :: IMAGE_MEAN
REAL, DIMENSION(4096,DISTANCE) :: IMAGE_AFTER_REMOVE_BG
CALL remove_background(B_SCAN_IMAGE,IMAGE_AFTER_REMOVE_BG)
CALL mean_profile(B_SCAN_IMAGE, IMAGE_MEAN)
END PROGRAM
!the name of subroutine must be small letter!
SUBROUTINE remove_background(B_SCAN_IMAGE, IMAGE_AFTER_REMOVE_BG)
IMPLICIT NONE
INTEGER :: a,n
INTEGER, PARAMETER :: DISTANCE=3324
REAL, DIMENSION(4096,DISTANCE), INTENT(IN) :: B_SCAN_IMAGE
REAL, DIMENSION(4096,1) :: IMAGE_MEAN
REAL, DIMENSION(4096,DISTANCE), INTENT(OUT) :: IMAGE_AFTER_REMOVE_BG
!ROWS=4096
DO a=1, 4096
IMAGE_MEAN(a,1) = SUM(B_SCAN_IMAGE(a,:)) / REAL(SIZE(B_SCAN_IMAGE(a,:)))
IMAGE_AFTER_REMOVE_BG(a,:) = B_SCAN_IMAGE(a,:) - IMAGE_MEAN(a,1)
! PRINT*, IMAGE_MEAN(2)
END DO
n=500
! PRINT*, ""
! PRINT*, "******FORTRAN*******"
! PRINT*, "SUM(B_SCAN_IMAGE(",n,":))=",SUM(B_SCAN_IMAGE(n,:))
! PRINT*, "SIZE(B_SCAN_IMAGE(",n,":)=",REAL(SIZE(B_SCAN_IMAGE(n,:)))
! PRINT*, SUM(B_SCAN_IMAGE(n,:)) / REAL(SIZE(B_SCAN_IMAGE(n,:)))
! PRINT*, "IMAGE_MEAN(",n,")=",IMAGE_MEAN(n,1)
! PRINT*, "IMAGE_AFTER_REMOVE_BG(",n,")=",IMAGE_AFTER_REMOVE_BG(n,2)
! PRINT*, ""
END SUBROUTINE
!the name of subroutine must be small letter!
SUBROUTINE mean_profile(B_SCAN_IMAGE, IMAGE_MEAN)
IMPLICIT NONE
INTEGER :: a
INTEGER, PARAMETER :: DISTANCE=3324
REAL, DIMENSION(4096,DISTANCE), INTENT(IN) :: B_SCAN_IMAGE
REAL, DIMENSION(4096,1), INTENT(OUT) :: IMAGE_MEAN
!ROWS=4096
DO a=1, 4096
IMAGE_MEAN(a,1) = SUM(B_SCAN_IMAGE(a,:)) / SIZE(B_SCAN_IMAGE(a,:))
END DO
! PRINT*, "******FORTRAN*******"
!PRINT*, "SUM(B_SCAN_IMAGE(2,:))=",SUM(B_SCAN_IMAGE(2,:))
!PRINT*, "SIZE(B_SCAN_IMAGE(2,:)=",SIZE(B_SCAN_IMAGE(2,:))
! PRINT*, SUM(B_SCAN_IMAGE(500,:)) / SIZE(B_SCAN_IMAGE(500,:))
! PRINT*, "IMAGE_MEAN(500)=",IMAGE_MEAN(500,1)
!PRINT*, ""
END SUBROUTINE