CFITSIO Changelog

What's new in CFITSIO 3.33

Mar 7, 2013
  • Modified the imcomp_decompress_tile routine to ignore any numerical overflows that might occur when using Hcompress to decompress the image. If Hcompress is used in its 'lossy' mode, the uncompressed image pixel values may slightly exceed the range of an integer*2 variable. This is generally of no consequence, so we can safely ignore any overflows in this case and just clip the values to the legal range.
  • The default tiling pattern when writing a tile-compressed image has been changed. The old behaviour was to compress the whole image as one single large tile. This is often not optimal when dealing with large images, so the new default behavior is to treat each row of the image as one tile. This is the same default behavior as in the standalone fpack program. The default tile size can be overridden by calling fits_set_tile_dim.
  • Fixed bug bug that resulted in a corrupted output FITS image when attempting to write a float or double array of values to a tile-compressed integer data type image. CFITSIO does not support implicit data type conversion in this case and now correctly returns an appropriate error status.
  • Modified ricecomp.c to define the nonzero_count lookup table as an external variable, rather then dynamically allocating it within the 3 routines that use it. This simplifies the code and eliminates the need for special thread locking and unlocking statements.
  • Modifed how the uncompressed size of a gzipped file is computed in the mem_compress_open routine in drvrmem.c. Since gzip only uses 4 bytes in the compressed file header to store the original file size, one may need to apply a modulo 2^32 byte correction in some cases. The logic here was modified to allow for corner cases (e.g., very small files, and when running on 32-bit platforms that do not support files larger than 2^31 bytes in size).
  • Added new public routine to construct a 80 keyword record from the 3 input component strings, i.e, the keyword name string, the value string, and the comment string: fits_make_key/ffmkky. (This was already an undocumented internal routine in previous versions of CFITSIO).
  • Modified ffc2s so that if the input keyword value string is a null string, then it will return a VALUE_UNDEFINED (204) status value. This makes it consistent with the behavior when attempting to read a null keyword which has no value) as a logical or as a number (which also returns the 204 error). This should only affect cases where the header keyword does not have an equal sign followed by a space character in columns 9 and 10 of the header record.
  • Changed the "char *" parameter declarations to "const char *" in many of the routines (mainly the routines that modify or update keywords) to avoid compiler warnings or errors from C++ programs that tend to be more rigorous about using "const char *" when appropriate.
  • Added support for caching uncompressed image tiles, so that the tile does not need to be uncompressed again if the application program wants to read more data from the same tile. This required changes to the main FITS file structure that is defined in fitsio.h, as well as changes to imcompress.c.
  • Enhanced the previous modification to drvrfile.c to handle additional user cases when running in the HEASARC's Hera environment.

