Compare commits
2 Commits
c6dee909e8
...
fd10739cc7
Author | SHA1 | Date | |
---|---|---|---|
fd10739cc7 | |||
efc2807227 |
@ -627,8 +627,17 @@ To be done\index{XXX}
|
|||||||
|
|
||||||
Ce format est essentiellement utilisé pour stocker des images
|
Ce format est essentiellement utilisé pour stocker des images
|
||||||
d'astronomie, donc il peut aussi servir pour des images floues.
|
d'astronomie, donc il peut aussi servir pour des images floues.
|
||||||
|
Cette partie est basée sur la bibliothèque \texttt{cfitsio} de
|
||||||
|
la NASA.
|
||||||
|
|
||||||
To be done\index{XXX}
|
\begin{lstlisting}
|
||||||
|
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags);
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
Bizarrement, l'image est stockée \textsl{upside-down} et je ne
|
||||||
|
sais pas encore comment régler ce petit détail.
|
||||||
|
|
||||||
|
Tous les flags doivent être à zéro.
|
||||||
|
|
||||||
|
|
||||||
\subsection{Utilitaires}
|
\subsection{Utilitaires}
|
||||||
|
@ -19,12 +19,11 @@ extern int verbosity;
|
|||||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags)
|
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags)
|
||||||
{
|
{
|
||||||
fitsfile *fptr; /* pointer to the FITS file */
|
fitsfile *fptr; /* pointer to the FITS file */
|
||||||
int status, idx, k, sz;
|
int status, sz;
|
||||||
int bitpix = FLOAT_IMG;
|
int bitpix = FLOAT_IMG;
|
||||||
|
|
||||||
long naxis = 2;
|
long naxis = 2;
|
||||||
long naxes[2];
|
long naxes[2];
|
||||||
// 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);
|
||||||
@ -39,23 +38,8 @@ if (fits_create_file(&fptr, outname, &status)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
naxes[0] = src->width; naxes[1] = src->height;
|
naxes[0] = src->width; naxes[1] = src->height;
|
||||||
// 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");
|
||||||
|
|
||||||
/************************************************************
|
|
||||||
***** MAGIC CODE MUST COME HERE ?
|
|
||||||
array[0] = src->R;
|
|
||||||
#define REVERSE 1
|
|
||||||
for( idx=0; idx<naxes[1]; idx++ ) {
|
|
||||||
#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]);
|
|
||||||
}
|
|
||||||
**************************************************************/
|
|
||||||
|
|
||||||
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);
|
||||||
@ -76,3 +60,24 @@ if ( fits_close_file(fptr, &status) ) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
***** MAGIC CODE FROM OUTERSPACE ?
|
||||||
|
|
||||||
|
function 'writeimage' from :
|
||||||
|
https://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples/cookbook.c
|
||||||
|
|
||||||
|
float **array;
|
||||||
|
array = calloc(src->height, sizeof(float *));
|
||||||
|
array[0] = src->R;
|
||||||
|
#define REVERSE 1
|
||||||
|
for( idx=0; idx<naxes[1]; idx++ ) {
|
||||||
|
#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]);
|
||||||
|
}
|
||||||
|
**************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user