RFITSIO: FITS reading for R and S-Plus
RFITSIO is a C library for use with the R
and S-Plus environments for reading FITS files. RFITSIO actually is a wrapper
to CFITSIO
library a C library for the manipulation of FITS images, so you need both of
them to successfully parse FITS images from R or S-Plus. RFITSIO has been
compiled as a DLL (Dynamic-Link Library) using MS Visual C++ 6.0 but is written
in strait C so it portable to other systems with a simple recompilation.
Currently RFITSIO supports only two functions: RFitsio_GetSize() and RFitsio_ReadImage().
RFitsio_GetSize() takes a filename as input and gives you the number of pixels,
width and height of the image. RFitsio_ReadImage() takes the filename and the
number of pixels of an image and fills a one dimensional array with the image
data. To make the use of RFITSIO easier from R/S-Plus four script functions
have been implemented: FITSGetWidth(), FITSGetHeight(), FITSGetSize(),
FITSReadImage(). All four functions take as a parameter a filename and they
contained in four separated *.txt files: FITSGetWidth.txt, FITSGetHeight.txt,
FITSGetSize.txt, and FITSReadImage.txt.
Using RFITSIO from R
First you need to load the cfitsio.dll and
then the rfistio.dll because rfistio.dll requires the cfitsio.dll to be loaded
first. Suppose you placed all the required DLLs and scripts to the C:\TEMP
directory. To load the two DLLs do the following:
dyn.load("C:/TEMP/cfitsio.dll")
and press <RETURN>
dyn.load("C:/TEMP/rfitsio.dll")
and press <RETURN>
To load the four scripts files do the
following (there is no any particular order required to load them):
source("C:/TEMP/
FITSGetWidth.txt") and press <RETURN>
source("C:/TEMP/
FITSGetHeight.txt") and press <RETURN>
source("C:/TEMP/
FITSGetSize.txt") and press <RETURN>
source("C:/TEMP/
FITSReadImage.txt") and press <RETURN>
Downloads
rfitsio.zip contains DLLs and script files: rfitsio.dll,
cfitsio.dll, FITSGetWidth.txt, FITSGetHeight.txt, FITSGetSize.txt, and
FITSReadImage.txt.
rfitsio.cpp download the C source code for the library. To
successfully compile it you will need the CFITSIO
library as well.