Compare commits
No commits in common. "fd10739cc7190a051caafaccc379f5776c700984" and "c6dee909e8a50cd28d2e514ab6f5ca90eb7afbc9" have entirely different histories.
fd10739cc7
...
c6dee909e8
@ -627,17 +627,8 @@ To be done\index{XXX}
|
||||
|
||||
Ce format est essentiellement utilisé pour stocker des images
|
||||
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.
|
||||
|
||||
\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.
|
||||
To be done\index{XXX}
|
||||
|
||||
|
||||
\subsection{Utilitaires}
|
||||
|
@ -19,11 +19,12 @@ extern int verbosity;
|
||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags)
|
||||
{
|
||||
fitsfile *fptr; /* pointer to the FITS file */
|
||||
int status, sz;
|
||||
int status, idx, k, sz;
|
||||
int bitpix = FLOAT_IMG;
|
||||
|
||||
long naxis = 2;
|
||||
long naxes[2];
|
||||
// XXX float *array[1];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags);
|
||||
@ -38,8 +39,23 @@ if (fits_create_file(&fptr, outname, &status)) {
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
/************************************************************
|
||||
***** 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) ) {
|
||||
fits_report_error(stderr, status);
|
||||
@ -60,24 +76,3 @@ if ( fits_close_file(fptr, &status) ) {
|
||||
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