32#include "cr2res_nodding.h"
33#include "cr2res_pfits.h"
52 cr2res_nodding_pos * out ;
56 if (in == NULL)
return NULL ;
59 nframes = cpl_frameset_get_size(in) ;
62 out = cpl_malloc(nframes *
sizeof(cr2res_nodding_pos));
63 for (i = 0; i < nframes; i++) out[i] = CR2RES_NODDING_NONE;
66 for (i=0 ; i< nframes ; i++) {
67 cpl_propertylist * plist ;
68 plist = cpl_propertylist_load(cpl_frame_get_filename(
69 cpl_frameset_get_position_const(in, i)), 0) ;
71 cpl_propertylist_delete(plist) ;
85 if (pos == CR2RES_NODDING_A)
return 'A' ;
86 if (pos == CR2RES_NODDING_B)
return 'B' ;
101 const cpl_frameset * in,
102 const cr2res_nodding_pos * positions,
103 cpl_frameset ** pos_a,
104 cpl_frameset ** pos_b)
106 cpl_frameset * nod_a ;
107 cpl_frameset * nod_b ;
108 const cpl_frame * cur_frame ;
109 cpl_size alist_idx, blist_idx, i, nframes ;
112 if (in==NULL || positions==NULL || pos_a==NULL || pos_b==NULL)
116 nframes = cpl_frameset_get_size(in) ;
117 alist_idx = blist_idx = 0 ;
120 nod_a = cpl_frameset_new() ;
121 nod_b = cpl_frameset_new() ;
124 for (i=0 ; i<nframes ; i++) {
125 if (positions[i] == CR2RES_NODDING_A) {
126 cur_frame = cpl_frameset_get_position_const(in, i) ;
127 cpl_frameset_insert(nod_a, cpl_frame_duplicate(cur_frame)) ;
131 if (positions[i] == CR2RES_NODDING_B) {
132 cur_frame = cpl_frameset_get_position_const(in, i) ;
133 cpl_frameset_insert(nod_b, cpl_frame_duplicate(cur_frame)) ;
154 const hdrl_imagelist * in,
155 const cr2res_nodding_pos * positions,
156 hdrl_imagelist ** pos_a,
157 hdrl_imagelist ** pos_b)
159 hdrl_imagelist * nod_a ;
160 hdrl_imagelist * nod_b ;
161 hdrl_image * cur_ima ;
162 cpl_size alist_idx, blist_idx, i, nima ;
165 if (in==NULL || positions==NULL || pos_a==NULL || pos_b==NULL)
170 alist_idx = blist_idx = 0 ;
177 for (i=0 ; i<nima ; i++) {
178 if (positions[i] == CR2RES_NODDING_A) {
184 if (positions[i] == CR2RES_NODDING_B) {
cr2res_nodding_pos cr2res_pfits_get_nodding_pos(const cpl_propertylist *plist)
find out the nodding position
int cr2res_combine_nodding_split_frames(const cpl_frameset *in, const cr2res_nodding_pos *positions, cpl_frameset **pos_a, cpl_frameset **pos_b)
Split A/B positions in 2 framesets.
char cr2res_nodding_position_char(cr2res_nodding_pos pos)
Get the nodding position character for display.
int cr2res_combine_nodding_split(const hdrl_imagelist *in, const cr2res_nodding_pos *positions, hdrl_imagelist **pos_a, hdrl_imagelist **pos_b)
Split A/B positions in 2 image lists.
cr2res_nodding_pos * cr2res_nodding_read_positions(const cpl_frameset *in)
Get the nodding positions from a frame set.
hdrl_image * hdrl_image_duplicate(const hdrl_image *himg)
copy hdrl_image
cpl_error_code hdrl_imagelist_set(hdrl_imagelist *himlist, hdrl_image *himg, cpl_size pos)
Insert an image into an imagelist.
cpl_size hdrl_imagelist_get_size(const hdrl_imagelist *himlist)
Get the number of images in the imagelist.
hdrl_imagelist * hdrl_imagelist_new(void)
Create an empty imagelist.
hdrl_image * hdrl_imagelist_get(const hdrl_imagelist *himlist, cpl_size inum)
Get an image from a list of images.