20#include "hdrl_cat_conf.h"
22#include "hdrl_cat_classify.h"
27static void hdrl_casu_xytoradec(
const cpl_wcs *wcs,
double x,
double y,
double *ra,
double *dec);
67 hdrl_casu_tfits *p = cpl_malloc(
sizeof(hdrl_casu_tfits));
75 p->ehu = cpl_propertylist_new();
145 if (p->table ) cpl_table_delete(p->table);
146 if (p->ehu ) cpl_propertylist_delete(p->ehu);
173 hdrl_casu_fits *p = cpl_malloc(
sizeof(hdrl_casu_fits));
177 p->ehu = cpl_propertylist_new();
202 hdrl_casu_fits *p = cpl_malloc(
sizeof(hdrl_casu_fits));
203 p->image = cpl_image_duplicate(in->image);
273 if (p->image ) cpl_image_delete(p->image);
274 if (p->ehu ) cpl_propertylist_delete(p->ehu);
322 hdrl_casu_fits *infile, hdrl_casu_fits *conf,
323 const cpl_wcs *wcs, cpl_size ipix,
324 double threshold, cpl_size icrowd,
double rcore,
325 cpl_size bkg_subtr, cpl_size nbsize,
326 hdrl_catalogue_options cattype,
327 double filtfwhm,
double gainloc,
double saturation,
328 hdrl_casu_result *res)
331 res->catalogue = NULL;
338 nbsize, cattype, filtfwhm, gainloc, saturation, res) != CPL_ERROR_NONE) {
340 return cpl_error_get_code();
345 cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
"hdrl_cat_casu_catalogue - No objects found in image");
346 return CPL_ERROR_DATA_NOT_FOUND;
350 if (cattype & HDRL_CATALOGUE_CAT_COMPLETE) {
354 return cpl_error_get_code();
364 double* x = cpl_table_get_data_double(cat,
"X_coordinate");
365 double* y = cpl_table_get_data_double(cat,
"Y_coordinate");
366 double* ra = cpl_table_get_data_double(cat,
"RA");
367 double* dec = cpl_table_get_data_double(cat,
"DEC");
369 cpl_size n = cpl_table_get_nrow(cat);
370 for (cpl_size i = 0; i < n; i++) {
371 hdrl_casu_xytoradec(wcs, x[i], y[i], &(ra[i]), &(dec[i]));
376 "ESO QC IMAGE_SIZE",
"[pixel] Average FWHM of stellar objects");
386 return CPL_ERROR_NONE;
406static void hdrl_casu_xytoradec(
const cpl_wcs *wcs,
double x,
double y,
double *ra,
double *dec)
409 cpl_matrix *from = cpl_matrix_new(1, 2);
410 double *xy = cpl_matrix_get_data(from);
415 cpl_matrix *to = NULL;
416 cpl_array *status = NULL;
417 cpl_wcs_convert(wcs, from, &to, &status, CPL_WCS_PHYS2WORLD);
420 double *radec = cpl_matrix_get_data(to);
425 cpl_matrix_delete(from);
426 cpl_matrix_delete(to);
427 cpl_array_delete(status);
cpl_error_code hdrl_catalogue_conf(hdrl_casu_fits *infile, hdrl_casu_fits *conf, cpl_size ipix, double threshold, cpl_size icrowd, double rcore, cpl_size bkg_subtr, cpl_size nbsize, cpl_size cattype, double filtfwhm, double gain, double saturation, hdrl_casu_result *res)
Do source extraction.
hdrl_casu_fits * hdrl_casu_fits_wrap(cpl_image *im)
Wrap an image in a hdrl_casu_fits wrapper.
cpl_propertylist * hdrl_casu_tfits_get_ehu(hdrl_casu_tfits *p)
Get the propertylist for the extension header for a given hdrl_casu_tfits image.
cpl_image * hdrl_casu_fits_get_image(hdrl_casu_fits *p)
Get the CPL image from the hdrl_casu_fits object.
hdrl_casu_fits * hdrl_casu_fits_duplicate(hdrl_casu_fits *in)
Copy a hdrl_casu_fits structure into another one.
void hdrl_casu_tfits_delete(hdrl_casu_tfits *p)
Free all the workspace associated with a hdrl_casu_fits object.
void hdrl_casu_fits_delete(hdrl_casu_fits *p)
Free all the workspace associated with a hdrl_casu_fits object.
cpl_table * hdrl_casu_tfits_get_table(hdrl_casu_tfits *p)
Get the CPL table from the hdrl_casu_tfits object.
hdrl_casu_tfits * hdrl_casu_tfits_wrap(cpl_table *tab, cpl_propertylist *ehu)
Wrap an table in a hdrl_casu_tfits wrapper.
cpl_propertylist * hdrl_casu_fits_get_ehu(hdrl_casu_fits *p)
Get the propertylist for the extension header for a given hdrl_casu_fits image.
cpl_error_code hdrl_casu_catalogue(hdrl_casu_fits *infile, hdrl_casu_fits *conf, const cpl_wcs *wcs, cpl_size ipix, double threshold, cpl_size icrowd, double rcore, cpl_size bkg_subtr, cpl_size nbsize, hdrl_catalogue_options cattype, double filtfwhm, double gainloc, double saturation, hdrl_casu_result *res)
Generate object catalogues from input images.
cpl_error_code hdrl_classify(hdrl_casu_tfits *catalogue, double minsize)
Do star/galaxy classification.