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