View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Conversion from real to short pixel types

Frank Valdes wrote on Mar 05, 1999

Q:  I've been using imcombine to combine images which I wish to keep "short"
but have been using non-integer image scalings. I have set outtype=short
and the resulting image is short. However, it appears that I have double
number of pixels with value 0 than expected when I plot with imhist. 
Is this because imcombine rounds everything between -1.00 and 1.00 to 0 or 
is it something with the settings I've used with imcombine? 



A:  IMCOMBINE does not do anything sophisticated when converting the
results of a real operation (things like scaling, etc are done in real)
to output short pixels.  All it does is use a computer integer
truncation.  All IRAF tasks would do the same thing including
CHPIXTYPE.  This means positive values are truncated down and negative
pixels are truncated "up".  No one has ever asked about this before but
what you report is true; that a histogram of a short conversion of an
image will show more values in the zero bin.  You are not doing anything
wrong with IMCOMBINE.  However, it is obvious how you could work around
this by biasing the data.  Or you could output a real result and then
use the command

cl> imexpr "nint(a)" outimage inimage outtype=s

where outimage is the desired short image and inimage is the real image.
You would then delete inimage to recover the diskspace.

Last post on Mar 05, 1999