00001 00002 /*---------------------------------------------------------------------------- 00003 * E.S.O. 00004 *---------------------------------------------------------------------------- 00005 * File name : extraction.h 00006 * Author : Nicolas Devillard 00007 * Created on : Mar 25, 1996 00008 * Hardware : Sun Sparc 20 00009 * Software : ANSI C under Solaris Unix 00010 * Part of ECLIPSE library for Adonis 00011 * Description : data extraction from a cube 00012 *--------------------------------------------------------------------------*/ 00013 00014 /* 00015 00016 $Id: extraction.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $ 00017 $Author: amodigli $ 00018 $Date: 2003/09/03 12:50:47 $ 00019 $Revision: 1.1 $ 00020 00021 */ 00022 00023 #ifndef _EXTRACTION_H_ 00024 #define _EXTRACTION_H_ 00025 00026 00027 /*---------------------------------------------------------------------------- 00028 * Includes 00029 *--------------------------------------------------------------------------*/ 00030 00031 #include <stdio.h> 00032 #include <stdlib.h> 00033 #include <string.h> 00034 00035 #include "file_handling.h" 00036 #include "cube_handling.h" 00037 00038 00039 /*---------------------------------------------------------------------------- 00040 * Defines 00041 *--------------------------------------------------------------------------*/ 00042 00043 00044 #define EXT_PLANE 1 00045 #define EXT_PATTERN 2 00046 #define EXT_CUBE 3 00047 #define EXT_QUAD 4 00048 #define EXT_LIST 5 00049 #define EXT_RECTANGLE 6 00050 00051 00052 #define UPPER_LEFT 1 00053 #define UPPER_RIGHT 2 00054 #define LOWER_RIGHT 3 00055 #define LOWER_LEFT 4 00056 00057 00058 00059 00060 /*---------------------------------------------------------------------------- 00061 * Function prototypes 00062 *--------------------------------------------------------------------------*/ 00063 00064 00065 /*---------------------------------------------------------------------------- 00066 * Function : extract_data_from_cube() 00067 * In : input and output cube names, extraction type, beginning 00068 * and ending plane if necessary, extraction string if 00069 * required. 00070 * the first plane cannot be lesser than 1, 00071 * the last plane can be -1: means last plane in cube. 00072 * Out : error code: 0 if ok, -1 otherwise 00073 * Job : extract data from a cube 00074 * Notice : extraction type can be: 00075 * 00076 * extraction type: requires variables: 00077 * 00078 * EXT_PLANE first, last 00079 * EXT_PATTERN extstring 00080 * EXT_CUBE first, last 00081 * EXT_QUAD extstring 00082 * 00083 *--------------------------------------------------------------------------*/ 00084 00085 int 00086 extract_data_from_cube( 00087 char * inputname, 00088 char * outputname, 00089 int ExtType, 00090 int first, 00091 int last, 00092 char * extstring 00093 ) ; 00094 00095 00096 00097 00098 /*---------------------------------------------------------------------------- 00099 * Function : get_planes_with_pattern() 00100 * In : 1 cube, pattern string, im. per cycle step binary value 00101 * Out : 1 cube 00102 * Job : extract plane in a cube according to a pattern 00103 * The input cube contains ONLY 1 PATTERN! 00104 * Notice : a pattern is a character string, e.g. "1001" describing 00105 * how object/sky are organized, 1 meaning object, 0 sky. 00106 * The binary value is an integer, use 0 to extract skies, 00107 * 1 to extract objects. 00108 *--------------------------------------------------------------------------*/ 00109 00110 OneCube * 00111 get_planes_with_pattern( 00112 OneCube * cube_in, 00113 char * pattern, 00114 int im_per_step, 00115 int plane_type 00116 ) ; 00117 00118 00119 00120 /*---------------------------------------------------------------------------- 00121 * Function : extract_cube_from_cube() 00122 * In : 1 cube, first and last plane # 00123 * Out : 1 cube 00124 * Job : extract a continuous cube from another cube 00125 * Notice : plane #: limits are inclusive 00126 * plane # go from 1 to n_planes 00127 *--------------------------------------------------------------------------*/ 00128 00129 OneCube * 00130 extract_cube_from_cube( 00131 char * cubename, 00132 int p_begin, 00133 int p_end 00134 ) ; 00135 00136 00137 /*---------------------------------------------------------------------------- 00138 * Function : convert_listfile_to_binary() 00139 * In : list file name 00140 * Out : NULL terminated string containing '0' and '1' characters 00141 * Job : convert a list of plane number into a string readily 00142 * usable with an EXT_PATTERN extraction command. 00143 * Notice : 00144 *--------------------------------------------------------------------------*/ 00145 00146 char * 00147 convert_listfile_to_binary(char *listname) ; 00148 00149 00150 /*---------------------------------------------------------------------------- 00151 * Function : extract_slit_from_cube() 00152 * In : 1 cube, rectangular zone coordinates 00153 * Out : 1 cube 00154 * Job : extract a rectangular zone in a cube, to a cube 00155 * Notice : coordinates define the lower left and upper right 00156 * corners, corners are inclusive. 00157 *--------------------------------------------------------------------------*/ 00158 00159 OneCube * 00160 extract_slit_from_cube( 00161 OneCube * cube_in, 00162 int loleft_x, 00163 int loleft_y, 00164 int upright_x, 00165 int upright_y 00166 ) ; 00167 00168 00169 /*---------------------------------------------------------------------------- 00170 * Function : extract_slit_from_image() 00171 * In : 1 image, rectangular zone coordinates 00172 * Out : 1 image 00173 * Job : extract a rectangular zone from an image 00174 * Notice : input lower left and upper right corner of the 00175 * rectangular zone to extract. Borders are included in the 00176 * extraction. 00177 * first pixel has coordinates (1,1) in lower left corner 00178 * last pixel has coord. (lx, ly) in upper right corner 00179 * (FITS convention) 00180 *--------------------------------------------------------------------------*/ 00181 00182 OneImage * 00183 extract_slit_from_image( 00184 OneImage * cube_in, 00185 int loleft_x, 00186 int loleft_y, 00187 int upright_x, 00188 int upright_y 00189 ) ; 00190 00191 00192 /*---------------------------------------------------------------------------- 00193 * Function : extract_row_from_image() 00194 * In : 1 image, row number 00195 * Out : array of pixelvalues 00196 * Job : extract a row from an image 00197 * Notice : first pixel starts at position 0 00198 *--------------------------------------------------------------------------*/ 00199 00200 pixelvalue * 00201 extract_row_from_image( 00202 OneImage * image1, 00203 int row_num 00204 ) ; 00205 00206 00207 /*---------------------------------------------------------------------------- 00208 * Function : extract_column_from_image() 00209 * In : 1 image, column number 00210 * Out : array of pixelvalues 00211 * Job : extract a column from an image 00212 * Notice : first pixel starts at position 0 00213 *--------------------------------------------------------------------------*/ 00214 00215 pixelvalue * 00216 extract_column_from_image( 00217 OneImage * image1, 00218 int col_num 00219 ) ; 00220 00221 00222 /*---------------------------------------------------------------------------- 00223 * Function : extract_time_line() 00224 * In : 1 cube, x and y position 00225 * Out : pointer to a 1d image 00226 * Job : extracts a spectrum along the z-axis of a cube and 00227 * returns it as an image. 00228 * Notice : 00229 *--------------------------------------------------------------------------*/ 00230 00231 OneImage * 00232 extract_time_line( 00233 OneCube * cube1, 00234 int x, 00235 int y 00236 ) ; 00237 00238 00239 /*---------------------------------------------------------------------------- 00240 * Function : extract_quadrant() 00241 * In : 1 cube 00242 * Out : 1 newly allocated cube 00243 * Job : extract a quadrant from a cube 00244 * Notice : quadrants are identified as: 00245 * UPPER_LEFT, UPPER_RIGHT, LOWER_RIGHT, LOWER_LEFT 00246 * which are respectively defined as 1, 2, 3, 4. 00247 *--------------------------------------------------------------------------*/ 00248 00249 OneCube * 00250 extract_quadrant( 00251 OneCube * cube1, 00252 int quad_number 00253 ) ; 00254 00255 00256 00257 #endif 00258 /*--------------------------------------------------------------------------*/
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001