Help for MAXMIN
PURPOSE:
MAXMIN is a VICAR program which finds and prints the minimum and
maximum DN values in an image. It optionally returns these values
in TCL variables.
EXECUTION
MAXMIN supports two and three dimensional VICAR images and all valid
VICAR data types. For complex data, MAXMIN finds the values of minimum
and maximum magnitude (Fortran CABS function) and reports these values
as REAL*4 values. MAXMIN supports all valid VICAR file organizations
(BSQ,BIL,BIP).
MAXMIN prints the location in (line,sample) format for both the minimum
and maximum location. The band number is also printed if the number
of bands is greater than 1. If the minimum or maximum value occur
more than once, the location of the first occurrence will be printed.
The execution time of MAXMIN can be reduced by specifying a LINC parameter
value greater than 1. In this case, only one out of every LINC lines
in the image is examined. This may produce acceptable results if the image
data is fairly continuous and if an approximate minimum and maximum are
acceptable.
An EXCLUDE value can be specified to exclude a particular value in the
search for the minimum and maximum.
TAE COMMAND LINE FORMAT
The following command line formats show the major allowable forms:
maxmin INP=a
maxmin INP=a SIZE=(sl,ss,nl,ns)
maxmin INP=a SIZE=(sl,ss,nl,ns) BANDS=(sb,nb)
maxmin a (sl,ss,nl,ns) (sb,nb) opt. parameters MINIVAL=var1 MAXIVAL=var2
Here 'a' represents the input image file name,
and 'var1' and 'var2' represent TCL variables of type real
in which the minimum and maximum values are returned.
EXAMPLES
1. maxmin INP=A BANDS=(5,2) MINIVAL=MINVALA MAXIVAL=MAXVALA EXCLUDE=0
In this example MAXMIN finds the minimum and maximum values (excluding 0)
for the portion of image A contained in bands 5 and 6.
These values are returned in the TCL variables MINVALA, MAXVALA.
2. The following example show how to convert a double precision
image to byte format using appropriate scaling obtained from
MAXMIN output. Program CFORM will map the minimum value to 0
and the maximum value to 255.
procedure
refgbl $echo
LOCAL minvar REAL
LOCAL maxvar REAL
body
let _onfail="continue"
let $echo="yes"
gen a 10 10 'REAL8
maxmin a MINIVAL=minvar MAXIVAL=maxvar
putmsg "Stretch this image to byte format" ""
cform a b 'BYTE IRANGE=(&minvar, &maxvar) ORANGE=(0, 255)
end-proc
3. The following example show how to get a histogram of a REAL*4
image using as histogram limits the minimum and maximum obtained from
MAXMIN output. Program HIST is used to generate the histogram.
procedure
refgbl $echo
LOCAL minvar REAL
LOCAL maxvar REAL
body
let _onfail="continue"
let $echo="yes"
gen a 10 10 ival=-100 sinc= 5500 'REAL
maxmin a MINIVAL=minvar MAXIVAL=maxvar
hist a limits=(&minvar, &maxvar)
end-proc
RESTRICTIONS
1. The maximum number of bytes per line is 65536.
WRITTEN BY: Steve Pohorsky 15 April 1988
COGNIZANT PROGRAMMER: Steve Pohorsky 15 April 1988
PORTED TO UNIX: Steve Pohorsky
REVISION HISTORY
1993-01-08 S. Pohorsky Made portable for UNIX.
2010-12-04 R.J. Bambery Modifications for 64bit Linux
2012-07-06 R.J. Bambery Removed some debugging Print statements
PARAMETERS:
INP
Input file name
SIZE
Window into input
BANDS
Window into input
in band dimension
SL
Starting line
= size(1)
SS
Starting sample
= size(2)
SB
Starting band
= bands(1)
NL
Number of lines
= size(3)
NS
Number of samples
= size(4)
NB
Number of bands
= bands(2)
LINC
Increment for skipping lines.
EXCLUDE
Value to exclude in search for
minimum and maximum.
MINIVAL
Output TCL variable : min. value
MAXIVAL
Output TCL variable : max. value
MAXLINE
Output TCL variable : line
location of 1st occurrence of max
MAXSAMP
Output TCL variable : samp
location of 1st occurence of max
MINLINE
Output TCL variable : line
location of 1st occurence of min
MINSAMP
Output TCL variable : samp i
location of 1st occurence of min
See Examples:
Cognizant Programmer: