Extract Image from Binary FITS table's cell
The FITS image format is as multi-functional as it is inaccessible. I recently stumbled across FITS files which had a binary table extension with pictures in some individual cells (instead of their own image
extensions). It took me a while to realize that these really weren't 2D objects but only vectors with an extra header entry telling us their true dimensionality and the size of their axes. To get the vectors, e.g. with
CCfits, you can do a simple
extensions). It took me a while to realize that these really weren't 2D objects but only vectors with an extra header entry telling us their true dimensionality and the size of their axes. To get the vectors, e.g. with
CCfits, you can do a simple
#includeimage[0] is now a vector of the image stored in the first line; you could access it as image[0][i] or rearrange the values in a two-dimensional array if you wish.
using namespace std;
#include
using namespace CCfits;
int main()
{
auto_ptr pInfile(new FITS("in.fit",Read,1,true)); // opens&reads second hdu read-only
ExtHDU& inTable = pInfile->extension(1);
Column& inColumn = inTable.column("imagecolumn",false);
vector< valarray > image;
inColumn.readArrays(image, 1, 1); // read only one row this time
...
danielgruen - 5. Okt, 00:31