fors_image.h

00001 /* $Id: fors_image.h,v 1.31 2013-07-24 12:59:35 cgarcia Exp $
00002  *
00003  * This file is part of the FORS Library
00004  * Copyright (C) 2002-2010 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 /*
00022  * $Author: cgarcia $
00023  * $Date: 2013-07-24 12:59:35 $
00024  * $Revision: 1.31 $
00025  * $Name: not supported by cvs2svn $
00026  */
00027 
00028 #ifndef FORS_IMAGE_H
00029 #define FORS_IMAGE_H
00030 
00031 #include <fors_setting.h>
00032 #include <cpl.h>
00033 #include <hdrl.h>
00034 
00035 typedef struct _fors_image fors_image;
00036 
00037 extern const cpl_type FORS_IMAGE_TYPE;
00038 
00039 /* Container */
00040 #undef LIST_ELEM
00041 #define LIST_ELEM fors_image
00042 #include <list.h>
00043 
00044 CPL_BEGIN_DECLS
00045 
00061 struct _fors_image
00062 {
00063     cpl_image *data;
00064     cpl_image *variance;
00065 
00066     /* Invariants:
00067        The CPL images are non-NULL. 
00068        The variance image is everywhere non-negative.
00069        The CPL image types are FORS_IMAGE_TYPE.
00070        The CPL image bad pixel masks are unused
00071     */
00072 };
00073 
00074 /* Constructors */
00075 fors_image *fors_image_new(cpl_image *data, cpl_image *weights);
00076 
00077 fors_image *fors_image_duplicate(const fors_image *image);
00078 
00079 /* Desctructors */
00080 void fors_image_delete(fors_image **image);
00081 void fors_image_delete_const(const fors_image **image);
00082 
00083 
00084 /* I/O */
00085 fors_image *fors_image_load(const cpl_frame *frame);
00086 
00087 
00088 fors_image_list *fors_image_load_list(const cpl_frameset *frames);
00089 
00090 const fors_image_list *
00091 fors_image_load_list_const(const cpl_frameset *frames);
00092 
00093 void
00094 fors_image_save(const fors_image *image, const cpl_propertylist *header,
00095                 const cpl_propertylist *err_header, const char *filename);
00096 
00097 void
00098 fors_image_save_sex(const fors_image *image, const cpl_propertylist *header,
00099                     const char *filename_dat,
00100                     const char *filename_var,
00101                     int radius);
00102 
00103 /* Other */
00104 cpl_size fors_image_get_size_x(const fors_image *image);
00105 cpl_size fors_image_get_size_y(const fors_image *image);
00106 const float *fors_image_get_data_const(const fors_image *image);
00107 
00108 void fors_image_draw(fors_image *image, int type,
00109              double x, double y,
00110              int radius, double color);
00111 
00112 void fors_image_crop(fors_image *image,
00113              int xlo, int ylo,
00114              int xhi, int yhi);
00115 
00116 /* Arithmetic */
00117 void fors_image_subtract(fors_image *left, const fors_image *right);
00118 void fors_image_multiply(fors_image *left, const fors_image *right);
00119 void fors_image_multiply_noerr(fors_image *left, const cpl_image *right);
00120 void fors_image_divide(fors_image *left, const fors_image *right);
00121 void fors_image_divide_noerr(fors_image *left, cpl_image *right);
00122 void fors_image_abs(fors_image *image);
00123 void fors_image_square(fors_image *image);
00124 
00125 void fors_image_exponential(fors_image *image, double b, double db);
00126 void fors_image_multiply_scalar(fors_image *image, double s, double ds);
00127 void fors_image_divide_scalar(fors_image *image, double s, double ds);
00128 void fors_image_subtract_scalar(fors_image *image, double s, double ds);
00129 
00130 fors_image *fors_image_collapse_create(const fors_image_list *images);
00131 fors_image *fors_image_collapse_median_create(const fors_image_list *images);
00132 fors_image *fors_image_collapse_minmax_create(const fors_image_list *images, 
00133                                               int low, int high);
00134 fors_image *fors_image_collapse_ksigma_create(const fors_image_list *images, 
00135                                               int low, int high, int iter);
00136 
00137 cpl_image *
00138 fors_image_filter_median_create(const fors_image *image, 
00139                                 int xradius,
00140                                 int yradius,
00141                                 int xstart, 
00142                                 int ystart,
00143                                 int xend,
00144                                 int yend,
00145                                 int xstep,
00146                                 int ystep,
00147                                 bool use_data);
00148 
00149 cpl_image *
00150 fors_image_flat_fit_create(fors_image *image,
00151                            int step,
00152                            int degree,
00153                            float level);
00154 cpl_image *
00155 fors_image_filter_max_create(const fors_image *image,
00156                              int xradius,
00157                              int yradius,
00158                              bool use_data);
00159 
00160 /* Statistics */
00161 double fors_image_get_mean(const fors_image *image, double *dmean);
00162 double fors_image_get_median(const fors_image *image, double *dmedian);
00163 
00164 double fors_image_get_stdev(const fors_image *image, double *dstdev);
00165 double fors_image_get_stdev_robust(const fors_image *image, 
00166                    double cut,
00167                    double *dstdev);
00168 double fors_image_get_error_mean(const fors_image *image, double *dmean);
00169 
00170 double fors_image_get_min(const fors_image *image);
00171 double fors_image_get_max(const fors_image *image);
00172 
00173 hdrl_imagelist * fors_image_list_to_hdrl(const fors_image_list * imalist);
00174 
00175 fors_image * fors_image_from_hdrl(const hdrl_image * image);
00176 
00177 CPL_END_DECLS
00178 
00179 #endif

Generated on 12 Feb 2016 for FORS Pipeline Reference Manual by  doxygen 1.6.1