! rd_i12 read images in raw format and determine if it''s 8 or 12 bits coded
! 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 rd_i12_only(filename,in,m,ierr)
!****************************************************
! PORTABILITY PROBLEMS
! UNIX AND WINDOWS SYNTAXES USED ARE NOT COMPATIBLES
! SPEED UP , CHECK 16 BITS PLEASE
!****************************************************
implicit none
integer::m
!integer(2),dimension(m)::img2
!integer,dimension(m)::image,image2
!integer(4),dimension(m)::img
integer::ierr,i,j,bpp,seed,inde
byte,dimension(2*m)::in
character(64)::filename
!real::rnunf
!external rnunf
inde=scan(filename,' ')
inde=inde-1
!image=0.
!image2=0.
!bpp=1
ierr=0
print*,'Opening ',filename
open(unit=10,file=filename,access='direct',recl=m,form='unformatted',status='unknown',err=10)
goto 20
10 ierr=1
write(*,*) 'Error reading image'
return
20 continue
print*, 'Reading image ',filename(1:inde)
read(10,rec=1,err=10) in(1:m)
read(10,rec=2,err=11) in(m+1:2*m)
goto 21
11 print*,'problems during read operation'
21 continue
return
end