setheadermax
Purpose:
This program will reset the global maximum in the
header of a
16 bit file to increase the number of
significant figures retained if the file is loaded by an 8 bit
version of the AIR package.
The program will also identify the current header file type
(type 1,
type 2, or
type 3) and the current header
global maximum.
Usage:
setheadermaxfilename
[max]
- where the following definitions apply:
- filename
- name of the 16 bit header file to be reviewed or altered
(.hdr or .img optional)
- max
- the maximum 16 bit pixel value represented in the file
- NOTE:
- If no max is specified, the program will identify the current
file type and global maximum
- For type 1 16 bit files,
legal values for max range from 1 to 65535
- For type 2 16 bit files,
legal values for max range from 1 to 32767
- For type 3 16 bit files,
legal values for max range from -32767 to 32767
Examples:
setheadermax mri1
- Used without a maximum value, the program will indicate the
current file type and the current global maximum.
Type 1 files with global
maxima less than 32767 will always be misidentified as
type 2 files. As long as the
global maximum truly is less than 32767, this misidentification is
irrelevant because the binary representation of numbers between 0
and 32767 is identical for type 1 and type 2 files.
setheadermax mri1 18000
- This will set the header maximum value in file mri.hdr to
18000. When file mri1 is loaded by an 8 bit version of any AIR
program, the value 18000 will be mapped to an 8 bit pixel value of
255.
Comments:
- This program will only modify the header of
16 bit files
- You should never assign a global maximum in the header
that is smaller than the true global maximum of the file.
Doing so will result in values greater than the header global
maximum being mapped incorrectly to values less than the header
global maximum.
- It is possible to interconvert
type 1 and
type 2 files by changing
whether the global maximum is greater or less than 32767. This has
no effect on files with all values in the range 0 to 32767 (since
binary representation of both file types is identical in this
range). So long as you follow the rule of never assigning a global
maximum in the header that is smaller than the true global maximum
of the file, you should not be able to generate any errors.
- If your display package uses the header information, changing
the header maximum may alter the way that
type 2 and
type 3 files are displayed.
Specifically, lowering the global maximum may make all of the
pixels appear proportionately brighter.
- The only effect that changing the global maximum has with
regard to the AIR package is that is alters the way that
16 bit files are converted to 8 bit
internal representation. By correctly specifying the global
maximum, you can assure that you use the full range of available 8
bit values. Without rescaling to the true global maximum, you may
end up with a very restricted range of 8 bit voxel values.
Error messages: (alphabetical)
See also: Generic error messages
- ____ only modifies files with 16 bits/pixel...
- According to the header file
(.hdr file), the file that
you have specified does not have 16 bits/pixel.
- If the header file is wrong, use
scanheader to review its contents
and then makeaheader to generate
a corrected header.
- this file's type cannot be evaluated
- The file that you have specified has a header minimum less
than -32768, a header maximum greater than 65535, or the
difference between the header maximum and the minimum exceeds
65535.
- Use scanheader to review the
global maximum and minimum in the header.
- You should remake a corrected header using
makeaheader.
- Type 1 files cannot have negative maxima ...
- The header of the file specified is judged to be a
type 1 file based on a
current header global maximum of greater than 32767. You have
requested that the global maximum be set to a negative value.
Only type 3 files can have
negative header global maxima.
- If this is actually a type 3 file, you need to remake the
header using makeaheader. It is
a good idea to review the current values first using
scanheader.
- Type 2 files cannot have negative maxima ...
- The header of the file specified is judged to be a
type 2 file based on a
current header global minimum of greater than 0. You have
requested that the global maximum be set to a negative value.
Only type 3 files can have
negative header global maxima.
- If this is a type 3 file, you will need to remake the
header using makeaheader. It is
a good idea to review the current values first using
scanheader.
- Type 3 files cannot have maxima greater than 32767...
- The header of the file specified is judged to be a
type 3 file based on a current
header global minimum 0. You have requested that the global
maximum be set to a value greater than 32767 which is
accessible only to type 1
files).
- If this is a type 1 file, you will need to remake the
header using makeaheader. It is
a good idea to review the current values first using
scanheader.
- value ___ is out of range for all possible header types
- You have requested a header global maximum greater than
65535 which is inaccessible with 16
bit data.
- WARNING: You have converted a type 1 file to a type 2 file...
- Don't panic, as long as you have followed the rule about
not setting the header global maximum to a value less than the
true global maximum, you can ignore this warning. The header
maximum was previously greater than 32767 indicating that the
file must be type 1. Now
the header global maximum is less than 32768, indicating a
type 2 file. If the value
that you have given is truly the global maximum, then this
conversion will have no effect.
- If the true global maximum is greater than this value,
review the comments section and reset
the global maximum back to the correct value (if the correct
value is greater than 32767, you will get the next warning
message when you reset the value.
- WARNING: You have converted a type 2 file to a type 1 file...
- Unless you are deliberately trying to recover from a
previous incorrect use of this program, you probably will want
to undo what you just did. If the file really was a type 2 file
to start with, raising the header global maximum will result in
even fewer significant bits in your 8 bit representation than
you would have with a global maximum of 32767, so set it back
to this value or lower. As an additional incentive to set it
back, don't forget that any numbers that were previously
negative and therefore not defined and ignored have now become
huge (greater than 32767) positive numbers. Setting the value
back below 32767 will automatically evoke the preceding error
message.
See also:
Modified: December 11, 1996
© 1995-6 Roger P. Woods,
M.D.(rwoods@ucla.edu)