New in CFITSIO 3.29 (Mar 14, 2012)

  • Enhancements:
  • modified Makefile.in to allow configure to override the lib and include
  • destination directories.
  • added (or restored actually) support for tile compression of 1-byte integer
  • images in imcomp_compress_tile. Support for that data type was overlooked
  • during recent updates to this routine.
  • modified the fits_get_token command-line parsing routine to perform more
  • rigorous checks to determine if the token can be interpreted as a number
  • or not. made small modification to fpack.c to not allow the -i2f option (convert image from integer to floating point) with the "-g -q 0" option (do lossless gzip compression). It is more efficient to simply use the -g option alone. made modifications to fitsio.h and drvrfile.c to support reading and
  • writing large FITS files (> 2.1 GB) when building CFITSIO using Microsoft Visual C++ on Windows platforms.
  • added new WCS routine (ffgicsa) which returns the WCS keyword values for a particular WCS version ('A' - 'Z').
  • Bug Fixes:
  • fixed a problem with multi-threaded apps that open/close FITS files
  • simultaneously by putting mutex locks around the call to
  • fits_already_open and in fits_clear_Fptr.
  • fixed a bug when using the 'regfilter' function to select a subset of the
  • rows in a FITS table that have coordinates that lie within a specified
  • spatial region on the sky. This bug only affects the rarely used panda
  • (and epanda and bpanda) region shapes in which the region is defined by
  • the intersection of an annulus and a pie-shaped wedge. The previous code
  • (starting with version 3.181 of CFITSIO where support for the panda region
  • was first introduced) only worked correctly if the 2 angles that define
  • the wedge have values between -180 and +180. If not, then fewer rows than
  • expected may have been selected from the table.
  • fixed the extended filename parser so that when creating a histogram by
  • binning 2 table columns, if a keyword or column name is given as the
  • weighting factor, then the output histrogram image will have a floating
  • point datatype, not the default integer datatype as is the case when no
  • weigth is specified (e.g. with a filename like "myfile.fits[bin x,y; weight_column]"
  • added fix to the code in imcompress.c to work around a problem with
  • dereferencing the value of a pointer, in cases where the address of that pointer has not been defined (e.g., the nulval variable).
  • modified the byte shuffling algorithm in fits_shuffle_8bytes to work
  • around a strange bug in the proprietary SunStudioExpress C compiler under OpenSolaris.
  • removed spurious messages on the CFITSIO error stack when opening a
  • FITS file with FTP (in drvrnet.c);

New in CFITSIO 3.28 (Mar 14, 2012)

  • added an enhancement to the tiled-image compression method when compressing
  • floating-point image using the standard (lossy) quantization method. In
  • cases where an image tile cannot be quantized, The floating-point pixel values
  • will be losslessly compressed with gzip before writing them to the tile-
  • compressed file. Previously, the uncompressed pixel values would have
  • been written to the file, which obviously requires more disk space.
  • made significant internal changes to the structure of the tile compression
  • and uncompression routines in imcompress.c to make them more modular and
  • easier to maintain.
  • modified configure.in and configure to force it to build a Universal
  • binary on Mac OS X.
  • modified the ffiter function in putcol.c to properly clean up allocated
  • memory if an error occurs.
  • in quantize.c, when searching for the min and max values in a float array,
  • initialize the max value to -FLT_MAX instead of FLT_MIN (and similarly for double array).

New in CFITSIO 3.27 (Mar 14, 2012)

  • Enhancements:
  • added new routines fits_read_str and fits_delete_str which read or
  • delete, respectively, a header keyword record that contains a specified
  • character string.
  • added a new routine called fits_free_memory which frees the memory that fits_read_key_longstr allocated for the long string keyword value. enhanced the ffmkky routine in fitscore.c to not put a space before the equals sign when writing long string-valued keywords using the ESO
  • HIERARCH keyword convension, if that extra character is needed to fit the length of the keyword name + value string within the 80-character
  • FITS keyword record.
  • made small change to fits_translate_keyword to support translation of blank keywords (where the name = 8 blank chracters) modified fpack so that it uses the minimum of the 2nd, 3rd, and 5th order MAD noise values when quantizing and compressing a floating point image.
  • This is more conservative than just using the 3rd order MAD value alone.
  • added new routine imcomp_copy_prime2img to imcompress.c that is used by
  • funpack to copy any keywords that may have been added to the primary array of the compressed image file (a null image) back into the header of
  • the uncompressed image.
  • enhanced the fits_quantize_float and fits_quantize_double routines in
  • quantize.c to also compress the tile if it is completely filled with null values. Previously, this type of tile would have been written
  • to the output compressed image without any compression.
  • enhanced imcomp_decompress_tile to support implicit datatype conversion
  • when reading a losslessly compressed (with gzip) real*4 image into an array of real*8 values. in imcompress.c, removed possible attempt to free memory that had not been allocated.

New in CFITSIO 3.26 (Mar 14, 2012)

  • Enhancements:
  • defined 2 new macros in fitsio.h: #define CFITSIO_MAJOR 3 #define CFITSIO_MINOR 26 These may be used within other macros to detect the CFITSIO version number at compile time. - modified group.c to initialize the output URL to a null string in fits_url2relurl. Also added more robust tests to see if 2 file pointers point to the same file.
  • enhanced the template keyword parsing code in grparser.c to support the 'D' exponent character in the ASCII representation of floating point keyword values (as in TVAL = 1.23D03). Previously, the parser would have writen this keyword with a string value (TVAL = '1.23D03').
  • modified the low-level routines that write a keyword record to a FITS header so that they silently replace any illegal characters (ASCII values less than 32 or greater than 126) with an ASCII space character. Previously, these routines would have returned with an error when encountering these illegal characters in the keyword record (most commonly tab, carriage return, and line feed characters).
  • made substantial internal changes to imcompress.c in preparation for possible future support for compression methods for FITS tables analogous to the tiled image compression method.
  • replaced all the source code in CFITSIO that was distributed under the GNU General Public License with freely available code. In particular, the gzip file compression and uncompression code was replaced by the zlib compression library. Thus, beginning with this version 3.26 of CFITSIO, other software applications may freely use CFITSIO without necessarily incurring any GNU licensing requirement. See the License.txt file for the CFITSIO licensing requirements.
  • added support for using cfitsio in different 'locales' which use a comma, not a period, as the decimal point character in ASCII representation of a floating point number (e.g., France). This affects how floating point keyword values and floating point numbers in ASCII tables are read and written with the 'printf' and 'strtod' functions.
  • added a new utility routine called fits_copy_rows/ffcprw that copies a specified range of rows from one table to another.
  • enhanced the test for illegal ASCII characters in a header (fftrec) to print out the name of the offending character (e.g TAB or Line Feed) as well as the Hex value of the chracter. - modified ffgtbc (in fitscore.c) to support nonstandard vector variable length array columns in binary tables (e.g. with TFORMn = 2000PE(500)'). - modified the configure file to add "-lm" when linking CFITSIO on Solaris machines. - added new routine, fits_get_inttype, to parse an integer keyword value string and return the minimum integer datatype (TBYTE, TSHORT, TLONG, TLONGLONG) required to store the integer value.
  • added new routine, fits_convert_hdr2str, which is similar to fits_hdr2str except that if the input HDU is a tile compressed image (stored in a binary table) then it will first convert that header back to that of a normal uncompressed FITS image before concatenating the header keyword records.
  • modified the file template reading routine (ngp_line_from_file in grparser.c) so that it ignores any carriage return characters (\r) in the line, that might be present, e.g. if the file was created on a Windows machine that uses \r\n as end of line characters.
  • modified the ffoptplt routine in cfileio.c to check if the PCOUNT keyword in the template file has a non-zero value, and if so, resets it to zero in the newly created file.
  • Bug Fixes:
  • fixed a bug when updating the value of the CRPIXn world coordinate system keywords when extracting a subimage from larger FITS image, using the extended CFITSIO syntax (e.g. myimage[1:500:2, 1:500:2]). This bug only affects casee where the pixel increment value is not equal to 1, and caused the coordinate grid to be shifted by between 0.25 pixels (in the case of a pixel increment of 2) and 0.5 pixels (for large pixel increment values).
  • fixed a potential string buffer overflow error in the ffmkls routine that modifies the value and comment strings in a keyword that uses the HEASARC long string keyword convention.
  • fixed a bug in imcompress.c that could cause programs to abort on 64-bit machines when using gzip to tile-compress images. Changed the declaration of clen in imcomp_compress_tile from int to size_t.

New in CFITSIO 3.25 (Mar 14, 2012)

  • fixed typo in the definition of the ftgprh Fortran wrapper routine in f77_wrap3.c.
  • modified the cfitsio.pc.in configuration file to make the lib path a variable, instead of hard coding the path. This provides more flexibility for projects such as suse and fedora when building CFITSIO.
  • fixed bug in imcomp_compress_tile in imcompress.c which caused null pixel values to be written incorrectly in the rare case where the floating-point tile of pixels could not be quantized into integers.
  • modified imcompress.c to add a new specialized routine to uncompress an input image and then write it to a output image on a tile by tile basis.
  • This appears to be faster than the old method of uncompressing the whole image into memory before writing it out. It also supports large images with more than 2**31 pixels.
  • made trivial changes to 2 statements in drvrfile.c to suppress nuisance compiler warnings.
  • some compilers define CLOCKS_PER_SEC as a double instead of an integer, so added an explicted integer type conversion to 2 statements in imcompress.c that used this macro.

New in CFITSIO 3.24 (Mar 14, 2012)

  • modified fits_translate_keywords so that it silently ignores any illegal ASCII characters in the value or comment fields of the input FITS file. Otherwise, fpack would abort without compressing input files that contained this minor violation of the FITS rules.
  • added support for Super H cpu in fitsio2.h
  • updated funpack to correctly handle the -S option, and to use a
  • more robust algorithm for creating temporary output files.
  • modified the imcomp_compress_tile routine to support the NOCOMPRESS debugging option for real*4 images.

New in CFITSIO 3.21 (Mar 14, 2012)

  • multithreaded programs now run correctly on Mac OS (they used to give a bus error),
  • increased the length of a character string in fpack.c that caused the "fpack -V" command to crash on some platforms
  • fixed an invalid comment delimiter ( //* ) in imcompress.c that some compilers complained about.

New in CFITSIO 3.18 Beta (Mar 14, 2012)

  • Made extensive changes to make CFITSIO thread safe. Previously, all opened FITS files shared a common pool of memory to store the most recently read or written FITS records in the files. In a multi-threaded environment different threads could simultaneously read or write to this common area causing unpredictable results. This was changed so that every opened FITS file has its own private memory area for buffering the file. Most of the changes were in buffers.c, fitsio.h, and fitsio2.h. Additional changes were made to cfileio.c, mainly to put locks around small sections of code when setting up the low-level drivers to read or write the FITS file. Also, locks were needed around the GZIP compression and uncompression code in compress.c., the error message stack access routine in fitscore.c, the encode and decode routines in fits_hcompress.c and fits_hdecompress.c, in ricecomp.c, and the table row selection and table calculator functions. Also, removed the 'static' declaration of the local variables in pliocomp.c which did not appeared to be required and prevented the routines from being thread safe.
  • As a consequence of having a separate memory buffer for every FITS file (by default, about 115 kB per file), CFITSIO may now allocate more memory than previously when an application program opens multiple FITS files at once. The read and write speed may also be slightly faster, since the buffers are not shared between files.
  • Added new families of Fortran wrapper routines to read and write values to large tables that have more than 2**31 rows. The arguments that define the first row and first element to read or write must be I*8 integers, not ordinary I*4 integers. The names of these new routines have 'LL' appended to them, so for example, ftgcvb becomes ftgcvbll.
  • Fixes:
  • Corrected an obscure bug in imcompress.c that would have incorrectly written the null values only in the rare case of writing a signed byte array that is then tile compressed using the Hcompress or PLIO algorithm.