66 #define PRINT_USAGE(rc) \ 67 fprintf(stderr, "Usage: %s [ -d datavalue ] [ -q dqvalue] [ -s statvalue ] " \ 68 "IMAGE_IN IMAGE_OUT\n", argv[0]); \ 69 cpl_end(); return (rc); 71 int main(
int argc,
char **argv)
73 cpl_init(CPL_INIT_DEFAULT);
86 cpl_size dqvalue = -1;
90 for (i = 1; i < argc; i++) {
91 if (strncmp(argv[i],
"-d", 3) == 0) {
95 datavalue = atof(argv[i]);
99 }
else if (strncmp(argv[i],
"-q", 3) == 0) {
103 dqvalue = atoi(argv[i]);
104 if (dqvalue < 0 || dqvalue > UINT_MAX) {
110 }
else if (strncmp(argv[i],
"-s", 3) == 0) {
114 statvalue = atof(argv[i]);
121 }
else if (strncmp(argv[i],
"-", 1) == 0) {
124 if (iname && oname) {
139 printf(
"Loaded \"%s\".\n", iname);
142 cpl_error_code rc = CPL_ERROR_NONE;
143 cpl_size nx = cpl_image_get_size_x(image->
data),
144 ny = cpl_image_get_size_y(image->
data);
145 rc = cpl_image_fill_window(image->
data, 1, 1, nx, ny, datavalue);
146 printf(
"Filled DATA image with %g (rc = %d)\n", datavalue, rc);
147 rc = cpl_image_fill_window(image->
stat, 1, 1, nx, ny, statvalue);
148 printf(
"Filled STAT image with %g (rc = %d)\n", statvalue, rc);
150 rc = cpl_image_fill_window(image->
dq, 1, 1, nx, ny, dqvalue);
151 printf(
"Filled DQ image with %u (rc = %d)\n", (
unsigned int)dqvalue, rc);
153 if (!cpl_propertylist_has(image->
header,
"BUNIT")) {
154 cpl_propertylist_append_string(image->
header,
"BUNIT",
"count");
158 if (rc != CPL_ERROR_NONE) {
159 fprintf(stderr,
"Some error occurred while saving to \"%s\" " 160 "(rc = %d, %s)\n", oname, rc, cpl_error_get_message());
163 printf(
"Saved to \"%s\".\n", oname);
void muse_image_delete(muse_image *aImage)
Deallocate memory associated to a muse_image object.
cpl_image * data
the data extension
cpl_image * stat
the statistics extension
Structure definition of MUSE three extension FITS file.
cpl_propertylist * header
the FITS header
cpl_image * dq
the data quality extension
cpl_error_code muse_image_save(muse_image *aImage, const char *aFilename)
Save the three image extensions and the FITS headers of a MUSE image to a file.
muse_image * muse_image_load(const char *aFilename)
Load the three extensions and the FITS headers of a MUSE image from a file.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.