! Read parameters using xml file , 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@civx.org>
subroutine read_calxml(filename,cc,cp,list)
! use libxml2f90 library, http://sourceforge.net/projects/libxml2f90/
! developped by alexander.poddey@tu-clausthal.de
use libxml2f90_interface_module
use libxml2f90_module
use libxml2f90_strings_module
use ll_module
use calibration
implicit none
integer::list
type(ccT)::cc
type(cpT)::cp
integer::i
real(8)::r8(1)
character(256)::filename
real(8),parameter::PI= 3.14159265358979323846264338327950288419716939937511
print*,"read_xml",trim(adjustl(filename))
if(list==1) then
call libxml2f90__readin_file(trim(adjustl(filename)),'LIST1')
call libxml2f90__ll_selectlist('LIST1')
else
call libxml2f90__readin_file(trim(adjustl(filename)),'LIST2')
call libxml2f90__ll_selectlist('LIST2')
endif
call libxml2f90__ll_selecttag('ACT','ImaDoc',1)
call libxml2f90__ll_exist('DOWN','GeometryCalib',i)
if(i.lt.1) then
print*,'GeometryCalib'
stop'read_input'
end if
call libxml2f90__ll_selecttag('DOWN','GeometryCalib',1) !the 1 at the end means select the first tag
call libxml2f90__ll_exist('DOWN','focal',i)
call libxml2f90__ll_selecttag('DOWN','focal',1) !the 1 at the end means
call libxml2f90__ll_getr8('focal',size(r8),r8)
cc%f=r8(1)
print*,"focal",cc%f
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','kappa1',i)
call libxml2f90__ll_selecttag('DOWN','kappa1',1) !the 1 at the end means
call libxml2f90__ll_getr8('kappa1',size(r8),r8)
cc%kappa1=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Tx',i)
call libxml2f90__ll_selecttag('DOWN','Tx',1) !the 1 at the end means
call libxml2f90__ll_getr8('Tx',size(r8),r8)
cc%Tx=r8(1)*10.
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Ty',i)
call libxml2f90__ll_selecttag('DOWN','Ty',1) !the 1 at the end means
call libxml2f90__ll_getr8('Ty',size(r8),r8)
cc%Ty=r8(1)*10.
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Tz',i)
call libxml2f90__ll_selecttag('DOWN','Tz',1) !the 1 at the end means
call libxml2f90__ll_getr8('Tz',size(r8),r8)
cc%Tz=r8(1)*10.
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Rx',i)
call libxml2f90__ll_selecttag('DOWN','Rx',1) !the 1 at the end means
call libxml2f90__ll_getr8('Rx',size(r8),r8)
cc%Rx=r8(1)/180*PI
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Ry',i)
call libxml2f90__ll_selecttag('DOWN','Ry',1) !the 1 at the end means
call libxml2f90__ll_getr8('Ry',size(r8),r8)
cc%Ry=r8(1)/180.*PI
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Rz',i)
call libxml2f90__ll_selecttag('DOWN','Rz',1) !the 1 at the end means
call libxml2f90__ll_getr8('Rz',size(r8),r8)
cc%Rz=r8(1)/180.*PI
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r1',i)
call libxml2f90__ll_selecttag('DOWN','r1',1) !the 1 at the end means
call libxml2f90__ll_getr8('r1',size(r8),r8)
cc%r1=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r2',i)
call libxml2f90__ll_selecttag('DOWN','r2',1) !the 1 at the end means
call libxml2f90__ll_getr8('r2',size(r8),r8)
cc%r2=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r3',i)
call libxml2f90__ll_selecttag('DOWN','r3',1) !the 1 at the end means
call libxml2f90__ll_getr8('r3',size(r8),r8)
cc%r3=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r4',i)
call libxml2f90__ll_selecttag('DOWN','r4',1) !the 1 at the end means
call libxml2f90__ll_getr8('r4',size(r8),r8)
cc%r4=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r5',i)
call libxml2f90__ll_selecttag('DOWN','r5',1) !the 1 at the end means
call libxml2f90__ll_getr8('r5',size(r8),r8)
cc%r5=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r6',i)
call libxml2f90__ll_selecttag('DOWN','r6',1) !the 1 at the end means
call libxml2f90__ll_getr8('r6',size(r8),r8)
cc%r6=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r7',i)
call libxml2f90__ll_selecttag('DOWN','r7',1) !the 1 at the end means
call libxml2f90__ll_getr8('r7',size(r8),r8)
cc%r7=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r8',i)
call libxml2f90__ll_selecttag('DOWN','r8',1) !the 1 at the end means
call libxml2f90__ll_getr8('r8',size(r8),r8)
cc%r8=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','r9',i)
call libxml2f90__ll_selecttag('DOWN','r9',1) !the 1 at the end means
call libxml2f90__ll_getr8('r9',size(r8),r8)
cc%r9=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Cx',i)
call libxml2f90__ll_selecttag('DOWN','Cx',1) !the 1 at the end means
call libxml2f90__ll_getr8('Cx',size(r8),r8)
cp%Cx=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Cy',i)
call libxml2f90__ll_selecttag('DOWN','Cy',1) !the 1 at the end means
call libxml2f90__ll_getr8('Cy',size(r8),r8)
cp%Cy=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Ncx',i)
call libxml2f90__ll_selecttag('DOWN','Ncx',1) !the 1 at the end means
call libxml2f90__ll_getr8('Ncx',size(r8),r8)
cp%Ncx=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Nfx',i)
call libxml2f90__ll_selecttag('DOWN','Nfx',1) !the 1 at the end means
call libxml2f90__ll_getr8('Nfx',size(r8),r8)
cp%Nfx=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','Nfy',i)
if(i>0)then
call libxml2f90__ll_selecttag('DOWN','Nfy',1) !the 1 at the end means
call libxml2f90__ll_getr8('Nfy',size(r8),r8)
cp%Nfy=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
endif
call libxml2f90__ll_exist('DOWN','dx',i)
call libxml2f90__ll_selecttag('DOWN','dx',1) !the 1 at the end means
call libxml2f90__ll_getr8('dx',size(r8),r8)
cp%dx=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','dy',i)
call libxml2f90__ll_selecttag('DOWN','dy',1) !the 1 at the end means
call libxml2f90__ll_getr8('dy',size(r8),r8)
cp%dy=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','dpx',i)
call libxml2f90__ll_selecttag('DOWN','dpx',1) !the 1 at the end means
call libxml2f90__ll_getr8('dpx',size(r8),r8)
cp%dpx=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','dpy',i)
call libxml2f90__ll_selecttag('DOWN','dpy',1) !the 1 at the end means
call libxml2f90__ll_getr8('dpy',size(r8),r8)
cp%dpy=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','sx',i)
call libxml2f90__ll_selecttag('DOWN','sx',1) !the 1 at the end means
call libxml2f90__ll_getr8('sx',size(r8),r8)
cp%sx=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','p1',i)
call libxml2f90__ll_selecttag('DOWN','p1',1) !the 1 at the end means
call libxml2f90__ll_getr8('p1',size(r8),r8)
cc%p1=r8(1)
call libxml2f90__ll_selecttag('UP','GeometryCalib',1)
call libxml2f90__ll_exist('DOWN','p2',i)
call libxml2f90__ll_selecttag('DOWN','p2',1) !the 1 at the end means
call libxml2f90__ll_getr8('p2',size(r8),r8)
cc%p2=r8(1)
!call libxml2f90__ll_getstring('image1',size(string),string) !OLD
! namea=trim(adjustl(string(1)))
! print*,trim(adjustl("Image1:"//namea))
!call libxml2f90__ll_selecttag('UP','civ1',1)
!call libxml2f90__ll_exist('DOWN','image2',i)
!if(i.lt.1) then
! print*,'Name of second image must be given'
! stop'read_input'
!end if
!call libxml2f90__ll_selecttag('DOWN','image2',1)
!call libxml2f90__ll_getstring('image2',size(string),string)
!nameb=trim(adjustl(string(1)))
! print*,trim(adjustl("Image2:"//nameb))
call libxml2f90__closeall()
print*,'End of read_xml'
return
end