si_utl_cube2ima.c

00001 /* $Id: si_utl_cube2ima.c,v 1.7 2005/10/14 14:39:49 amodigli Exp $
00002  *
00003  * This file is part of the IIINSTRUMENT Pipeline
00004  * Copyright (C) 2002,2003 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: amodigli $
00023  * $Date: 2005/10/14 14:39:49 $
00024  * $Revision: 1.7 $
00025  * $Name:  $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*-----------------------------------------------------------------------------
00033                                 Includes
00034  -----------------------------------------------------------------------------*/
00035 
00036 #include <cpl.h>
00037  
00038 
00039 #include "sinfoni_tpl_utils.h"
00040 #include "sinfoni_pfits.h"
00041 #include "sinfoni_tpl_dfs.h"
00042 #include <utl_cube2ima.h>
00043 #include <sinfoni_memory.h>
00044 /*-----------------------------------------------------------------------------
00045                             Functions prototypes
00046  -----------------------------------------------------------------------------*/
00047 
00048 static int si_utl_cube2ima_create(cpl_plugin *) ;
00049 static int si_utl_cube2ima_exec(cpl_plugin *) ;
00050 static int si_utl_cube2ima_destroy(cpl_plugin *) ;
00051 
00052 /*-----------------------------------------------------------------------------
00053                             Static variables
00054  -----------------------------------------------------------------------------*/
00055 
00056 static char si_utl_cube2ima_description[] =
00057 "This recipe performs cube to image comversion.\n"
00058 "The input file is a cube which is contained in the sof file\n"
00059 "Its tag should be CUBE.\n"
00060 "The output is an image resulting from the average of the cube over a  wavelength rage\n"
00061 "which can be set by parameters sinfoni.si_utl_cube2ima.ws sinfoni.si_utl_cube2ima.we\n"
00062 "having aliases 'ws' 'we'\n"
00063 "Information on relevant parameters can be found with\n"
00064 "esorex --params si_utl_cube2ima\n"
00065 "esorex --help si_utl_cube2ima\n"
00066 "\n";
00067 
00068 /*-----------------------------------------------------------------------------
00069                                 Functions code
00070  -----------------------------------------------------------------------------*/
00071 
00072 /*----------------------------------------------------------------------------*/
00080 /*----------------------------------------------------------------------------*/
00081 int cpl_plugin_get_info(cpl_pluginlist * list)
00082 {
00083     cpl_recipe  *   recipe = cpl_calloc(1, sizeof *recipe ) ;
00084     cpl_plugin  *   plugin = &recipe->interface ;
00085 
00086     cpl_plugin_init(plugin,
00087                     CPL_PLUGIN_API,
00088                     SINFONI_BINARY_VERSION,
00089                     CPL_PLUGIN_TYPE_RECIPE,
00090                     "si_utl_cube2ima",
00091                     "Cube to image conversion",
00092                     si_utl_cube2ima_description,
00093                     "Andrea Modigliani",
00094                     "Andrea.Modigliani@eso.org",
00095                     sinfoni_get_license(),
00096                     si_utl_cube2ima_create,
00097                     si_utl_cube2ima_exec,
00098                     si_utl_cube2ima_destroy) ;
00099 
00100     cpl_pluginlist_append(list, plugin) ;
00101     
00102     return 0;
00103 }
00104 
00105 /*----------------------------------------------------------------------------*/
00114 /*----------------------------------------------------------------------------*/
00115 static int si_utl_cube2ima_create(cpl_plugin * plugin)
00116 {
00117     cpl_recipe      * recipe ;
00118     cpl_parameter   * p ;
00119 
00120     /* Get the recipe out of the plugin */
00121     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00122         recipe = (cpl_recipe *)plugin ;
00123     else return -1 ;
00124 
00125     /* Create the parameters list in the cpl_recipe object */
00126     recipe->parameters = cpl_parameterlist_new() ; 
00127 
00128     /* Fill the parameters list */
00129     /* --stropt */
00130 
00131     /* --doubleopt */
00132     p = cpl_parameter_new_value("sinfoni.si_utl_cube2ima.ws", 
00133             CPL_TYPE_DOUBLE, "starting wavelength", "sinfoni.si_utl_cube2ima", 0.9999) ;
00134     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ws") ;
00135     cpl_parameterlist_append(recipe->parameters, p) ;
00136 
00137 
00138     /* --doubleopt */
00139     p = cpl_parameter_new_value("sinfoni.si_utl_cube2ima.we", 
00140             CPL_TYPE_DOUBLE, "starting wavelength", "sinfoni.si_utl_cube2ima", 2.999) ;
00141     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "we") ;
00142     cpl_parameterlist_append(recipe->parameters, p) ;
00143 
00144     /* Return */
00145     return 0;
00146 }
00147 
00148 /*----------------------------------------------------------------------------*/
00154 /*----------------------------------------------------------------------------*/
00155 static int si_utl_cube2ima_exec(cpl_plugin * plugin)
00156 {
00157     cpl_recipe  *   recipe ;
00158     int result=0;
00159     /* Get the recipe out of the plugin */
00160     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00161         recipe = (cpl_recipe *)plugin ;
00162     else return -1 ;
00163     result=si_utl_cube2ima(recipe->parameters, recipe->frames) ;
00164     sinfoni_memory_status();
00165     return result ;
00166 }
00167 
00168 /*----------------------------------------------------------------------------*/
00174 /*----------------------------------------------------------------------------*/
00175 static int si_utl_cube2ima_destroy(cpl_plugin * plugin)
00176 {
00177     cpl_recipe  *   recipe ;
00178     
00179     /* Get the recipe out of the plugin */
00180     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00181         recipe = (cpl_recipe *)plugin ;
00182     else return -1 ;
00183 
00184     cpl_parameterlist_delete(recipe->parameters) ; 
00185     return 0 ;
00186 }
00187 

Generated on Wed Oct 26 13:08:54 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001