GIRAFFE Pipeline Reference Manual

giextraction.c
1 /*
2  * This file is part of the GIRAFFE Pipeline
3  * Copyright (C) 2002-2019 European Southern Observatory
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23 
24 #include <cxtypes.h>
25 #include <cxmemory.h>
26 
27 #include "giextraction.h"
28 
29 
30 /*
31  * @defgroup giextraction Spectrum Extraction Data Storage
32  *
33  * TBD
34  */
35 
48 GiExtraction*
49 giraffe_extraction_new(void)
50 {
51 
52  GiExtraction* self = cx_malloc(sizeof *self);
53 
54  self->spectra = NULL;
55  self->error = NULL;
56  self->npixels = NULL;
57  self->centroid = NULL;
58  self->model = NULL;
59 
60  return self;
61 
62 }
63 
64 
82 GiExtraction*
83 giraffe_extraction_create(GiImage* spectra, GiImage* error, GiImage* npixels,
84  GiImage* centroid, GiImage* model)
85 {
86 
87  GiExtraction* self = giraffe_extraction_new();
88 
89 
90  if (spectra != NULL) {
91  self->spectra = spectra;
92  }
93 
94  if (error != NULL) {
95  self->error = error;
96  }
97 
98  if (npixels != NULL) {
99  self->npixels = npixels;
100  }
101 
102  if (centroid != NULL) {
103  self->centroid = centroid;
104  }
105 
106  if (model != NULL) {
107  self->model = model;
108  }
109 
110  return self;
111 
112 }
113 
114 
131 void
132 giraffe_extraction_delete(GiExtraction* extraction)
133 {
134 
135  if (extraction != NULL) {
136  cx_free(extraction);
137  }
138 
139  return;
140 
141 }
142 
143 
157 void
158 giraffe_extraction_destroy(GiExtraction* extraction)
159 {
160 
161  if (extraction != NULL) {
162 
163  if (extraction->spectra != NULL) {
164  giraffe_image_delete(extraction->spectra);
165  extraction->spectra = NULL;
166  }
167 
168  if (extraction->error != NULL) {
169  giraffe_image_delete(extraction->error);
170  extraction->error = NULL;
171  }
172 
173  if (extraction->npixels != NULL) {
174  giraffe_image_delete(extraction->npixels);
175  extraction->npixels = NULL;
176  }
177 
178  if (extraction->centroid != NULL) {
179  giraffe_image_delete(extraction->centroid);
180  extraction->centroid = NULL;
181  }
182 
183  if (extraction->model != NULL) {
184  giraffe_image_delete(extraction->model);
185  extraction->model = NULL;
186  }
187 
188  cx_free(extraction);
189  }
190 
191  return;
192 
193 }
void giraffe_image_delete(GiImage *self)
Destroys an image.
Definition: giimage.c:181

This file is part of the GIRAFFE Pipeline Reference Manual 2.16.10.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Thu Dec 15 2022 21:18:51 by doxygen 1.9.1 written by Dimitri van Heesch, © 1997-2004