expboxgen

PURPOSE ^

EXPBOXGEN - creates a domain outline box for a tiff image

SYNOPSIS ^

function expboxgen(x0,y0,nx,ny,parameter_filename,box_filename)

DESCRIPTION ^

EXPBOXGEN -  creates a domain outline box for a tiff image

   This function creates a domain outline box for a .tif image for the 
   mosaic tiff. 
   x0,y0 and x1,y1 are the cropping coordinates (upper left and lower right 
   corners in the larger tiff image).
   paramter_filename is the parameter file name for the mosaic tiff image.
   box_filename is self explanatory.

   Usage:
      expboxgen(x0,y0,nx,ny,parameter_filename,box_filename)

   See also EXPMASTER, EXPDOC

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function expboxgen(x0,y0,nx,ny,parameter_filename,box_filename)
0002 %EXPBOXGEN -  creates a domain outline box for a tiff image
0003 %
0004 %   This function creates a domain outline box for a .tif image for the
0005 %   mosaic tiff.
0006 %   x0,y0 and x1,y1 are the cropping coordinates (upper left and lower right
0007 %   corners in the larger tiff image).
0008 %   paramter_filename is the parameter file name for the mosaic tiff image.
0009 %   box_filename is self explanatory.
0010 %
0011 %   Usage:
0012 %      expboxgen(x0,y0,nx,ny,parameter_filename,box_filename)
0013 %
0014 %   See also EXPMASTER, EXPDOC
0015 
0016 %initialize
0017 nrows=-1;
0018 ncols=-1;
0019 X0=-1;
0020 Y0=-1;
0021 posting=-1;
0022 
0023 %first recover necessary information from the paramter_filename.
0024 fid=fopen(parameter_filename,'r');
0025 count=1;
0026 while(1),
0027 tline=fgetl(fid);
0028 if ~isstr(tline), break; end;
0029 
0030 ind=findstr('ant125m',tline);
0031 if ~isempty(ind),
0032 a=strsplit(tline,' ');
0033 a=a(2); a=char(a); a=a(1:length(a)-1);
0034 posting=str2num(a);
0035 end
0036 
0037 
0038 ind=findstr('no. of rows   :',tline);
0039 if ~isempty(ind),
0040 a=strsplit(tline,' ');
0041 nrows=str2num(char(a(length(a))));
0042 end
0043 
0044 ind=findstr('no. of columns:',tline);
0045 if ~isempty(ind),
0046 a=strsplit(tline,' ');
0047 ncols=str2num(char(a(length(a))));
0048 end
0049 
0050 ind=findstr('Upper Left X:',tline);
0051 if ~isempty(ind),
0052 a=strsplit(tline,' ');
0053 X0=str2num(char(a(length(a))));
0054 end
0055 
0056 ind=findstr('Upper Left Y:',tline);
0057 if ~isempty(ind),
0058 a=strsplit(tline,' ');
0059 Y0=str2num(char(a(length(a))));
0060 end
0061 
0062 
0063 end %while(1),
0064 
0065 
0066 fclose(fid);
0067 
0068 if (X0==-1 | Y0==-1 | nrows==-1  | ncols==-1 | posting==-1),
0069 disp(' ');
0070 disp(['Could not recover all parameters from ' parameter_filename]);
0071 disp('Here are the paramters recovered thus far: ');
0072 disp(['no. of rows: ' num2str(nrows)]);
0073 disp(['no. of columns: ' num2str(ncols)]);
0074 disp(['Upper Left X: ' num2str(X0)]);
0075 disp(['Upper Left Y: ' num2str(Y0)]);
0076 disp(['Posting: ' num2str(posting)]);
0077 end
0078 
0079 disp(' ');
0080 disp(['Recovered the following parameters from ' parameter_filename]);
0081 disp(['no. of rows: ' num2str(nrows)]);
0082 disp(['no. of columns: ' num2str(ncols)]);
0083 disp(['Upper Left X: ' num2str(X0)]);
0084 disp(['Upper Left Y: ' num2str(Y0)]);
0085 disp(['Posting: ' num2str(posting)]);
0086 
0087 %Create X,Y, arrays of coordinates:
0088 X(1)=X0+x0*posting
0089 Y(1)=Y0-y0*posting
0090 X(2)=X(1);
0091 Y(2)=Y(1)-ny*posting;
0092 X(3)=X(1)+nx*posting;
0093 Y(3)=Y(2);
0094 Y(4)=Y(1);
0095 X(4)=X(3);
0096 plot(X,Y,'r*');
0097 
0098 %Create box exp file using X and Y. Loop it.
0099 expgen(box_filename,X,Y,1);

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003