38#include "eris_nix_master_wave.h"
39#include "eris_nix_utils.h"
63 const hdrl_image * raw_wave_image,
64 const cpl_mask * raw_wave_bpm,
65 const cpl_image * raw_wave_confidence,
66 const hdrl_image * calibrated_wave_image,
67 const cpl_mask * calibrated_wave_bpm,
68 const cpl_image * calibrated_wave_confidence,
69 const char * filename,
70 const cpl_propertylist * plist) {
72 if (cpl_error_get_code() != CPL_ERROR_NONE)
return NULL;
76 cpl_ensure(raw_wave_image, CPL_ERROR_NULL_INPUT, NULL);
77 cpl_ensure(raw_wave_bpm, CPL_ERROR_NULL_INPUT, NULL);
78 cpl_ensure(raw_wave_confidence, CPL_ERROR_NULL_INPUT, NULL);
80 master_wave * result = cpl_malloc(
sizeof(master_wave));
83 result->raw_wave_bpm = cpl_mask_duplicate(raw_wave_bpm);
84 result->raw_wave_confidence = cpl_image_duplicate(raw_wave_confidence);
85 if (calibrated_wave_image != NULL) {
87 calibrated_wave_image);
89 result->calibrated_wave_image = NULL;
91 if (calibrated_wave_bpm != NULL) {
92 result->calibrated_wave_bpm = cpl_mask_duplicate(calibrated_wave_bpm);
94 result->calibrated_wave_bpm = NULL;
96 if (calibrated_wave_confidence != NULL) {
97 result->calibrated_wave_confidence = cpl_image_duplicate(
98 calibrated_wave_confidence);
100 result->calibrated_wave_confidence = NULL;
102 if (filename != NULL) {
103 result->filename = cpl_strdup(filename);
105 result->filename = NULL;
108 result->plist = cpl_propertylist_duplicate(plist);
110 result->plist = NULL;
130void en_master_wave_delete(master_wave * target) {
133 cpl_free(target->filename);
135 cpl_mask_delete(target->raw_wave_bpm);
136 cpl_image_delete(target->raw_wave_confidence);
138 cpl_mask_delete(target->calibrated_wave_bpm);
139 cpl_image_delete(target->calibrated_wave_confidence);
140 cpl_propertylist_delete(target->plist);
master_wave * en_master_wave_create(const hdrl_image *raw_wave_image, const cpl_mask *raw_wave_bpm, const cpl_image *raw_wave_confidence, const hdrl_image *calibrated_wave_image, const cpl_mask *calibrated_wave_bpm, const cpl_image *calibrated_wave_confidence, const char *filename, const cpl_propertylist *plist)
Create a new master_wave struct and initialise the contents.
hdrl_image * hdrl_image_duplicate(const hdrl_image *himg)
copy hdrl_image
void hdrl_image_delete(hdrl_image *himg)
delete hdrl_image