Index: trunk/Ohana/src/libfits/matrix/F_uncompress_data.c
===================================================================
--- trunk/Ohana/src/libfits/matrix/F_uncompress_data.c	(revision 18271)
+++ trunk/Ohana/src/libfits/matrix/F_uncompress_data.c	(revision 18272)
@@ -6,4 +6,6 @@
 int fits_rcomp(int a[], int nx,	unsigned char *c, int clen, int nblock);
 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock);
+int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock);
+int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock);
 
 /* functions defined in fits_hcompress.c */
@@ -60,11 +62,33 @@
     // fprintf (stderr, "%d comp bytes; %d uncomp 'pixels', totals: %d %d\n", Nzdata, Npix, Ninsum, Noutsum);
 
-    // rice decompression from the CFITSIO source tree : we need to tell it the expected number of pixels
-    // is also REQUIRES 4byte output, which is fairly stupid.
-    if (fits_rdecomp ((unsigned char *) zdata, Nzdata, (unsigned int *) outdata, Npix, blocksize)) {
-      fprintf (stderr, "error in rice decompression\n");
-      return (FALSE);
+    switch (out_pixsize) {
+      case 4:
+	// rice decompression from the CFITSIO source tree : we need to tell it the expected number of pixels
+	// is also REQUIRES 4byte output, which is fairly stupid.
+	if (fits_rdecomp ((unsigned char *) zdata, Nzdata, (unsigned int *) outdata, Npix, blocksize)) {
+	  fprintf (stderr, "error in rice decompression\n");
+	  return (FALSE);
+	}
+	return (TRUE);
+
+      case 2:
+	if (fits_rdecomp_short ((unsigned char *) zdata, Nzdata, (unsigned short *) outdata, Npix, blocksize)) {
+	  fprintf (stderr, "error in rice decompression\n");
+	  return (FALSE);
+	}
+	return (TRUE);
+
+      case 1:
+	if (fits_rdecomp_byte ((unsigned char *) zdata, Nzdata, (unsigned char *) outdata, Npix, blocksize)) {
+	  fprintf (stderr, "error in rice decompression\n");
+	  return (FALSE);
+	}
+	return (TRUE);
+	
+      default:
+	fprintf (stderr, "invalid output pixel size %d\n", out_pixsize);
+	return (FALSE);
     }
-    return (TRUE);
+    
   }
   
