image_handling.h

00001 
00002 /*----------------------------------------------------------------------------
00003  *                                  E.S.O.
00004  *----------------------------------------------------------------------------
00005  * File name    :   image_handling.h
00006  * Author       :   Nicolas Devillard
00007  * Created on   :   Aug 17, 1995
00008  * Hardware     :   Sun Sparc 20
00009  * Software     :   ANSI C under Solaris Unix
00010  *                  Part of ECLIPSE library for Adonis
00011  * Description  :   image data structure handling routines
00012  *--------------------------------------------------------------------------*/
00013 
00014 /*
00015 
00016  $Id: image_handling.h,v 1.3 2005/04/08 13:37:49 amodigli Exp $
00017  $Author: amodigli $
00018  $Date: 2005/04/08 13:37:49 $
00019  $Revision: 1.3 $
00020 
00021  */
00022 
00023 #ifndef _IMAGE_HANDLING_H_
00024 #define _IMAGE_HANDLING_H_
00025 
00026 
00027 /*----------------------------------------------------------------------------
00028  *                              Includes
00029  *--------------------------------------------------------------------------*/
00030 
00031 #include <stdio.h>
00032 #include <string.h>
00033 #include <math.h>
00034 #include <malloc.h>
00035 
00036 #include "memory.h"
00037 #include "cube_handling.h"
00038 #include "fits_rw.h"
00039 
00040 
00041 
00042 
00043 /*----------------------------------------------------------------------------
00044  *                      Function ANSI C prototypes
00045  *--------------------------------------------------------------------------*/
00046 
00047 
00048 /*---------------------------------------------------------------------------
00049  * Function :   new_image()
00050  * In       :   image size (x and y)
00051  * Out      :   New allocated structure
00052  * Job      :   Allocates an image structure and fills it with
00053  *              relevant information. Also allocates data buffer
00054  * Notice   :   Object constructor
00055  *--------------------------------------------------------------------------*/
00056 /*<python>*/
00057 OneImage *
00058 new_image(
00059     int     size_x,
00060     int     size_y
00061 ) ;
00062 /*</python>*/
00063 
00064 void
00065 fill_new_image(
00066     int     size_x,
00067     int     size_y,
00068     OneImage    *   new_image,
00069     pixelvalue  *   data
00070 ) ;
00071 
00072 
00073 /*---------------------------------------------------------------------------
00074  * Function :   destroy_image()
00075  * In       :   Pointer to allocated structure
00076  * Out      :   void
00077  * Job      :   free memory associated to an image structure
00078  * Notice   :   Object destructor
00079  *--------------------------------------------------------------------------*/
00080 /*<python>*/
00081 void
00082 destroy_image(OneImage * to_destroy) ; 
00083 /*</python>*/
00084 
00085 
00086 /*---------------------------------------------------------------------------
00087  * Function :   load_image()
00088  * In       :   File name
00089  * Out      :   Pointer to newly allocated image
00090  * Job      :   Loads an image from a file
00091  * Notice   :
00092  *--------------------------------------------------------------------------*/
00093 
00094 /*<python>*/
00095 OneImage *
00096 load_image(const char * filename);
00097 /*</python>*/
00098 
00099 
00100 /*---------------------------------------------------------------------------
00101  * Function :   load_plane_from_fits()
00102  * In       :   filename, cube characteristics, requested plane
00103  * Out      :   1 image
00104  * Job      :   Extracts one image from a FITS cube on disk
00105  * Notice   :   Prevents memory saturation
00106  *              Plane number from 0 to Nplanes-1
00107  *--------------------------------------------------------------------------*/
00108 OneImage *
00109 load_plane_from_fits(
00110     char        *   filename,
00111     cube_info   *   fileinfo,
00112     int             n_plane
00113 ) ;
00114 
00115 
00116 /*---------------------------------------------------------------------------
00117  * Function :   save_image_to_fits()
00118  * In       :   1 image, file name
00119  * Out      :   void
00120  * Job      :   save an image structure to a FITS file
00121  * Notice   :   saved as a cube with one single plane
00122  *--------------------------------------------------------------------------*/
00123 
00124 /*<python>*/
00125 void 
00126 save_image_to_fits(
00127     OneImage    *   to_save,
00128     char        *   filename,
00129     int             pixel_type
00130 ) ;
00131 /*</python>*/
00132 
00133 
00134 /*---------------------------------------------------------------------------
00135  * Function :   save_image_to_fits_hdrcopy()
00136  * In       :   1 image, file name
00137  * Out      :   void
00138  * Job      :   save an image structure to a FITS file
00139  * Notice   :   saved as a cube with one plane, saving reference header
00140  * Author   :   CDdA from ND 
00141  *--------------------------------------------------------------------------*/
00142 
00143 /*<python>*/
00144 void 
00145 save_image_to_fits_hdrcopy(
00146     OneImage    *   to_save,
00147     char        *   filename,
00148     char        *   ref_filename,
00149     int             pixel_type
00150 ) ;
00151 /*</python>*/
00152 
00153 /*---------------------------------------------------------------------------
00154  * Function :   save_image_to_fits_hdr_dump()
00155  * In       :   1 image, file name, 1 FITS header
00156  * Out      :   void
00157  * Job      :   save an image structure to a FITS file with given header
00158  * Notice   :   saved as a cube with one plane, saving reference header
00159  *--------------------------------------------------------------------------*/
00160 
00161 /*<python>*/
00162 void 
00163 save_image_to_fits_hdr_dump(
00164     OneImage    *   to_save,
00165     char        *   filename,
00166     fits_header *   fh,
00167     int             pixel_type
00168 );
00169 /*</python>*/
00170    
00171 
00172 /*---------------------------------------------------------------------------
00173  * Function :   copy_image()
00174  * In       :   1 image
00175  * Out      :   1 newly allocated image 
00176  * Job      :   copy an image structure
00177  * Notice   :
00178  *--------------------------------------------------------------------------*/
00179 /*<python>*/
00180 OneImage *
00181 copy_image(OneImage * src_img) ;
00182 /*</python>*/
00183 
00184 
00185 
00186 /*---------------------------------------------------------------------------
00187  * Function :   paste_image_in_image()
00188  * In       :   2 images + position where to paste
00189  * Out      :   1 newly allocated image
00190  * Job      :   Paste an image into another at a given position
00191  * Notice   :   Position where to paste refers to coordinates in the frame
00192  *              image. It is the position where to paste the first pixel of
00193  *              insert image (first pixel being at lower left corner)
00194  *              First pixel is lower left at coordinates (1,1)
00195  *--------------------------------------------------------------------------*/
00196 
00197 OneImage *
00198 paste_image_in_image(
00199     OneImage    *frame,
00200     OneImage    *insert,
00201     ulong32     xpos,
00202     ulong32     ypos
00203 ) ;
00204 
00205     
00206 
00207 
00208 /*---------------------------------------------------------------------------
00209  * Function :   load_plane_from_cube_if_exist()
00210  * In       :   pointers to cube and plane requested
00211  * Out      :   Pointer to new image
00212  * Job      :   loads an image from a cube if the cube is big enough and
00213  *              returns an image full of zeros otherwise
00214  * Notice   :   returns NULL in case of error, N starts with 0
00215  * Author   :   CDdA
00216  *--------------------------------------------------------------------------*/
00217 
00218 OneImage *
00219 load_plane_from_cube_if_exist(
00220     OneCube *   cube_in,
00221     int         plane_num
00222 ) ;
00223 
00224 
00225 
00226 /*---------------------------------------------------------------------------
00227    Function :   data_format_compatible()
00228    In       :   pixel type -32 or -64
00229    Out      :   boolean
00230    Job      :   find out if the internal pixelvalue type is compatible
00231                 with the FITS type given in argument.
00232    Notice   :   also checks for byte ordering compatibility.
00233  ---------------------------------------------------------------------------*/
00234 
00235 
00236 boolean data_format_compatible(int ptype) ;
00237 
00238 
00239 #endif
00240 /*--------------------------------------------------------------------------*/

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