[go: up one dir, main page]

Menu

[r34]: / common / read_cmx.f90  Maximize  Restore  History

Download this file

268 lines (252 with data), 6.1 kB

  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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
! for CIVx interaction , version civ1 & civ2
! Copyright (C) 1999,2010 Gauthier Delerce
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2, or (at your option)
! any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software Foundation,
! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
!
! Gauthier Delerce <gauthier@delerce.fr>
subroutine read_cmx
use modvsv
use modnetcdf
use modgrille
implicit none
integer::tmp1,tmp2
integer::sqm,q1,q2,pp,ha,de,pa,cd,rs,p4,p4d,ttt
character(120)::anul
character(5)::ch1,ch2
character(1)::char1
integer::i,j
real::f1,f2,ror
logical::back
if(verbose) Print*,'reading config file : ',trim(configfilename)
open(unit=9,file=configfilename,form='formatted',status='old',ACTION='READ',err=10 )
goto 20
10 print*,'Error while opening :',configfilename
stop
20 continue
read(9,'(a120)') anul
if(anul(1:1)/='#') then
stop
!no ########## CMX FILE
endif
!if(osname=='windows') then
! j=index(configfilename,'\',back=.true.)
!else
j=index(configfilename,'/',back=.true.)
!endif
!print*,'tmp root:',configfilename(1:j)
read(9,'(a120)') anul
if(index(anul,'/')==0) then
namea=configfilename(1:j)//trim(anul(12:120))
else
namea=trim(anul(12:120))
endif
print*,'Image 1: ',trim(namea)
!i=index(namea,'.png')
i=index(namea,' ')
img1=namea(i-1:i-1)
read(9,'(a120)') anul
if(index(anul,'/')==0) then
nameb=configfilename(1:j)//trim(anul(11:120))
else
nameb=trim(anul(11:120))
endif
!i=index(nameb,'.png')
i=index(nameb,' ')
print*,i
if(i>1) img2=nameb(i-1:i-1)
!XX
read(9,'(a120)') anul
!Mask
read(9,'(a120)') anul
yorn=anul(6:6)
!Maskname
!read(9,'(a120)') anul
read(9,'(a120)') anul
if(index(anul,'/')==0) then
maskname=configfilename(1:j)//trim(anul(10:120))
else
maskname=trim(anul(10:120))
endif
if(verbose) print*,'Maskname: ',trim(maskname)
!ImageSize
read(9,'(a120)') anul
call extract_char_real_real(anul,f1,f2)
nx=int(f1)
ny=int(f2)
!call extract_char_int_int(anul,nx,ny)
!CorrelationBoxesSize 21 21
read(9,'(a120)') anul
call extract_char_real_real(anul,f1,f2)
ibsx=int(f1)
ibsy=int(f2)
!call extract_char_int_int(anul,ibsx,ibsy)
!SearchBoxeSize 31 31
read(9,'(a120)') anul
call extract_char_real_real(anul,f1,f2)
isrx=int(f1)
isry=int(f2)
!call extract_char_int_int(anul,isrx,isry)
!RO 1
read(9,'(a120)') anul
print*,"roia",anul
call char2real(anul,ror)
roi=ror
!roi=1.0
print*,'Ro= ',roi
!GridSpacing 12 12
read(9,'(a120)') anul
!print*,anul
call extract_char_real_real(anul,f1,f2)
dxshift=int(f1)
dyshift=int(f2)
!call extract_char_int_int(anul,dxshift,dyshift)
!print*,dxshift,dyshift
!XX 1.0
read(9,'(a120)') anul
!print*,anul
!Dt_TO 2.6666799 5.399607
read(9,'(a120)') anul
!print*,anul
call extract_char_real_real(anul,dt,T0)
T02=T0
dt2=dt
!print*,'dt',dt
!PixCmXY 4.150000 4.150000
read(9,'(a120)') anul
call extract_char_real_real(anul(8:120),pixcmx,pixcmy)
!XX 1
!print*,'pixcm',pixcmx,pixcmy
read(9,'(a120)') anul
!ShiftXY 0 0
read(9,'(a120)') anul
!print*,anul
call extract_char_real_real(anul,f1,f2)
xoffset=int(f1)
yoffset=-int(f2)
!call extract_char_int_int(anul,xoffset,yoffset)
!print*,'offset',xoffset,yoffset
!Grid n
read(9,'(a120)') anul
!print*,'Grid answer',anul(1:10)
if(anul(6:6)=='n') then
print*,'creating default grid...'
read(9,'(a120)') fgrille
new_default=.true.
!print*,0
call defaultmesh
!print*,0.5
goto 30
endif
read(9,'(a120)') anul
print*,"grid name::",anul
if(index(anul,'/')==0) then
fgrille=configfilename(1:j)//anul(10:120)
else
fgrille=anul(10:120)
endif
print*,"grid name::",fgrille
call defaultmesh
30 continue
!print*,1
!XX 85
read(9,'(a120)') anul
!XX 1.0
read(9,'(a120)') anul
!XX 1.0
read(9,'(a120)') anul
!Hart 1
read(9,'(a120)') anul
!print*,'CVTSI TEST',anul
!write(hart,'(i4)') anul
!#call cvtsi(anul(6:6),hart)
!print*,hart
!pause
!DecimalShift 0
call char2int(anul,hart)
read(9,'(a120)') anul
call char2int(anul,cd)
if(cd==0) then
corrdec=.false.
else
corrdec=.true.
endif
!Deformation 0
read(9,'(a120)') anul
call char2int(anul,de)
if(de==0) then
deform=.false.
else
deform=.true.
endif
!CorrelationMin 0
read(9,'(a120)') anul
call char2int(anul,correlation_min)
if(correlation_min/=0) print*,'CORRELATION MINIMAL SET TO: ',correlation_min
!IntensityMin 0
read(9,'(a120)') anul
call char2int(anul,intensity_min)
if(nx==768) intensity_min=intensity_min*2.55
if(nx==1024) intensity_min=intensity_min*40.95
if(intensity_min/=0) print*,'INTENSITY MINIMAL SET TO: ',intensity_min
!SeuilImage n
read(9,'(a120)') anul
char1=anul(12:12)
!SeuilImageValues 0 4096
read(9,'(a120)') anul
if(char1=='y') then
call extract_char_real_real(anul,f1,f2)
level1=int(f1)
level2=int(f2)
!call extract_char_int_int(anul,level1,level2)
Print*,'SEUILLAGE ACTIF ENTRE ',level1,' ET ',level2
else
level1=0;level2=0;test_seuil=.false.
endif
!ImageToUse a c
read(9,'(a120)') anul
img1=anul(12:12)
img2=anul(14:14)
!ImageUsedBefore null null
read(9,'(a120)') oldNC
uvmat=.false.
if(index(oldNC,'/')==0) then
img3=oldNC(17:17)
img4=oldNC(19:19)
! print*,"img 3 4",img3,img4
else
uvmat=.true.
endif
if((ibsx/2*2)==ibsx) then
if(verbose) Print*,' Ibsx is even, Ibsx->Ibsx-1 '
ibsx=ibsx-1
endif
if((ibsy/2*2)==ibsy) then
if(verbose) Print*,' Ibsy is even, Ibsy->Ibsy-1 '
ibsy=ibsy-1
endif
if((isrx/2*2)==isrx) then
if (verbose) Print*,' Isrx is even, Isrx->Isrx-1 '
isrx=isrx-1
endif
if((isry/2*2)==isry) then
if (verbose) Print*,' Isry is even, Isry->Isry-1 '
isry=isry-1
endif
!print*,ibsx,ibsy,isrx,isry
if(intensity_min/=0) print*,' INTENSITY MINIMAL SET TO: ',intensity_min
ratio=1
hole=.false.
return
end