Main Page | Files | Data Structures | Functions | Global Variables |
gpiv-io.h
Go to the documentation of this file.
1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 c-style: "K&R" -*- */
2 
3 /*
4  libgpiv - library for Particle Image Velocimetry
5 
6  Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Gerber van der Graaf
7  This file is part of libgpiv.
8 
9  Libgpiv is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2, or (at your option)
12  any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software Foundation,
21  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 
24 
25 
26 ---------------------------------------------------------------
27 FILENAME: io.c
28 LIBRARY: libgpiv:
29 EXTERNAL FUNCTIONS: gpiv_io_make_fname
30  gpiv_read_header
31 
32  gpiv_fread_image
33  gpiv_read_image
34  gpiv_write_image
35 
36  gpiv_find_pivdata_origin
37  gpiv_read_pivdata
38  gpiv_read_pivdata_fastx
39  gpiv_write_pivdata
40  gpiv_fread_scdata
41  gpiv_write_scdata
42 
43  gpiv_fwrite_griddata
44  gpiv_print_histo
45  gpiv_print_cumhisto_eqdatbin
46  gpiv_fprint_cumhisto_eqdatbin
47 
48  gpiv_fread_raw_image
49  gpiv_read_raw_image
50  gpiv_fwrite_raw_image
51  gpiv_write_raw_image
52 
53  gpiv_read_png_image
54  gpiv_write_png_image
55 
56  gpiv_fcreate_hdf5
57  gpiv_fread_hdf5_image
58  gpiv_fwrite_hdf5_image
59  gpiv_fread_hdf5_parameters
60  gpiv_fwrite_hdf5_parameters
61  gpiv_fread_hdf5_position
62  gpiv_fwrite_hdf5_position
63  gpiv_fwrite_hdf5_piv_position
64  gpiv_fread_hdf5_pivdata
65  gpiv_fwrite_hdf5_pivdata
66  gpiv_fread_hdf5_scdata
67  gpiv_fwrite_hdf5_scdata
68  gpiv_fread_hdf5_histo
69  gpiv_fwrite_hdf5_histo
70 
71  gpiv_fread_davis_image
72  gpiv_read_davis_image
73 
74 LAST MODIFICATION DATE: $Id: gpiv-io.h,v 1.3 2008-05-07 08:24:44 gerber Exp $
75  --------------------------------------------------------------- */
76 
87 /*---------------------------------------------------------------------------*/
88 
89 #ifndef __LIBGPIV_IO_H__
90 #define __LIBGPIV_IO_H__
91 
92 
93 
94 #define GPIV_PIV_FMT "%4.0f %4.0f %12.3f %12.3f %12.3f %2d\n"
95 #define GPIV_PIV_S_FMT "%-12.5f %-12.5f %-12.5f %-12.5f %-6.2f %-2d\n"
96 #define GPIV_SCALAR_FMT "%4.0f %4.0f %12.3f %2d\n"
97 #define GPIV_SCALAR_S_FMT "%-12.3f %-12.3f %-12.3f %-2d\n"
99 #define GPIV_EXT_HEADER ".h"
100 #define GPIV_EXT_RAW_IMAGE ".r"
101 #define GPIV_EXT_PNG_IMAGE ".png"
102 #define GPIV_EXT_PNG_IMAGE_UPCASE ".PNG"
103 #define GPIV_EXT_PNG_IMAGE_PROC "_proc.png"
104 #define GPIV_EXT_PGM_IMAGE ".pgm"
105 #define GPIV_EXT_PGM_IMAGE_UPCASE ".PGM"
106 #define GPIV_EXT_RAW_IMAGE_PROC "_proc.r"
107 #define GPIV_EXT_PAR ".par"
109 #define GPIV_EXT_TA ".ta"
110 #define GPIV_EXT_SUBSTR ".substr"
112 #define GPIV_EXT_GPIV ".h5"
113 #define GPIV_EXT_GPIV_UPCASE ".H5"
114 #define GPIV_EXT_PIV ".piv"
115 #define GPIV_EXT_DAVIS ".img"
116 #define GPIV_EXT_DAVIS_UPCASE ".IMG"
117 #define GPIV_EXT_COV ".cov"
118 #define GPIV_EXT_INT ".int"
119 #define GPIV_EXT_OLD ".old.piv"
121 #define GPIV_EXT_ERR_PIV ".err.piv"
122 #define GPIV_EXT_ERR_STAT ".stat"
123 #define GPIV_EXT_PLK ".plk"
124 #define GPIV_EXT_UVHISTO ".pdf"
126 #define GPIV_EXT_VOR ".vor"
127 #define GPIV_EXT_NSTR ".nstr"
128 #define GPIV_EXT_SSTR ".sstr"
129 #define GPIV_EXT_MANI ".ma.piv"
130 #define GPIV_EXT_SA ".sa.piv"
131 #define GPIV_EXT_SC ".sc.piv"
134 /* #define HD5_IMAGE_INT */ /* Use integer for image data in HDF5 format */
135 #define GPIV_DAVIS_IMG_DEPTH 12
136 #define GPIV_IMG_PARAM_RESOURCES
144 enum GpivDataFormat {
145  GPIV_RR = 1,
146  GPIV_DAV = 2
147 };
159 void
160 gpiv_io_make_fname (const gchar *fname_base,
161  const gchar *EXT,
162  gchar *fname_out
163  );
164 
165 
172 GpivImage *
173 gpiv_read_image (FILE *fp
174  );
175 
176 
177 
187 GpivImage *
188 gpiv_fread_image (const gchar *fname
189  );
190 
191 
192 
199 enum GpivDataFormat
200 gpiv_find_pivdata_origin (const gchar line[GPIV_MAX_CHARS]
201  );
202 
203 
204 
211 GpivPivData *
212 gpiv_fread_pivdata (const gchar *fname
213  );
214 
215 
216 
225 gchar *
226 gpiv_fwrite_pivdata (const gchar *fname,
227  GpivPivData *piv_data,
228  const gboolean free
229  );
230 
231 
232 
239 GpivPivData *
240 gpiv_read_pivdata (FILE *fp
241  );
242 
243 
244 
252 GpivPivData *
253 gpiv_read_pivdata_fastx (FILE *fp
254  );
255 
256 
257 
266 gchar *
267 gpiv_write_pivdata (FILE *fp,
268  GpivPivData *piv_data,
269  const gboolean free
270  );
271 
272 
273 
281 gpiv_fread_scdata (const gchar *fname
282  );
283 
284 
285 
294 gchar *
295 gpiv_fwrite_scdata (const gchar *fname,
296  GpivScalarData *scalar_data,
297  const gboolean free
298  );
299 
300 
301 
309 gpiv_read_scdata (FILE *fp
310  );
311 
312 
313 
322 gchar *
323 gpiv_write_scdata (FILE *fp,
324  GpivScalarData *scalar_data,
325  const gboolean free
326  );
327 
328 
329 
338 gchar *
339 gpiv_write_sc_griddata (FILE *fp,
340  GpivScalarData *scalar_data,
341  const gboolean free
342  );
343 
344 
345 
354 gchar *
355 gpiv_write_sc_mtvgriddata (FILE *fp,
356  GpivScalarData *scalar_data,
357  const gboolean free
358  );
359 
360 
369 gchar *
370 gpiv_print_histo (FILE *fp,
371  GpivBinData *bin_data,
372  const gboolean free
373  );
374 
375 
386 gchar *
388  GpivBinData *klass,
389  const gboolean free
390  );
391 
392 
402 GpivImage *
403 gpiv_read_raw_image (FILE *fp
404  );
405 
406 
417 GpivImage *
418 gpiv_fread_raw_image (const gchar *fname
419  );
420 
421 
429 gchar *
430 gpiv_write_raw_image (FILE *fp,
431  GpivImage *gpiv_image
432  );
433 
434 
442 gchar *
443 gpiv_fwrite_raw_image (const gchar *fname,
444  GpivImage *gpiv_image
445  );
446 
447 
454 GpivImage *
455 gpiv_read_png_image (FILE *fp
456  );
457 
458 
468 gchar *
469 gpiv_write_png_image (FILE *fp,
470  GpivImage *gpiv_image,
471  const gboolean free
472  );
473 
474 
481 gchar *
482 gpiv_fcreate_hdf5 (const gchar *fname
483  );
484 
485 
494 gchar *
495 gpiv_fread_hdf5_parameters (const gchar *fname,
496  const gchar *par_key,
497  void *pstruct
498  );
499 
500 
507 GpivImage *
508 gpiv_fread_hdf5_image (const gchar *fname
509  );
510 
511 
520 gchar *
521 gpiv_fwrite_hdf5_image (const gchar *fname,
522  GpivImage *image,
523  const gboolean free
524  );
525 
526 
535 gchar *
536 gpiv_fwrite_hdf5_parameters (const gchar *fname,
537  const gchar *par_key,
538  void *pstruct
539  );
540 
541 
549 GpivPivData *
550 gpiv_fread_hdf5_pivdata (const gchar *fname,
551  const gchar *DATA_KEY
552  );
553 
554 
564 gchar *
565 gpiv_fwrite_hdf5_pivdata (const gchar *fname,
566  GpivPivData *piv_data,
567  const gchar *DATA_KEY,
568  const gboolean free
569  );
570 
571 
580 gpiv_fread_hdf5_scdata (const gchar *fname,
581  const gchar *DATA_KEY
582  );
583 
584 
594 gchar *
595 gpiv_fwrite_hdf5_scdata (const gchar *fname,
596  GpivScalarData *scalar_data,
597  const gchar *DATA_KEY,
598  const gboolean free
599  );
600 
601 
610 gchar *
611 gpiv_fread_hdf5_histo (const gchar *fname,
612  GpivBinData *klass,
613  const gchar *DATA_KEY
614  );
615 
616 
625 gchar *
626 gpiv_fwrite_hdf5_histo (const gchar *fname,
627  const GpivBinData *klass,
628  const gchar *DATA_KEY
629  );
630 
631 
638 GpivImage *
639 gpiv_read_davis_image (FILE *fp
640  );
641 
642 
643 #endif /* __LIBGPIV_IO_H__ */
gchar * gpiv_fwrite_pivdata(const gchar *fname, GpivPivData *piv_data, const gboolean free)
Writes PIV data to file fname in ASCII format.
GpivScalarData * gpiv_fread_scdata(const gchar *fname)
Reads scalar data from file fname.
GpivImage * gpiv_read_raw_image(FILE *fp)
Reads an image from raw binary file.
enum GpivDataFormat gpiv_find_pivdata_origin(const gchar line[GPIV_MAX_CHARS])
Determines the name of the program that generated the data.
Holds scalar data, mostly derived from __GpivPivData.
Definition: gpiv.h:321
gchar * gpiv_write_scdata(FILE *fp, GpivScalarData *scalar_data, const gboolean free)
Writes scalar data to file.
Piv image header and data.
Definition: gpiv-img.h:194
GpivScalarData * gpiv_read_scdata(FILE *fp)
Reads scalar data form ascii file.
GpivPivData * gpiv_read_pivdata_fastx(FILE *fp)
Reads PIV data from fp with fast running x-position variables.
GpivPivData * gpiv_fread_pivdata(const gchar *fname)
Reads PIV data from file fname.
gchar * gpiv_fwrite_raw_image(const gchar *fname, GpivImage *gpiv_image)
Writes raw binary image data to file.r and header to file.h.
GpivImage * gpiv_fread_raw_image(const gchar *fname)
Reads an image from raw binary file.
GpivImage * gpiv_read_png_image(FILE *fp)
Reads png formatted image.
GpivScalarData * gpiv_fread_hdf5_scdata(const gchar *fname, const gchar *DATA_KEY)
Reads SCALAR data from a hdf5 data file.
void gpiv_io_make_fname(const gchar *fname_base, const gchar *EXT, gchar *fname_out)
Constructs (output) filename from base name and extension.
Holds the variables of PIV data.
Definition: gpiv.h:267
gchar * gpiv_write_raw_image(FILE *fp, GpivImage *gpiv_image)
Writes raw binary image frames to fp.
GpivPivData * gpiv_read_pivdata(FILE *fp)
Reads PIV data from fp.
gchar * gpiv_print_histo(FILE *fp, GpivBinData *bin_data, const gboolean free)
Writes bins data to file in histogram format.
gchar * gpiv_fwrite_hdf5_histo(const gchar *fname, const GpivBinData *klass, const gchar *DATA_KEY)
Writes histogram data to ouput file in hdf version 5 format.
gchar * gpiv_fwrite_hdf5_image(const gchar *fname, GpivImage *image, const gboolean free)
Writes image data to file in hdf version 5 format.
gchar * gpiv_fcreate_hdf5(const gchar *fname)
Creates an hdf5 data file with POSITION, DATA and PARAMETERS groups.
GpivImage * gpiv_fread_hdf5_image(const gchar *fname)
Reads image data to a hdf5 data file.
GpivImage * gpiv_read_image(FILE *fp)
Reads image from fp.
GpivDataFormat
Definition: gpiv-io.h:148
#define GPIV_MAX_CHARS
Maximum number of characters on a line.
Definition: gpiv.h:234
GpivImage * gpiv_fread_image(const gchar *fname)
Reads image from file fname.
gchar * gpiv_fwrite_hdf5_scdata(const gchar *fname, GpivScalarData *scalar_data, const gchar *DATA_KEY, const gboolean free)
Writes SCALAR data to a file in hdf version 5 format.
Used for making up histograms in bins or klasses.
Definition: gpiv.h:348
gchar * gpiv_print_cumhisto_eqdatbin(FILE *fp, GpivBinData *klass, const gboolean free)
Writing cumulative histogram data with an equal number of date per bin or klass to fp...
gchar * gpiv_fread_hdf5_histo(const gchar *fname, GpivBinData *klass, const gchar *DATA_KEY)
Reads histogram data to ouput file in hdf version 5 format.
gchar * gpiv_write_sc_griddata(FILE *fp, GpivScalarData *scalar_data, const gboolean free)
Writes scalar data to file in grid format for gnuplot.
gchar * gpiv_write_png_image(FILE *fp, GpivImage *gpiv_image, const gboolean free)
Writes image data and header to png formatted image.
gchar * gpiv_fread_hdf5_parameters(const gchar *fname, const gchar *par_key, void *pstruct)
Reads parameters from hdf5 data file.
gchar * gpiv_fwrite_scdata(const gchar *fname, GpivScalarData *scalar_data, const gboolean free)
Writes scalar data to file fname in ASCII format.
GpivPivData * gpiv_fread_hdf5_pivdata(const gchar *fname, const gchar *DATA_KEY)
Reads piv data from hdf5 data file.
gchar * gpiv_write_sc_mtvgriddata(FILE *fp, GpivScalarData *scalar_data, const gboolean free)
Writes scalar data to file in grid format for plotmtv.
GpivImage * gpiv_read_davis_image(FILE *fp)
Reads Davis formatted image, with ext .IMG from file.
gchar * gpiv_fwrite_hdf5_pivdata(const gchar *fname, GpivPivData *piv_data, const gchar *DATA_KEY, const gboolean free)
Writes PIV data to file in hdf version 5 format.
gchar * gpiv_fwrite_hdf5_parameters(const gchar *fname, const gchar *par_key, void *pstruct)
Writes parameters to hdf5 data file.
gchar * gpiv_write_pivdata(FILE *fp, GpivPivData *piv_data, const gboolean free)
Writes PIV data to fp in ASCII format.

Generated for libgpiv-0.6.1 by doxygen 1.8.13