module OW_image
!
! Imaging Condition -- crosscorrelation
!

implicit none

contains

subroutine owimage(ws,wr,image,GG) 

integer					:: ish, ihso, ixw
complex					:: GG,wr,ws,image

do ish=1,img%sh%n
   ihso=floor(((ish-1)*img%sh%d+img%sh%o)/(img%xm%d))
   do ixw=1,kxm%n
      if (ixw-ihso < 1 .or. ixw-ihso > kxm%n .or. ixw+ihso < 1 .or. ixw+ihso > kxm%n) then
      else
          GG(iz,ish,ixw,inode+1)=GG(iz,ish,ixw,inode+1)+conjg(ws(ixw-ihso))*(wr(ixw+ihso))             ! correlation to image
      end if
   end do
end do

end subroutine

end module
