MUSE Pipeline Reference Manual  2.1.1
muse_image.h
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set sw=2 sts=2 et cin: */
3 /*
4  * This file is part of the MUSE Instrument Pipeline
5  * Copyright (C) 2005-2014 European Southern Observatory
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef MUSE_IMAGE_H
23 #define MUSE_IMAGE_H
24 
25 /*----------------------------------------------------------------------------*
26  * Special variable types *
27  *----------------------------------------------------------------------------*/
28 
32 /*----------------------------------------------------------------------------*/
39 /*----------------------------------------------------------------------------*/
40 typedef struct {
46  cpl_image *data;
47 
56  cpl_image *dq;
57 
64  cpl_image *stat;
65 
72  cpl_propertylist *header;
73 } muse_image;
74 
77 /*----------------------------------------------------------------------------*
78  * Defines *
79  *----------------------------------------------------------------------------*/
80 /* extension names for the three images */
81 #define EXTNAME_DATA "DATA"
82 #define EXTNAME_DQ "DQ"
83 #define EXTNAME_STAT "STAT"
84 #define EXTNAME_DATA_COMMENT "This extension contains data values"
85 #define EXTNAME_DQ_COMMENT "This extension contains bad pixel status values"
86 #define EXTNAME_STAT_COMMENT "This extension contains data variance"
87 
88 /*----------------------------------------------------------------------------*
89  * Function prototypes *
90  *----------------------------------------------------------------------------*/
93 muse_image *muse_image_load(const char *);
94 muse_image *muse_image_load_from_extensions(const char *, unsigned char);
95 muse_image *muse_image_load_from_raw(const char *, int);
96 cpl_error_code muse_image_save(muse_image *, const char *);
100 int muse_image_scale(muse_image *, double);
101 
103 cpl_error_code muse_image_adu_to_count(muse_image *);
104 
105 cpl_error_code muse_image_reject_from_dq(muse_image *);
106 cpl_error_code muse_image_dq_to_nan(muse_image *);
107 
108 #endif /* MUSE_IMAGE_H */
void muse_image_delete(muse_image *)
Deallocate memory associated to a muse_image object.
Definition: muse_image.c:85
int muse_image_divide(muse_image *, muse_image *)
Divide a muse_image by another with correct treatment of bad pixels and variance. ...
Definition: muse_image.c:639
int muse_image_scale(muse_image *, double)
Scale a muse_image with correct treatment of variance.
Definition: muse_image.c:703
cpl_image * data
the data extension
Definition: muse_image.h:46
muse_image * muse_image_load_from_raw(const char *, int)
Load raw image into the data extension of a MUSE image.
Definition: muse_image.c:292
muse_image * muse_image_duplicate(const muse_image *)
Duplicate the three image extensions and the FITS headers of a MUSE image.
Definition: muse_image.c:510
cpl_image * stat
the statistics extension
Definition: muse_image.h:64
int muse_image_subtract(muse_image *, muse_image *)
Subtract a muse_image from another with correct treatment of bad pixels and variance.
Definition: muse_image.c:593
Structure definition of MUSE three extension FITS file.
Definition: muse_image.h:40
cpl_propertylist * header
the FITS header
Definition: muse_image.h:72
int muse_image_variance_create(muse_image *, muse_image *)
Create the photon noise-based variance in the stat extension.
Definition: muse_image.c:747
cpl_image * dq
the data quality extension
Definition: muse_image.h:56
cpl_error_code muse_image_save(muse_image *, const char *)
Save the three image extensions and the FITS headers of a MUSE image to a file.
Definition: muse_image.c:405
muse_image * muse_image_load(const char *)
Load the three extensions and the FITS headers of a MUSE image from a file.
Definition: muse_image.c:228
cpl_error_code muse_image_reject_from_dq(muse_image *)
Reject pixels of a muse_image depending on its DQ data.
Definition: muse_image.c:863
muse_image * muse_image_new(void)
Allocate memory for a new muse_image object.
Definition: muse_image.c:66
cpl_error_code muse_image_adu_to_count(muse_image *)
Convert the data units from raw adu to count (= electron) units.
Definition: muse_image.c:811
muse_image * muse_image_load_from_extensions(const char *, unsigned char)
Load the three extensions and the FITS headers of a MUSE image from extensions of a merged file...
Definition: muse_image.c:262
cpl_error_code muse_image_dq_to_nan(muse_image *)
Convert pixels flagged in the DQ extension to NANs in DATA (and STAT, if present).
Definition: muse_image.c:904