Take me to pcigeomatics.com

PCI Geomatics Help Center

How can we help you today?

mul_subset

PCI Geomatics -

!----------------------------------------------------------------------------! 
!----------------------------------------------------------------------------! 
!                                                                            !
!       	Multiple File Subset Script [mul_subset.eas]                 !
!                                                                            !
!                                                                            !
!	This script was originally written for a user who wanted             !
!       to have all of the fiducial marks and details removed from           !
!       their air photos.                                                    !
!                                                                            !
!                                                                            !
!  This script assumes that all the input files will all be located          !
!  within a given directory, all the files will be of the same format        !
!  with three channels and that the output directory does not contain        !
!  any files.                                                                !
!                                                                            !
!----------------------------------------------------------------------------! 
!----------------------------------------------------------------------------! 

!---------------------------------------------------------------------------- 
! Define variables
!---------------------------------------------------------------------------- 
 
 !for input  and output directory
  local string in_files, out_files
 
 !for directory listing of the input directories
  local mstring dirlist

 !for the file format and extension types
  local string type, ext  
 
 !file names
  local string bn, fn
   
 !Parameters for the subset window 
  local integer x, y, width, height  
  
  local integer i  
  local $Z
  
  local string confirm  


!---------------------------------------------------------------------------- 
! Clear the EASI window and then show the header information 
!---------------------------------------------------------------------------- 

  PRINT @(1 ,1,CLREOS)
  print "-------------------------------------------------------------------"
  print @reverse,"                         Multiple Subset                           ",@alloff
  print ""
  print "This script assumes that all the input files will all be located"
  print "within a given directory, the files will be of the same format,"
  print "have three image channels, will be clipped to the same extents and"
  print "that the output directory will not contain any files."
  print ""
  print "-------------------------------------------------------------------"

!---------------------------------------------------------------------------- 
! Collect input from user
!---------------------------------------------------------------------------- 

  print ""
  print "Enter the directory that contains the input files:"
  input ">" in_files
  print ""
  print "Enter the directory for the output files:"
  input ">" out_files
  print ""
  print "Enter the file format of the files (3-letter file extension) : "
  input ">" type
  print ""
  print "Enter the X coordinate for the dbiw parameter : "
  input ">" x
  print ""
  print "Enter the Y coordinate for the dbiw parameter : "
  input ">" y
  print ""
  print "Enter the width for the dbiw parameter : "
  input ">" width
  print ""
  print "Enter the height for the dbiw parameter : "
  input ">" height
  print ""
  PRINT @(1 ,1,CLREOS)

!---------------------------------------------------------------------------- 
! Confirm with user to ensure that the parameters are correct
! If they are correct then continue with the script and if they are not
! then run the script over again.
!---------------------------------------------------------------------------- 

  print "-----------------------------------------------------------------------------"
  print ""
  print "The input directory you specified was:"
  print "	", in_files
  print ""
  print "The output directory you specified was:"
  print "	", out_files
  print ""
  print "The file format you specified was:"
  print "	", type
  print ""
  print "The initial coordinate of the clip you specified was:"
  print "	", x, " ", y
  print ""
  print "Your image size you specified was:"
  print "	",  width, " ", height
    print ""
  print "-----------------------------------------------------------------------------"
  print "Are these parameters correct? (Y/N)"
  print ""
  input ">" confirm

  if (confirm ~= "y" or confirm ~= "Y" ) then

	!------------------------------------------------------------------- 
	! Get the contents of the directory
	!------------------------------------------------------------------- 

	dirlist = getdirectory(in_files)
	let $Z = "\

	for i = 1 to f$len(dirlist)

	!------------------------------------------------------------------- 
	! Extract parts of the filenames
	!------------------------------------------------------------------- 

	 fn = in_files + $Z + dirlist[i]
	 ext = getfileextension(fn)
	 bn = getfilebasename(fn)

	 if (ext ~= type) then

	  print ""
	  print "Clipping:", bn, ".", ext
	  print ""
	
	!------------------------------------------------------------------- 
	! Set up the parameters and execute the FEXPORT command   
	!------------------------------------------------------------------- 

	  fili = in_files + $Z + dirlist[i]
	  filo = out_files + $Z + bn +"_clipped"
	  dbiw = x, y, width, height
	  dbic = 1,2,3
	  dbib =
	  dbvs = 
	  dblut = 
	  dbpct =
	  ftype = type
	  foptions = 

	  R Fexport
	  PRINT @(1 ,1,CLREOS)

	  
	 endif
	endfor
	

  else 
    run "mul_subset.eas
  endif

  PRINT @(1 ,1,CLREOS)
  print "-------------------------------------------------------------------"

  print ""
  print "The clipped files are stored in the following directory:"
  print "	", out_files	
  print ""
  print ""
  print @reverse,"                  Multiple Subset EASI Script Finished              ",@alloff
  print ""
  print "-------------------------------------------------------------------"

return

!---------------------------------------------------------------------------- 
!---------------------------------------------------------------------------- 
Have more questions? Submit a request

Comments

Powered by Zendesk