vircam_opm.c

00001 /* $Id: vircam_opm.c,v 1.2 2010/09/09 12:11:09 jim Exp $
00002  *
00003  * This file is part of the VIRCAM Pipeline
00004  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: jim $
00023  * $Date: 2010/09/09 12:11:09 $
00024  * $Revision: 1.2 $
00025  * $Name: v1-1-0 $
00026  */
00027 
00028 /* Includes */
00029 
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 #include "vircam_mods.h"
00035 #include "vircam_utils.h"
00036 #include "vircam_fits.h"
00037 #include "vircam_mask.h"
00038 #include "catalogue/imcore.h"
00039 
00042 /*---------------------------------------------------------------------------*/
00088 /*---------------------------------------------------------------------------*/
00089 
00090 extern int vircam_opm(vir_fits *infile, vir_fits *conf, int ipix,
00091                       float threshold, int nbsize, float filtfwhm, 
00092                       int niter, int *status) {
00093     int retval;
00094     cpl_image *im;
00095     vir_fits *in_copy,*c_copy;
00096 
00097     /* Inherited status */
00098 
00099     if (*status != VIR_OK)
00100         return(*status);
00101 
00102     /* Copy the input */
00103 
00104     im = vircam_fits_get_image(infile);
00105     in_copy = vircam_fits_duplicate(infile);
00106     c_copy = vircam_fits_duplicate(conf);
00107 
00108     /* Call the main processing routine and create the mask */
00109 
00110     retval = imcore_opm(in_copy,c_copy,ipix,threshold,nbsize,filtfwhm,niter);
00111     if (retval != VIR_OK) {
00112         vircam_fits_delete(in_copy);
00113         vircam_fits_delete(c_copy);
00114         FATAL_ERROR
00115     }   
00116 
00117     /* Copy the mask over */
00118 
00119     cpl_mask_or(cpl_image_get_bpm(im),
00120                 cpl_image_get_bpm(vircam_fits_get_image(in_copy)));
00121 
00122     /* Ditch the copies */
00123 
00124     vircam_fits_delete(in_copy);
00125     vircam_fits_delete(c_copy);
00126 
00127     /* Get out of here */
00128 
00129     GOOD_STATUS
00130 }
00131 
00134 /* 
00135 
00136 $Log: vircam_opm.c,v $
00137 Revision 1.2  2010/09/09 12:11:09  jim
00138 Fixed problems with docs that make doxygen barf
00139 
00140 Revision 1.1  2008/10/24 11:08:12  jim
00141 New entry
00142 
00143 
00144 */

Generated on 7 Feb 2011 for VIRCAM Pipeline by  doxygen 1.6.1