giextraction.c
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 # include <config.h>
00030 #endif
00031
00032 #include <cxtypes.h>
00033 #include <cxmemory.h>
00034
00035 #include "giextraction.h"
00036
00037
00038
00039
00040
00041
00042
00043
00056 GiExtraction*
00057 giraffe_extraction_new(void)
00058 {
00059
00060 GiExtraction* self = cx_malloc(sizeof *self);
00061
00062 self->spectra = NULL;
00063 self->error = NULL;
00064 self->npixels = NULL;
00065 self->centroid = NULL;
00066 self->model = NULL;
00067
00068 return self;
00069
00070 }
00071
00072
00090 GiExtraction*
00091 giraffe_extraction_create(GiImage* spectra, GiImage* error, GiImage* npixels,
00092 GiImage* centroid, GiImage* model)
00093 {
00094
00095 GiExtraction* self = giraffe_extraction_new();
00096
00097
00098 if (spectra != NULL) {
00099 self->spectra = spectra;
00100 }
00101
00102 if (error != NULL) {
00103 self->error = error;
00104 }
00105
00106 if (npixels != NULL) {
00107 self->npixels = npixels;
00108 }
00109
00110 if (centroid != NULL) {
00111 self->centroid = centroid;
00112 }
00113
00114 if (model != NULL) {
00115 self->model = model;
00116 }
00117
00118 return self;
00119
00120 }
00121
00122
00139 void
00140 giraffe_extraction_delete(GiExtraction* extraction)
00141 {
00142
00143 if (extraction != NULL) {
00144 cx_free(extraction);
00145 }
00146
00147 return;
00148
00149 }
00150
00151
00165 void
00166 giraffe_extraction_destroy(GiExtraction* extraction)
00167 {
00168
00169 if (extraction != NULL) {
00170
00171 if (extraction->spectra != NULL) {
00172 giraffe_image_delete(extraction->spectra);
00173 extraction->spectra = NULL;
00174 }
00175
00176 if (extraction->error != NULL) {
00177 giraffe_image_delete(extraction->error);
00178 extraction->error = NULL;
00179 }
00180
00181 if (extraction->npixels != NULL) {
00182 giraffe_image_delete(extraction->npixels);
00183 extraction->npixels = NULL;
00184 }
00185
00186 if (extraction->centroid != NULL) {
00187 giraffe_image_delete(extraction->centroid);
00188 extraction->centroid = NULL;
00189 }
00190
00191 if (extraction->model != NULL) {
00192 giraffe_image_delete(extraction->model);
00193 extraction->model = NULL;
00194 }
00195
00196 cx_free(extraction);
00197 }
00198
00199 return;
00200
00201 }