00001 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* vim:set sw=2 sts=2 et cin: */ 00003 /* 00004 * This file is part of the MUSE Instrument Pipeline 00005 * Copyright (C) 2005-2014 European Southern Observatory 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 */ 00021 #ifndef MUSE_QUALITY_H 00022 #define MUSE_QUALITY_H 00023 00024 /*---------------------------------------------------------------------------* 00025 * Includes * 00026 *---------------------------------------------------------------------------*/ 00027 #include <cpl.h> 00028 #include "muse_image.h" 00029 00030 #include "muse_cplwrappers.h" 00031 00032 /*---------------------------------------------------------------------------* 00033 * Defines * 00034 *---------------------------------------------------------------------------*/ 00035 00039 /* Euro3D bad pixel states (be sure to use unsigned numbers) */ 00040 #define EURO3D_GOODPIXEL 0 00041 #define EURO3D_TELLURIC (1ul << 0) /* uncorrected */ 00042 #define EURO3D_TELLCOR (1ul << 1) /* corrected */ 00043 #define EURO3D_COSMICRAY (1ul << 5) /* uncorrected */ 00044 #define EURO3D_LOWQEPIXEL (1ul << 6) 00045 #define EURO3D_HOTPIXEL (1ul << 8) 00046 #define EURO3D_DARKPIXEL (1ul << 9) 00047 #define EURO3D_SATURATED (1ul << 12) 00048 #define EURO3D_DEADPIXEL (1ul << 13) 00049 #define EURO3D_BADOTHER (1ul << 14) /* other kind of bad pixel */ 00050 /* used for non-positive pixels in flat-fields */ 00051 #define EURO3D_OBJECT (1ul << 25) /* for object masks, see * 00052 * muse_sky_subtract_simple() */ 00053 #define EURO3D_OUTLIER (1ul << 26) /* for general outliers, see * 00054 * muse_resampling_spectrum_iterate() */ 00055 #define EURO3D_MUSE_TRAP (1ul << 29) 00056 #define EURO3D_MISSDATA (1ul << 30) 00057 #define EURO3D_OUTSDRANGE (1ul << 31) 00058 #define EURO3D_ALLBITS 0xFFFFul 00059 00060 extern const muse_cpltable_def muse_badpix_table_def[]; 00061 00062 /*----------------------------------------------------------------------------* 00063 * Inline functions * 00064 *----------------------------------------------------------------------------*/ 00065 00066 /*---------------------------------------------------------------------------*/ 00074 /*---------------------------------------------------------------------------*/ 00075 static inline cpl_boolean 00076 muse_quality_is_usable(uint32_t aState, uint32_t aInclude) 00077 { 00078 return (aState == EURO3D_GOODPIXEL) || 00079 !(aState ^ aInclude); 00080 } /* muse_quality_is_usable() */ 00081 00084 /*---------------------------------------------------------------------------* 00085 * Function prototypes * 00086 *---------------------------------------------------------------------------*/ 00087 int muse_quality_dark_badpix(muse_image *, double, double); 00088 int muse_quality_bad_columns(muse_image *, double, double); 00089 int muse_quality_flat_badpix(muse_image *, cpl_table *, double, double); 00090 int muse_quality_set_saturated(muse_image *); 00091 cpl_table *muse_quality_convert_dq(cpl_image *); 00092 cpl_error_code muse_quality_merge_badpix(cpl_table *, const cpl_table *); 00093 int muse_quality_image_reject_using_dq(cpl_image *, cpl_image *, cpl_image *); 00094 00095 cpl_table *muse_quality_merge_badpix_from_file(const cpl_table *, const char *, const char *, int *); 00096 cpl_error_code muse_quality_copy_badpix_table(const char *, const char *, int, const cpl_table *); 00097 00098 #endif /* MUSE_QUALITY_H */
1.6.1