VIRCAM Pipeline  2.3.12
casu_opm.c
1 /* $Id: casu_opm.c,v 1.2 2015/08/07 13:06:54 jim Exp $
2  *
3  * This file is part of the CASU Pipeline utilities
4  * Copyright (C) 2015 European Southern Observatory
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: 2015/08/07 13:06:54 $
24  * $Revision: 1.2 $
25  * $Name: $
26  */
27 
28 /* Includes */
29 
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 
34 #include "casu_mods.h"
35 #include "catalogue/casu_utils.h"
36 #include "catalogue/casu_fits.h"
37 #include "casu_mask.h"
38 #include "catalogue/imcore.h"
39 
42 /*---------------------------------------------------------------------------*/
88 /*---------------------------------------------------------------------------*/
89 
90 extern int casu_opm(casu_fits *infile, casu_fits *conf, int ipix,
91  float threshold, int nbsize, float filtfwhm,
92  int niter, int *status) {
93  int retval;
94  cpl_image *im;
95  casu_fits *in_copy,*c_copy;
96 
97  /* Inherited status */
98 
99  if (*status != CASU_OK)
100  return(*status);
101 
102  /* Copy the input */
103 
104  im = casu_fits_get_image(infile);
105  in_copy = casu_fits_duplicate(infile);
106  c_copy = casu_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 != CASU_OK) {
112  casu_fits_delete(in_copy);
113  casu_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(casu_fits_get_image(in_copy)));
121 
122  /* Ditch the copies */
123 
124  casu_fits_delete(in_copy);
125  casu_fits_delete(c_copy);
126 
127  /* Get out of here */
128 
129  GOOD_STATUS
130 }
131 
134 /*
135 
136 $Log: casu_opm.c,v $
137 Revision 1.2 2015/08/07 13:06:54 jim
138 Fixed copyright to ESO
139 
140 Revision 1.1.1.1 2015/06/12 10:44:32 jim
141 Initial import
142 
143 Revision 1.3 2015/01/29 11:51:56 jim
144 modified comments
145 
146 Revision 1.2 2013/11/21 09:38:14 jim
147 detabbed
148 
149 Revision 1.1.1.1 2013-08-27 12:07:48 jim
150 Imported
151 
152 
153 */
cpl_image * casu_fits_get_image(casu_fits *p)
Definition: casu_fits.c:436
void casu_fits_delete(casu_fits *p)
Definition: casu_fits.c:364
casu_fits * casu_fits_duplicate(casu_fits *in)
Definition: casu_fits.c:225
int casu_opm(casu_fits *infile, casu_fits *conf, int ipix, float threshold, int nbsize, float filtfwhm, int niter, int *status)
Generate an object mask from an input image.
Definition: casu_opm.c:90
int imcore_opm(casu_fits *infile, casu_fits *conf, int ipix, float threshold, int nbsize, float filtfwhm, int niter)
Create an object mask.
Definition: imcore_opm.c:111