VIRCAM Pipeline  1.3.3
vircam_opm.c
1 /* $Id: vircam_opm.c,v 1.2 2010-09-09 12:11:09 jim Exp $
2  *
3  * This file is part of the VIRCAM Pipeline
4  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: jim $
23  * $Date: 2010-09-09 12:11:09 $
24  * $Revision: 1.2 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 /* Includes */
29 
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 
34 #include "vircam_mods.h"
35 #include "vircam_utils.h"
36 #include "vircam_fits.h"
37 #include "vircam_mask.h"
38 #include "catalogue/imcore.h"
39 
42 /*---------------------------------------------------------------------------*/
88 /*---------------------------------------------------------------------------*/
89 
90 extern int vircam_opm(vir_fits *infile, vir_fits *conf, int ipix,
91  float threshold, int nbsize, float filtfwhm,
92  int niter, int *status) {
93  int retval;
94  cpl_image *im;
95  vir_fits *in_copy,*c_copy;
96 
97  /* Inherited status */
98 
99  if (*status != VIR_OK)
100  return(*status);
101 
102  /* Copy the input */
103 
104  im = vircam_fits_get_image(infile);
105  in_copy = vircam_fits_duplicate(infile);
106  c_copy = vircam_fits_duplicate(conf);
107 
108  /* Call the main processing routine and create the mask */
109 
110  retval = imcore_opm(in_copy,c_copy,ipix,threshold,nbsize,filtfwhm,niter);
111  if (retval != VIR_OK) {
112  vircam_fits_delete(in_copy);
113  vircam_fits_delete(c_copy);
114  FATAL_ERROR
115  }
116 
117  /* Copy the mask over */
118 
119  cpl_mask_or(cpl_image_get_bpm(im),
120  cpl_image_get_bpm(vircam_fits_get_image(in_copy)));
121 
122  /* Ditch the copies */
123 
124  vircam_fits_delete(in_copy);
125  vircam_fits_delete(c_copy);
126 
127  /* Get out of here */
128 
129  GOOD_STATUS
130 }
131 
134 /*
135 
136 $Log: not supported by cvs2svn $
137 Revision 1.1 2008/10/24 11:08:12 jim
138 New entry
139 
140 
141 */