1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 c-style: "K&R" -*- */
3 /*----------------------------------------------------------------------
5 gpiv - Graphic program for Particle Image Velocimetry, based on gtk/gnome
8 Copyright (C) 2002 Gerber van der Graaf
10 This file is part of gpiv.
12 Gpiv is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 ----------------------------------------------------------------------*/
29 * Graphical User Interface for gpiv
30 * $Log: gpiv_gui.h,v $
31 * Revision 1.6 2008-10-09 14:43:37 gerber
32 * paralellized with OMP and MPI
34 * Revision 1.5 2008-09-25 13:32:22 gerber
35 * Adapted for use on cluster (using MPI/OMP) parallelised gpiv_rr from gpivtools)
37 * Revision 1.4 2008-09-16 10:13:56 gerber
38 * 2nd update because of cvs conflict
40 * Revision 1.3 2008-09-16 10:11:02 gerber
41 * Updated because of cvs conflict
43 * Revision 1.2 2005-06-15 15:06:22 gerber
44 * Optional Anti Aliased canvas for viewer
46 * Revision 1.1 2005/06/15 09:40:40 gerber
49 * Revision 1.9 2005/01/19 15:53:41 gerber
50 * Initiation of Data Acquisition (DAC); trigerring of lasers and camera
51 * by using RTAI and Realtime Linux, recording images from IEEE1394
52 * (Firewire) IIDC compliant camera's
54 * Revision 1.8 2004/10/15 19:24:05 gerber
55 * GPIV_ and Gpiv prefix to defines and structure names of libgpiv
57 * Revision 1.7 2004/06/14 21:19:23 gerber
58 * Image depth up to 16 bits.
59 * Improvement "single int" and "drag int" in Eval tab.
60 * Viewer's pop-up menu.
61 * Adaption for gpiv_matrix_* and gpiv_vector_*.
63 * See Changelog for further info.
65 * Revision 1.6 2003/09/04 13:31:55 gerber
66 * init of printing (unfinished)
68 * Revision 1.5 2003/09/01 11:17:14 gerber
69 * improved monitoring of interrogation process
71 * Revision 1.4 2003/08/22 15:24:52 gerber
72 * interactive spatial scaling
74 * Revision 1.3 2003/07/25 15:40:23 gerber
75 * removed/disabled setting of correlation in Eval tab, Correlation type in Image info tab
77 * Revision 1.2 2003/06/27 13:47:26 gerber
78 * display ruler, line/point evaluation
80 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
88 #include <sys/types.h>
90 #include <unistd.h> /* for the "pause" function: */
94 #include <math.h> /* for isnan */
99 #include <libgnomevfs/gnome-vfs.h>
100 #include <libgnomevfs/gnome-vfs-utils.h>
101 #ifdef HAVE_GNOME_PRINT
102 #include <libgnomeprint/gnome-print.h>
103 #include <libgnomeprint/gnome-print-job.h>
104 #include <libgnomeprint/gnome-font.h>
105 #include <libgnomeprintui/gnome-print-dialog.h>
106 #include <libgnomeprintui/gnome-print-job-preview.h>
107 #endif /* HAVE_GNOME_PRINT */
110 /* Revision Control System (RCS) version */
111 #define RCSID "$Id: gpiv_gui.h,v 1.6 2008-10-09 14:43:37 gerber Exp $"
112 #define ERR_IVAL = 99 /* Some arbitrary integer error value */
113 #define ADJ_MIN -50.0 /* minimum value for adjustment */
114 #define ADJ_MAX 50.0 /* maximum value for adjustment */
115 #define ADJ_STEP 0.001 /* Step increment for adjustment */
116 #define ADJ_PAGE 0.1 /* Page increment for adjustment */
117 #define ADJ_ISTEP 1 /* Step increment for adjustment for integers */
118 #define ADJ_IPAGE 10 /* Page increment for adjustment for integers*/
123 #define MPIRUN_CMD "mpirun -np"
128 * Sony PCR-100 video camera: 1152 x 864
130 #ifndef IMAGE_WIDTH_MAX
131 #define IMAGE_WIDTH_MAX GPIV_MAX_IMG_SIZE /* Maximum allowed image width */
132 #endif /* IMAGE_WIDTH_MAX */
134 #ifndef IMAGE_HEIGHT_MAX
135 #define IMAGE_HEIGHT_MAX GPIV_MAX_IMG_SIZE /* Maximum allowed image height */
136 #endif /* IMAGE_HEIGHT_MAX */
138 #ifndef IMAGE_DEPTH_MAX
139 #define IMAGE_DEPTH_MAX GPIV_MAX_IMG_DEPTH /* Maximum allowed image depth */
140 #endif /* IMAGE_DEPTH_MAX */
143 gchar IMAGE_CORRELATION_LABEL
[GPIV_MAX_CHARS
];
144 gchar IMAGE_WIDTH_LABEL
[GPIV_MAX_CHARS
];
145 gchar IMAGE_HEIGHT_LABEL
[GPIV_MAX_CHARS
];
146 gchar IMAGE_DEPTH_LABEL
[GPIV_MAX_CHARS
];
149 * Definitions for conssole
151 #define CONSOLE_WIDTH 100
152 #define CONSOLE_HEIGHT 400
154 * Extra marge for display
156 /* #define VIEW_HMARGE 38 */
157 /* #define VIEW_VMARGE 62 */
158 #define VIEW_HMARGE 19 /* horizontal marge in the display window */
159 #define VIEW_VMARGE 31 /* vertical marge in the display window */
160 /* #define VIEW_HMARGE 0 */
161 /* #define VIEW_VMARGE 0 */
162 #define RULER_WIDTH 17 /* width of the rulers in the display window */
164 #define MAX_DATA (IMAGE_WIDTH_MAX / GPIV_MIN_INTERR_SIZE) /* Maximum number of data/estimators/Interr. Areas per row */
165 #define MAX_BUFS GPIV_NIMG_MAX /* maximum number of buffers (=displays) */
167 /* #define MAX_SWEEP 6 */
169 #define CANVAS_AA /* Use Anti Aliased canvas for viewer */
170 /* BUGFIX: Color presenation for AA */
171 #define THICKNESS 1 /* line thickness to be drawn in te canvases */
172 #define ARROW_LENGTH 0.4 /* length of (piv) vector arrow head */
173 #define ARROW_EDGE 0.6 /* edge of (piv) vector arrow head */
174 #define ARROW_WIDTH 0.2 /* width of (piv) vector arrow head */
175 #define ARROW_ADD 2.0 /* additional quantity for arrow head */
176 #define ARROW_FACT 0.2 /* magnification factor of vector_scale for arrow head */
179 #define BITSHIFT_RED 24 /* bitshift for color red value (used in display_all_scalar_intregs) */
180 #define BITSHIFT_GREEN 16 /* bitshift for color green value */
181 #define BITSHIFT_BLUE 8 /* bitshift for color blue value */
183 #define ENABLE_IMGPROC
184 #undef IMGPROC_SAVE_IMG
185 #ifdef ENABLE_IMGPROC
186 #define IMG_FILTERS 5 /* number of image processes or filters in create_imgproc */
187 #endif /* ENABLE_IMGPROC
189 #define DISPLAY_ZOOMFACTOR_MIN 0.25 /* Minimum zoom factor for display viewer */
190 #define DISPLAY_ZOOMFACTOR_MAX 4.0 /* Maximum zoom factor for display viewer */
191 #define DISPLAY_ZOOMFACTOR_STEP 1.1 /* Increase / decrease change in zoomfactor */
193 #include "console_interface.h"
194 #include "display_interface.h"
198 * Image data / header will be stored to this format
213 #ifdef ENABLE_IMGPROC
223 enum ShowBackground
{
251 static float zfactor
[] = {
271 VECTOR_SCALE_7
= 128,
323 typedef struct __GpivVar Var
;
325 * Variables of gpiv that will be stored for future sessions, but are not
326 * defined as command line keys during launching gpiv:
329 enum TablabelPage tab_pos
; /* page of the notebook to be shown */
330 guint number_fnames_last
;
331 gchar
*fn_last
[MAX_LIST
]; /* last image name that has been loaded */
332 gboolean fname_last__set
; /* flag if fname_last has been set */
333 gchar
*fname_last
; /* last image name that has been loaded */
334 gchar
*fname_last_print
; /* last filename that has been printed to */
335 gboolean fname_date
; /* Extends the name with current date */
336 gboolean fname_time
; /* Extends the name with current time */
337 gfloat img_span_px
; /* spanned length that takes N mm in the img */
338 gfloat img_length_mm
; /* length in mm to be measured in img */
339 gboolean piv_disproc
; /* displaying Interrogation Areas and PIV estimator during interrogation */
340 gfloat piv_disproc_zoom
; /* magnification factor for displaying correlation in PIV evaluation tabulator */
341 guint piv_disproc_vlength
; /* vector length of PIV estimator in PIV evaluation tabulator */
342 gfloat dl_min
; /* minimum displacement of a piv data-set */
343 gfloat dl_max
; /* maximum displacement of a piv data-set */
344 #ifdef ENABLE_IMGPROC
345 guint imgproc_count
; /* number of image processes */
348 gboolean residu_stats
; /* perform residual statistics on PIV data while validating */
349 gboolean residu_stats__set
;
350 gboolean auto_thresh
; /* perform auto thresholding while validaton PIV data on outlyers */
351 gboolean auto_thresh__set
;
356 * Parameters of gpiv:
358 typedef struct __GpivPar Par
;
363 gboolean x_corr
; /* images for cross correlation */
364 gboolean x_corr__set
; /* images for cross correlation */
366 enum ImgFmt img_fmt
; /* Image data / header will be stored to this format */
367 gboolean img_fmt__set
;
369 gboolean hdf
; /* store data in hdf 5 format, with .h5 extension */
370 gboolean hdf__set
; /* store data in hdf 5 format, with .h5 extension */
372 gboolean print_par
; /* Prints parameters to stdout */
373 gboolean print_par__set
;
375 gboolean verbose
; /* Prints behaviour to stdout */
376 gboolean verbose__set
;
379 * Console related parameters
381 gboolean console__show_tooltips
; /* flag to show tooltips or hints (in pop-up window) */
382 gboolean console__show_tooltips__set
; /* flag to show tooltips or hints (in pop-up window) */
384 gboolean console__view_tabulator__set
; /* display tabulator of process parameters in main window */
385 gboolean console__view_tabulator
; /* display tabulator of process parameters in main window */
387 gboolean console__view_gpivbuttons
; /* display gpiv buttons in main window */
388 gboolean console__view_gpivbuttons__set
; /* display gpiv buttons in main window */
390 gint console__nbins
; /* number of bins to display histograms */
391 gboolean console__nbins__set
; /* number of bins to display histograms */
393 gboolean console__trigger_cam
; /* enable/disable camera and laser triggering */
394 gboolean console__trigger_cam__set
; /* enable/disable camera and laser triggering */
397 * Display viewer related parameters
399 gboolean display__stretch_auto
; /* stretch automatic window after zooming in */
400 gboolean display__stretch_auto__set
; /* stretch automatic window after sooming in has been defined */
402 enum ZoomIndex display__zoom_index
; /* index for displayed zooming */
403 gboolean display__zoom_index__set
; /* index for displayed zooming has been defined */
405 enum VectorScale display__vector_scale
; /* scale of vectors to be displayed */
406 gboolean display__vector_scale__set
; /* scale of vectors to be displayed has been defined */
408 enum VectorColor display__vector_color
; /* color representation of vectors */
409 gboolean display__vector_color__set
; /* color representation of vectors has been defined */
411 gboolean display__stretch_window
; /* stretch display window for image area */
412 gboolean display__stretch_window__set
; /* stretch display window for image area has been defined */
414 gboolean display__view_menubar
; /* view menubar of the buffer display */
415 gboolean display__view_menubar__set
; /* view menubar of the buffer display has been defined */
417 gboolean display__view_rulers
; /* view rulers of the buffer display */
418 gboolean display__view_rulers__set
; /* view rulers of the buffer display has been defined */
420 gboolean display__stretch__set
; /* stretch buffer display when zooming in */
421 gboolean display__stretch
; /* stretch buffer display when zooming in has been defined */
423 enum ShowBackground display__backgrnd
; /* display background color */
424 gboolean display__backgrnd__set
; /* display background color has been defined */
426 gboolean display__intregs
; /* display interrogation regions in display */
427 gboolean display__intregs__set
; /* display interrogation regions in display has been defined */
429 gboolean display__piv
; /* display piv vectors in display */
430 gboolean display__piv__set
; /* display piv vectors in display has been defined */
432 enum ShowScalar display__scalar
; /* displaying of scalar data */
433 gboolean display__scalar__set
; /* displaying of scalar data has been defined */
435 gboolean display__process
; /* display interrogation areas and covariance function during image analyzing process */
436 gboolean display__process__set
; /* display interrogation areas and covariance function during image analyzing process */
439 * Chain processing related parameters
441 gboolean process__cam
; /* used by gpiv toolbar to run camera */
442 gboolean process__cam__set
; /* used by gpiv toolbar to run camera */
444 gboolean process__trig
; /* used by gpiv toolbar to run trigger */
445 gboolean process__trig__set
; /* used by gpiv toolbar to run trigger */
447 gboolean process__imgproc
; /* used by gpiv toolbar to run image processing */
448 gboolean process__imgproc__set
; /* used by gpiv toolbar to run image processing */
450 gboolean process__piv
; /* used by gpiv toolbar to run piv */
451 gboolean process__piv__set
; /* used by gpiv toolbar to run piv */
453 gboolean process__gradient
; /* used by gpiv toolbar to run gradient */
454 gboolean process__gradient__set
; /* used by gpiv toolbar to run gradient */
456 gboolean process__resstats
; /* used by gpiv toolbar to run resstats */
457 gboolean process__resstats__set
; /* used by gpiv toolbar to run resstats */
459 gboolean process__errvec
; /* used by gpiv toolbar to run errvec */
460 gboolean process__errvec__set
; /* used by gpiv toolbar to run errvec */
462 gboolean process__peaklock
; /* used by gpiv toolbar to run peaklock */
463 gboolean process__peaklock__set
; /* used by gpiv toolbar to run peaklock */
465 gboolean process__average
; /* used by gpiv toolbar to run average */
466 gboolean process__average__set
; /* used by gpiv toolbar to run average */
468 gboolean process__scale
; /* used by gpiv toolbar to run scale */
469 gboolean process__scale__set
; /* used by gpiv toolbar to run scale */
471 gboolean process__subtract
; /* used by gpiv toolbar to run subtract */
472 gboolean process__subtract__set
; /* used by gpiv toolbar to run subtract */
474 gboolean process__vorstra
; /* used by gpiv toolbar to run vorstra */
475 gboolean process__vorstra__set
; /* used by gpiv toolbar to run vorstra */
478 gint mpi_nodes
; /* number of cluster nodes used for parallel MPI execution */
479 gboolean mpi_nodes__set
; /* number of cluster nodes used for parallel MPI execution */
480 #endif /* ENBALE MPI */
482 } gp
, *default_par
, *gpiv_par
;
486 * Global parameters and variables for each process:
487 * ImagePar should be unique for each image
490 GpivCamPar
*gl_cam_par
; /* global camera parameters */
492 #endif /* ENABLE_CAM */
495 GpivTrigPar
*gl_trig_par
; /* global trigger parameters */
496 #endif /* ENABLE_TRIG */
498 #ifdef ENABLE_IMGPROC
499 GpivImageProcPar
*gl_imgproc_par
; /* global image processing parameters */
500 #endif /* ENABLE_IMGPROC */
502 GpivImagePar
*gl_image_par
; /* global image parameters */
503 GpivPivPar
*gl_piv_par
; /* global PIV evaluation / interrogation parameters */
504 GpivValidPar
*gl_valid_par
; /* global PIV validation parameters */
505 GpivPostPar
*gl_post_par
; /* global PIV post processing parameters */
509 * Other global variables
511 GnomeProgram
*Gpiv_app
;
512 GnomeCanvasItem
*gci_aoi
, *gci_line
;
514 gchar fname
[GPIV_MAX_CHARS
];
515 gboolean exec_process
, cancel_process
;
517 Display
*display
[MAX_BUFS
], *display_act
;
521 gchar
*msg_default
, msg_display
[40];
522 gchar c_line
[GPIV_MAX_LINES_C
][GPIV_MAX_CHARS
];
523 guint var_scale
, display_intregs
;
524 guint m_select_index_y
, m_select_index_x
;
526 /* flag to suppres creating intregs during load_buffer; after displaying
527 * results into correct effect */
528 gboolean view_toggle_intregs_flag
;