Compare commits
3 Commits
d8bb6f4ec6
...
c6dee909e8
Author | SHA1 | Date | |
---|---|---|---|
c6dee909e8 | |||
421dd724a7 | |||
b88d2c234a |
@ -3,7 +3,7 @@
|
||||
* ugly code from tTh
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 103
|
||||
#define FIMG_VERSION 104
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
@ -139,6 +139,8 @@ int fimg_load_from_dump(char *fname, FloatImg *where);
|
||||
int fimg_create_from_dump(char *fname, FloatImg *head);
|
||||
|
||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags);
|
||||
int fimg_save_G_as_fits(FloatImg *src, char *outname, int flags);
|
||||
int fimg_save_B_as_fits(FloatImg *src, char *outname, int flags);
|
||||
|
||||
|
||||
/* mathematics operations */
|
||||
|
@ -1,6 +1,9 @@
|
||||
/*
|
||||
* FLOATIMG
|
||||
* import/export to/from FITS files
|
||||
|
||||
https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node1.html
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -21,7 +24,7 @@ int bitpix = FLOAT_IMG;
|
||||
|
||||
long naxis = 2;
|
||||
long naxes[2];
|
||||
float **array;
|
||||
// XXX float *array[1];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags);
|
||||
@ -36,22 +39,23 @@ if (fits_create_file(&fptr, outname, &status)) {
|
||||
}
|
||||
|
||||
naxes[0] = src->width; naxes[1] = src->height;
|
||||
array = calloc(src->height, sizeof(float *));
|
||||
// XXX array = calloc(src->height, sizeof(float *));
|
||||
if (verbosity) fimg_describe(src, "to be saved as FITS");
|
||||
|
||||
#define REVERSE 1
|
||||
/* initialize pointers to the start of each row of the image */
|
||||
/************************************************************
|
||||
***** MAGIC CODE MUST COME HERE ?
|
||||
array[0] = src->R;
|
||||
#define REVERSE 1
|
||||
for( idx=0; idx<naxes[1]; idx++ ) {
|
||||
/**** MAGIC CODE MUST COME HERE ****/
|
||||
#if REVERSE
|
||||
k = naxes[1] - idx - 1;
|
||||
#else
|
||||
k = idx;
|
||||
#endif
|
||||
array[idx] = src->R + (k*naxes[0]);
|
||||
fprintf(stderr, " %6d %6d %p\n", idx, k, array[idx]);
|
||||
fprintf(stderr, " %6d %6d %p\n", idx, k, array[idx]);
|
||||
}
|
||||
**************************************************************/
|
||||
|
||||
if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) {
|
||||
fits_report_error(stderr, status);
|
||||
@ -59,7 +63,7 @@ if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) {
|
||||
}
|
||||
|
||||
sz = naxes[0]*naxes[1];
|
||||
if ( fits_write_img(fptr, TFLOAT, 1, sz, array[0], &status) ) {
|
||||
if ( fits_write_img(fptr, TFLOAT, 1, sz, src->R, &status) ) {
|
||||
fits_report_error(stderr, status);
|
||||
return -10;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ if (verbosity > 1) {
|
||||
fprintf(stderr, "grabing %d picz, ", nbre_capt);
|
||||
fprintf(stderr, "period is %.3f milliseconds\n", period/1e3);
|
||||
fprintf(stderr, "framesize is %dx%d\n", width, height);
|
||||
fprintf(stderr, "destdir is '%s'\n", dest_dir);
|
||||
// fprintf(stderr, "destdir is '%s'\n", dest_dir);
|
||||
if (upscaling) fprintf(stderr, "upscaling is on\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user