GIRAFFE Pipeline Reference Manual

giextraction.c

00001 /* $Id: giextraction.c,v 1.2 2008/01/08 14:25:19 rpalsa Exp $
00002  *
00003  * This file is part of the GIRAFFE Pipeline
00004  * Copyright (C) 2002-2006 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 /*
00022  * $Author: rpalsa $
00023  * $Date: 2008/01/08 14:25:19 $
00024  * $Revision: 1.2 $
00025  * $Name: giraffe-2_10 $
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  * @defgroup giextraction Spectrum Extraction Data Storage
00040  *
00041  * TBD
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 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.10.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Thu Mar 7 14:11:02 2013 by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2004