Main Page | Files | Data Structures | Functions | Global Variables |
include/gpiv/gpiv-io.h
Go to the documentation of this file.
00001 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 c-style: "K&R" -*- */
00002 
00003 /*
00004    libgpiv - library for Particle Image Velocimetry
00005 
00006    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Gerber van der Graaf
00007    This file is part of libgpiv.
00008 
00009    Libgpiv is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 2, or (at your option)
00012    any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software Foundation,
00021    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
00022 
00023 
00024 
00025 
00026 ---------------------------------------------------------------
00027 FILENAME:                io.c
00028 LIBRARY:                 libgpiv:
00029 EXTERNAL FUNCTIONS:      gpiv_io_make_fname
00030                          gpiv_read_header
00031 
00032              gpiv_fread_image
00033              gpiv_read_image
00034                          gpiv_write_image
00035 
00036                          gpiv_find_pivdata_origin
00037                          gpiv_read_pivdata
00038                          gpiv_read_pivdata_fastx
00039                          gpiv_write_pivdata
00040              gpiv_fread_scdata
00041                          gpiv_write_scdata
00042 
00043              gpiv_fwrite_griddata
00044              gpiv_print_histo
00045                          gpiv_print_cumhisto_eqdatbin
00046                          gpiv_fprint_cumhisto_eqdatbin
00047 
00048                          gpiv_fread_raw_image
00049                          gpiv_read_raw_image
00050                          gpiv_fwrite_raw_image
00051                          gpiv_write_raw_image
00052 
00053                          gpiv_read_png_image
00054                          gpiv_write_png_image
00055 
00056                          gpiv_fcreate_hdf5
00057                          gpiv_fread_hdf5_image
00058                          gpiv_fwrite_hdf5_image
00059                          gpiv_fread_hdf5_parameters
00060                          gpiv_fwrite_hdf5_parameters
00061                          gpiv_fread_hdf5_position
00062                          gpiv_fwrite_hdf5_position
00063                          gpiv_fwrite_hdf5_piv_position
00064              gpiv_fread_hdf5_pivdata
00065              gpiv_fwrite_hdf5_pivdata
00066                          gpiv_fread_hdf5_scdata
00067              gpiv_fwrite_hdf5_scdata
00068                          gpiv_fread_hdf5_histo
00069              gpiv_fwrite_hdf5_histo
00070 
00071                          gpiv_fread_davis_image
00072                          gpiv_read_davis_image
00073 
00074 LAST MODIFICATION DATE:  $Id: gpiv-io.h,v 1.3 2008-05-07 08:24:44 gerber Exp $
00075  --------------------------------------------------------------- */
00076 
00087 /*---------------------------------------------------------------------------*/
00088 
00089 #ifndef __LIBGPIV_IO_H__
00090 #define __LIBGPIV_IO_H__
00091 
00092 
00093 
00094 #define GPIV_PIV_FMT "%4.0f %4.0f %12.3f %12.3f %12.3f %2d\n"   
00095 #define GPIV_PIV_S_FMT "%-12.5f %-12.5f %-12.5f  %-12.5f  %-6.2f     %-2d\n"    
00096 #define GPIV_SCALAR_FMT "%4.0f %4.0f %12.3f     %2d\n"          
00097 #define GPIV_SCALAR_S_FMT "%-12.3f %-12.3f %-12.3f     %-2d\n"  
00099 #define GPIV_EXT_HEADER        ".h"            
00100 #define GPIV_EXT_RAW_IMAGE     ".r"        
00101 #define GPIV_EXT_PNG_IMAGE     ".png"          
00102 #define GPIV_EXT_PNG_IMAGE_UPCASE ".PNG"       
00103 #define GPIV_EXT_PNG_IMAGE_PROC "_proc.png"    
00104 #define GPIV_EXT_PGM_IMAGE     ".pgm"          
00105 #define GPIV_EXT_PGM_IMAGE_UPCASE ".PGM"       
00106 #define GPIV_EXT_RAW_IMAGE_PROC "_proc.r"      
00107 #define GPIV_EXT_PAR           ".par"          
00109 #define GPIV_EXT_TA            ".ta"           
00110 #define GPIV_EXT_SUBSTR        ".substr"       
00112 #define GPIV_EXT_GPIV          ".h5"           
00113 #define GPIV_EXT_GPIV_UPCASE   ".H5"           
00114 #define GPIV_EXT_PIV           ".piv"          
00115 #define GPIV_EXT_DAVIS         ".img"          
00116 #define GPIV_EXT_DAVIS_UPCASE  ".IMG"          
00117 #define GPIV_EXT_COV           ".cov"          
00118 #define GPIV_EXT_INT           ".int"          
00119 #define GPIV_EXT_OLD           ".old.piv"      
00121 #define GPIV_EXT_ERR_PIV       ".err.piv"      
00122 #define GPIV_EXT_ERR_STAT      ".stat"         
00123 #define GPIV_EXT_PLK           ".plk"          
00124 #define GPIV_EXT_UVHISTO       ".pdf"          
00126 #define GPIV_EXT_VOR           ".vor"          
00127 #define GPIV_EXT_NSTR          ".nstr"         
00128 #define GPIV_EXT_SSTR          ".sstr"         
00129 #define GPIV_EXT_MANI          ".ma.piv"           
00130 #define GPIV_EXT_SA            ".sa.piv"       
00131 #define GPIV_EXT_SC            ".sc.piv"       
00134 /* #define HD5_IMAGE_INT */                          /* Use integer for image data in HDF5 format */
00135 #define GPIV_DAVIS_IMG_DEPTH   12              
00136 #define GPIV_IMG_PARAM_RESOURCES 
00144 enum GpivDataFormat { 
00145     GPIV_RR = 1, 
00146     GPIV_DAV = 2 
00147 };
00148 
00149 
00150 
00159 void 
00160 gpiv_io_make_fname          (const gchar        *fname_base,
00161                     const gchar     *EXT,
00162                     gchar           *fname_out
00163                     );
00164 
00165 
00172 GpivImage *
00173 gpiv_read_image             (FILE           *fp
00174                     );
00175 
00176 
00177 
00187 GpivImage *
00188 gpiv_fread_image            (const gchar        *fname
00189                     );
00190 
00191 
00192 
00199 enum GpivDataFormat
00200 gpiv_find_pivdata_origin        (const gchar        line[GPIV_MAX_CHARS]
00201                     );  
00202 
00203 
00204 
00211 GpivPivData *
00212 gpiv_fread_pivdata          (const gchar        *fname
00213                     );
00214 
00215 
00216 
00225 gchar *
00226 gpiv_fwrite_pivdata         (const gchar        *fname,
00227                     GpivPivData     *piv_data,
00228                     const gboolean      free
00229                     );
00230 
00231 
00232 
00239 GpivPivData *
00240 gpiv_read_pivdata           (FILE           *fp
00241                     );
00242 
00243 
00244 
00252 GpivPivData *
00253 gpiv_read_pivdata_fastx         (FILE           *fp
00254                     );
00255 
00256 
00257 
00266 gchar *
00267 gpiv_write_pivdata          (FILE           *fp,
00268                     GpivPivData     *piv_data,
00269                     const gboolean      free
00270                     );
00271 
00272 
00273 
00280 GpivScalarData *
00281 gpiv_fread_scdata           (const gchar        *fname
00282                     );
00283 
00284 
00285 
00294 gchar *
00295 gpiv_fwrite_scdata          (const gchar        *fname,
00296                     GpivScalarData      *scalar_data,
00297                     const gboolean      free
00298                     );
00299 
00300 
00301 
00308 GpivScalarData *
00309 gpiv_read_scdata            (FILE           *fp
00310                     );
00311 
00312 
00313 
00322 gchar *
00323 gpiv_write_scdata           (FILE           *fp,
00324                     GpivScalarData      *scalar_data,
00325                     const gboolean      free
00326                     );
00327 
00328 
00329 
00338 gchar *
00339 gpiv_write_sc_griddata          (FILE           *fp,
00340                     GpivScalarData      *scalar_data,
00341                     const gboolean      free
00342                     );
00343 
00344 
00345 
00354 gchar *
00355 gpiv_write_sc_mtvgriddata       (FILE           *fp, 
00356                     GpivScalarData      *scalar_data, 
00357                     const gboolean      free
00358                     );
00359 
00360 
00369 gchar *
00370 gpiv_print_histo            (FILE           *fp, 
00371                     GpivBinData     *bin_data, 
00372                     const gboolean      free
00373                     );
00374 
00375 
00386 gchar *
00387 gpiv_print_cumhisto_eqdatbin        (FILE           *fp,
00388                     GpivBinData         *klass,
00389                     const gboolean      free
00390                     );
00391 
00392 
00402 GpivImage *
00403 gpiv_read_raw_image         (FILE           *fp
00404                     );
00405 
00406 
00417 GpivImage *
00418 gpiv_fread_raw_image            (const gchar        *fname
00419                     );
00420 
00421 
00429 gchar *
00430 gpiv_write_raw_image            (FILE           *fp,
00431                     GpivImage       *gpiv_image
00432                     );
00433 
00434 
00442 gchar *
00443 gpiv_fwrite_raw_image           (const gchar        *fname,
00444                     GpivImage       *gpiv_image
00445                     );
00446 
00447 
00454 GpivImage *
00455 gpiv_read_png_image         (FILE           *fp
00456                     );
00457 
00458 
00468 gchar *
00469 gpiv_write_png_image            (FILE           *fp,
00470                     GpivImage       *gpiv_image,
00471                     const gboolean      free
00472                     );
00473 
00474 
00481 gchar *
00482 gpiv_fcreate_hdf5           (const gchar        *fname
00483                     );
00484 
00485 
00494 gchar *
00495 gpiv_fread_hdf5_parameters      (const gchar        *fname,
00496                     const gchar     *par_key,
00497                     void            *pstruct
00498                     );
00499 
00500 
00507 GpivImage *
00508 gpiv_fread_hdf5_image           (const gchar        *fname
00509                     );
00510 
00511 
00520 gchar *
00521 gpiv_fwrite_hdf5_image          (const gchar        *fname, 
00522                     GpivImage       *image,
00523                     const gboolean      free
00524                     );
00525 
00526 
00535 gchar *
00536 gpiv_fwrite_hdf5_parameters     (const gchar        *fname,
00537                     const gchar     *par_key,
00538                     void            *pstruct
00539                     );
00540 
00541 
00549 GpivPivData *
00550 gpiv_fread_hdf5_pivdata         (const gchar        *fname,
00551                     const gchar     *DATA_KEY
00552                     );
00553 
00554 
00564 gchar *
00565 gpiv_fwrite_hdf5_pivdata        (const gchar        *fname, 
00566                     GpivPivData     *piv_data, 
00567                     const gchar     *DATA_KEY,
00568                     const gboolean      free
00569                     );
00570 
00571 
00579 GpivScalarData *
00580 gpiv_fread_hdf5_scdata          (const gchar        *fname,
00581                     const gchar     *DATA_KEY
00582                     );
00583 
00584 
00594 gchar *
00595 gpiv_fwrite_hdf5_scdata         (const gchar        *fname, 
00596                     GpivScalarData      *scalar_data, 
00597                     const gchar     *DATA_KEY,
00598                     const gboolean      free
00599                     );
00600 
00601 
00610 gchar *
00611 gpiv_fread_hdf5_histo           (const gchar        *fname, 
00612                     GpivBinData     *klass, 
00613                     const gchar     *DATA_KEY
00614                          );
00615 
00616 
00625 gchar *
00626 gpiv_fwrite_hdf5_histo          (const gchar            *fname, 
00627                     const GpivBinData      *klass, 
00628                     const gchar            *DATA_KEY
00629                     );
00630 
00631 
00638 GpivImage *
00639 gpiv_read_davis_image           (FILE           *fp
00640                     );
00641 
00642 
00643 #endif /* __LIBGPIV_IO_H__ */