GIRAFFE Pipeline Reference Manual

giextraction.c
1 /* $Id$
2  *
3  * This file is part of the GIRAFFE Pipeline
4  * Copyright (C) 2002-2006 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author$
23  * $Date$
24  * $Revision$
25  * $Name$
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
31 
32 #include <cxtypes.h>
33 #include <cxmemory.h>
34 
35 #include "giextraction.h"
36 
37 
38 /*
39  * @defgroup giextraction Spectrum Extraction Data Storage
40  *
41  * TBD
42  */
43 
56 GiExtraction*
57 giraffe_extraction_new(void)
58 {
59 
60  GiExtraction* self = cx_malloc(sizeof *self);
61 
62  self->spectra = NULL;
63  self->error = NULL;
64  self->npixels = NULL;
65  self->centroid = NULL;
66  self->model = NULL;
67 
68  return self;
69 
70 }
71 
72 
90 GiExtraction*
91 giraffe_extraction_create(GiImage* spectra, GiImage* error, GiImage* npixels,
92  GiImage* centroid, GiImage* model)
93 {
94 
95  GiExtraction* self = giraffe_extraction_new();
96 
97 
98  if (spectra != NULL) {
99  self->spectra = spectra;
100  }
101 
102  if (error != NULL) {
103  self->error = error;
104  }
105 
106  if (npixels != NULL) {
107  self->npixels = npixels;
108  }
109 
110  if (centroid != NULL) {
111  self->centroid = centroid;
112  }
113 
114  if (model != NULL) {
115  self->model = model;
116  }
117 
118  return self;
119 
120 }
121 
122 
139 void
140 giraffe_extraction_delete(GiExtraction* extraction)
141 {
142 
143  if (extraction != NULL) {
144  cx_free(extraction);
145  }
146 
147  return;
148 
149 }
150 
151 
165 void
166 giraffe_extraction_destroy(GiExtraction* extraction)
167 {
168 
169  if (extraction != NULL) {
170 
171  if (extraction->spectra != NULL) {
172  giraffe_image_delete(extraction->spectra);
173  extraction->spectra = NULL;
174  }
175 
176  if (extraction->error != NULL) {
177  giraffe_image_delete(extraction->error);
178  extraction->error = NULL;
179  }
180 
181  if (extraction->npixels != NULL) {
182  giraffe_image_delete(extraction->npixels);
183  extraction->npixels = NULL;
184  }
185 
186  if (extraction->centroid != NULL) {
187  giraffe_image_delete(extraction->centroid);
188  extraction->centroid = NULL;
189  }
190 
191  if (extraction->model != NULL) {
192  giraffe_image_delete(extraction->model);
193  extraction->model = NULL;
194  }
195 
196  cx_free(extraction);
197  }
198 
199  return;
200 
201 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.12.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Mon Mar 24 2014 11:43:52 by doxygen 1.8.2 written by Dimitri van Heesch, © 1997-2004