adding bare FITS file support
This commit is contained in:
45
funcs/t.c
45
funcs/t.c
@@ -6,12 +6,32 @@
|
||||
#include <string.h>
|
||||
#include <pam.h>
|
||||
|
||||
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
float global_fvalue;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* essai de fichiers FITS (astronomie) */
|
||||
int essai_ecriture_fits(char *outname)
|
||||
{
|
||||
FloatImg src;
|
||||
int foo;
|
||||
|
||||
fprintf(stderr, "%s is creating the picz\n", __func__);
|
||||
fimg_create(&src, 512, 512, FIMG_TYPE_RGB);
|
||||
fimg_test_pattern(&src, 0, 255.0);
|
||||
|
||||
foo = fimg_save_as_pnm(&src, "foo.pnm", 0);
|
||||
foo = fimg_save_R_as_fits(&src, outname, 0);
|
||||
|
||||
fprintf(stderr, "saving '%s' to fits --> %d\n", outname, foo);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* egalisation dynamique approximative
|
||||
@@ -38,7 +58,6 @@ else {
|
||||
foo = fimg_equalize_compute(&src, NULL);
|
||||
fprintf(stderr, "equalize compute --> %d\n", foo);
|
||||
|
||||
|
||||
fimg_destroy(&src);
|
||||
|
||||
return -1;
|
||||
@@ -315,7 +334,9 @@ int re;
|
||||
fimg_create(&fimg, 1280, 960, FIMG_TYPE_RGB);
|
||||
|
||||
re = fimg_test_pattern(&fimg, 9, 1.0);
|
||||
|
||||
if (re) {
|
||||
fprintf(stderr, "fimg_test_pattern -> %d\n", re);
|
||||
}
|
||||
fimg_save_as_pnm(&fimg, "mire.pnm", 0);
|
||||
|
||||
return -1;
|
||||
@@ -346,15 +367,10 @@ int essai_ecrire_png(char *fname)
|
||||
FloatImg fimg;
|
||||
int foo;
|
||||
|
||||
fimg_create(&fimg, 512, 512, FIMG_TYPE_RGB);
|
||||
fimg_create(&fimg, 800, 600, FIMG_TYPE_RGB);
|
||||
|
||||
fimg_draw_something(&fimg);
|
||||
|
||||
/* XXX
|
||||
for (foo=0; foo<512; foo++) {
|
||||
fimg_plot_rgb(&fimg, foo, foo, 17000.0, 8000.0, 11111.1);
|
||||
}
|
||||
*/
|
||||
|
||||
foo = fimg_save_as_pnm(&fimg, "quux.pnm", 0);
|
||||
fprintf(stderr, "save as pnm -> %d\n", foo);
|
||||
@@ -365,7 +381,7 @@ fprintf(stderr, "save as png -> %d\n", foo);
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE };
|
||||
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@@ -377,6 +393,8 @@ Command commands[] = {
|
||||
{ "sfx0", Sfx0 },
|
||||
{ "f3x3", F3x3 },
|
||||
{ "mire", MIRE },
|
||||
{ "wfits", Wfits },
|
||||
{ "wpng", Wpng },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@@ -444,7 +462,7 @@ if (verbosity) {
|
||||
}
|
||||
|
||||
opt = lookup_cmd(command);
|
||||
fprintf(stderr, "lookup '%s' --> %d\n", command, opt);
|
||||
// fprintf(stderr, "lookup '%s' --> %d\n", command, opt);
|
||||
|
||||
switch(opt) {
|
||||
case Equalize:
|
||||
@@ -458,7 +476,12 @@ switch(opt) {
|
||||
case MIRE:
|
||||
foo = essai_mire(filename, 0);
|
||||
break;
|
||||
|
||||
case Wfits:
|
||||
foo = essai_ecriture_fits(filename);
|
||||
break;
|
||||
case Wpng:
|
||||
foo = essai_ecrire_png(filename);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s : bad command\n", command);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user