31#include "moo_detector.h"
34#include "moo_region.h"
61 moo_region *res = (moo_region *)cpl_calloc(1,
sizeof(moo_region));
99 cpl_ensure(value != NULL, CPL_ERROR_NULL_INPUT, NULL);
101 moo_region *res = NULL;
103 int nb = sscanf(value,
"%d,%d,%d,%d", &a, &b, &c, &d);
125 cpl_msg_info(
"moo_region",
"REGION %d %d %d %d", self->xb, self->yb,
145 cpl_ensure(size > 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
146 moo_regionlist *res =
147 (moo_regionlist *)cpl_calloc(1,
sizeof(moo_regionlist));
150 res->list = (moo_region **)cpl_calloc(size,
sizeof(moo_region *));
167 for (
int i = 0; i < self->size; i++) {
170 cpl_free(self->list);
189 cpl_ensure(value != NULL, CPL_ERROR_NULL_INPUT, NULL);
192 const char *delim =
":";
194 char *cvalue = cpl_strdup(value);
195 token = strtok(cvalue, delim);
199 while (token != NULL) {
203 token = strtok(NULL, delim);
229 cpl_ensure(layout_frame != NULL, CPL_ERROR_NULL_INPUT, NULL);
230 cpl_ensure(ntas >= 1 && ntas <= 2, CPL_ERROR_ILLEGAL_INPUT, NULL);
232 const char *layout_name = NULL;
233 layout_name = cpl_frame_get_filename(layout_frame);
239 int nrow = cpl_table_get_nrow(layout);
243 for (
int i = 0; i < nrow; i++) {
245 int llx = cpl_table_get_int(layout, MOO_REGION_LAYOUT_LLX, i, NULL);
246 int lly = cpl_table_get_int(layout, MOO_REGION_LAYOUT_LLY, i, NULL);
247 int urx = cpl_table_get_int(layout, MOO_REGION_LAYOUT_URX, i, NULL);
248 int ury = cpl_table_get_int(layout, MOO_REGION_LAYOUT_URY, i, NULL);
256 cpl_table_delete(layout);
272 cpl_msg_info(
"moo_region",
"REGION_LIST %d", self->size);
273 for (
int i = 0; i < self->size; i++) {
const char * moo_detector_get_extname(moo_detector_type type, int ntas)
Get the extension name of a detector.
enum _moo_detector_type_ moo_detector_type
The type code type.
cpl_table * moo_fits_load_extension_table(const char *filename, const char *name, const char *detectorname)
Load a table from FITS file.
moo_regionlist * moo_regionlist_new(int size)
Create a new moo_region.
void moo_regionlist_dump(moo_regionlist *self)
dump a moo_regionlist
moo_regionlist * moo_regionlist_load_layout(const cpl_frame *layout_frame, moo_detector_type type, int ntas)
load a moo_regionlist
void moo_region_dump(moo_region *self)
dump a moo_region
moo_region * moo_region_load(const char *value)
load a moo_region
void moo_region_delete(moo_region *self)
Delete a moo_region.
moo_region * moo_region_new(void)
Create a new moo_region.
moo_regionlist * moo_regionlist_load(const char *value)
load a moo_regionlist
void moo_regionlist_delete(moo_regionlist *self)
Delete a moo_regionlist.