home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / softsys / khoros / 3155 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.6 KB  |  49 lines

  1. Newsgroups: comp.soft-sys.khoros
  2. Path: sparky!uunet!usc!elroy.jpl.nasa.gov!henry!mathew
  3. From: mathew@elroy.Jpl.Nasa.Gov (Mathew Yeates)
  4. Subject: Re: Unsigned Image Data
  5. Message-ID: <mathew.725703211@henry>
  6. Sender: news@elroy.jpl.nasa.gov (Usenet)
  7. Nntp-Posting-Host: henry.jpl.nasa.gov
  8. Organization: Image Analysis Systems Group, JPL
  9. References: <42334@pprg.eece.unm.edu.pprg.unm.edu> <mathew.725698131@henry>
  10. Date: Wed, 30 Dec 1992 08:13:31 GMT
  11. Lines: 36
  12.  
  13. mathew@elroy.Jpl.Nasa.Gov (Mathew Yeates) writes:
  14.  
  15.  
  16. >Is there a khoros function for handling unsigned integers?
  17. >i.e. 8, 16, and 32 bit integer pixels.
  18. >For example, one CCD system I have produces 16 bit unsigned
  19. >pixels in a FITS file format. The fits2viff conversion program
  20. >doesn't like 16 bit FITS files, so I tried raw2viff which treats
  21. >the data as 16 bit signed values.
  22. >Robert A. Nolan a.k.a. nolan@kane.rpsmaui.com
  23.  
  24. Optionally, you can figure out how to convert from one representation
  25. to another. Im on a Sun Sparc and to convert the number to its
  26. correct unsigned value, I add 2^16 = 65536 to all negative pixels.
  27. So the following takes a raw unsigned short data file and converts
  28. to a VIFF int file.
  29.  
  30. ---------------------------ushort2int---------------------------------
  31.  
  32. #!/bin/sh
  33. #usage: kscript filename rows cols
  34. #creates: filename.viff
  35.  
  36. #first convert to int file
  37. raw2viff -i $1 -r $2 -c $3 -t short -o -|\
  38. vconvert -i - -o /tmp/ushort2int.tmp -s 1.0 -t int
  39.  
  40. #offset only negative pixels
  41. vclip -i /tmp/ushort2int.tmp -l -2e15 -u 0 -o -| \
  42. voffset -i /tmp/ushort2int.tmp -o $1.viff -m - -x 65536
  43.  
  44. rm -f /tmp/ushort2int.tmp
  45. -------------------------------------------------------------------
  46.  
  47. Mathew
  48.  
  49.