Dienstag, 5. Oktober 2010

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
#include
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
...
image[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.

User Status

Du bist nicht angemeldet.

Aktuelle Beiträge

iPhone to linux
gphoto2 --port=usb -R -P copies all images from an...
danielgruen - 2. Feb, 19:46
Alternative
This screws up the bounding box of non-square plots....
danielgruen - 30. Dez, 23:22
MNRAS submission problems...
Matplotlib ps files like to contain Type 3 fonts, which...
danielgruen - 13. Apr, 19:45
PPPOE connection problems
I was facing connection problems after some technical...
danielgruen - 29. Jun, 01:51
Sort products randomly...
http://www.magentocommerce .com/boards/v/viewthread/2 32826/#t331309 nicely...
danielgruen - 1. Feb, 17:29

Links

Suche

 

Status

Online seit 6273 Tagen
Zuletzt aktualisiert: 2. Feb, 19:46

Credits


Multimedia
Profil
Abmelden
Weblog abonnieren