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) {
87 calibrated_wave_image);
89 if (calibrated_wave_bpm) {
90 result->calibrated_wave_bpm = cpl_mask_duplicate(calibrated_wave_bpm);
92 if (calibrated_wave_confidence) {
93 result->calibrated_wave_confidence = cpl_image_duplicate(
94 calibrated_wave_confidence);
97 result->filename = cpl_strdup(filename);
99 result->filename = NULL;
102 result->plist = cpl_propertylist_duplicate(plist);
104 result->plist = NULL;
124void en_master_wave_delete(master_wave * target) {
127 cpl_free(target->filename);
129 cpl_mask_delete(target->raw_wave_bpm);
130 cpl_image_delete(target->raw_wave_confidence);
132 cpl_mask_delete(target->calibrated_wave_bpm);
133 cpl_image_delete(target->calibrated_wave_confidence);
134 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