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.5 2008-09-25 13:32:22 gerber
32 * Adapted for use on cluster (using MPI/OMP) parallelised gpiv_rr from gpivtools)
34 * Revision 1.4 2008-09-16 10:13:56 gerber
35 * 2nd update because of cvs conflict
37 * Revision 1.3 2008-09-16 10:11:02 gerber
38 * Updated because of cvs conflict
40 * Revision 1.2 2005-06-15 15:06:22 gerber
41 * Optional Anti Aliased canvas for viewer
43 * Revision 1.1 2005/06/15 09:40:40 gerber
46 * Revision 1.9 2005/01/19 15:53:41 gerber
47 * Initiation of Data Acquisition (DAC); trigerring of lasers and camera
48 * by using RTAI and Realtime Linux, recording images from IEEE1394
49 * (Firewire) IIDC compliant camera's
51 * Revision 1.8 2004/10/15 19:24:05 gerber
52 * GPIV_ and Gpiv prefix to defines and structure names of libgpiv
54 * Revision 1.7 2004/06/14 21:19:23 gerber
55 * Image depth up to 16 bits.
56 * Improvement "single int" and "drag int" in Eval tab.
57 * Viewer's pop-up menu.
58 * Adaption for gpiv_matrix_* and gpiv_vector_*.
60 * See Changelog for further info.
62 * Revision 1.6 2003/09/04 13:31:55 gerber
63 * init of printing (unfinished)
65 * Revision 1.5 2003/09/01 11:17:14 gerber
66 * improved monitoring of interrogation process
68 * Revision 1.4 2003/08/22 15:24:52 gerber
69 * interactive spatial scaling
71 * Revision 1.3 2003/07/25 15:40:23 gerber
72 * removed/disabled setting of correlation in Eval tab, Correlation type in Image info tab
74 * Revision 1.2 2003/06/27 13:47:26 gerber
75 * display ruler, line/point evaluation
77 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
85 #include <sys/types.h>
87 #include <unistd.h> /* for the "pause" function: */
91 #include <math.h> /* for isnan */
96 #include <libgnomevfs/gnome-vfs.h>
97 #include <libgnomevfs/gnome-vfs-utils.h>
98 #ifdef HAVE_GNOME_PRINT
99 #include <libgnomeprint/gnome-print.h>
100 #include <libgnomeprint/gnome-print-job.h>
101 #include <libgnomeprint/gnome-font.h>
102 #include <libgnomeprintui/gnome-print-dialog.h>
103 #include <libgnomeprintui/gnome-print-job-preview.h>
104 #endif /* HAVE_GNOME_PRINT */
107 /* Revision Control System (RCS) version */
108 #define RCSID "$Id: gpiv_gui.h,v 1.5 2008-09-25 13:32:22 gerber Exp $"
109 #define ERR_IVAL = 99 /* Some arbitrary integer error value */
110 #define ADJ_MIN -50.0 /* minimum value for adjustment */
111 #define ADJ_MAX 50.0 /* maximum value for adjustment */
112 #define ADJ_STEP 0.001 /* Step increment for adjustment */
113 #define ADJ_PAGE 0.1 /* Page increment for adjustment */
114 #define ADJ_ISTEP 1 /* Step increment for adjustment for integers */
115 #define ADJ_IPAGE 10 /* Page increment for adjustment for integers*/
120 #define MPIRUN_CMD "mpirun -np 6"
125 * Sony PCR-100 video camera: 1152 x 864
127 #ifndef IMAGE_WIDTH_MAX
128 #define IMAGE_WIDTH_MAX GPIV_MAX_IMG_SIZE /* Maximum allowed image width */
129 #endif /* IMAGE_WIDTH_MAX */
131 #ifndef IMAGE_HEIGHT_MAX
132 #define IMAGE_HEIGHT_MAX GPIV_MAX_IMG_SIZE /* Maximum allowed image height */
133 #endif /* IMAGE_HEIGHT_MAX */
135 #ifndef IMAGE_DEPTH_MAX
136 #define IMAGE_DEPTH_MAX GPIV_MAX_IMG_DEPTH /* Maximum allowed image depth */
137 #endif /* IMAGE_DEPTH_MAX */
140 gchar IMAGE_CORRELATION_LABEL
[GPIV_MAX_CHARS
];
141 gchar IMAGE_WIDTH_LABEL
[GPIV_MAX_CHARS
];
142 gchar IMAGE_HEIGHT_LABEL
[GPIV_MAX_CHARS
];
143 gchar IMAGE_DEPTH_LABEL
[GPIV_MAX_CHARS
];
146 * Definitions for conssole
148 #define CONSOLE_WIDTH 100
149 #define CONSOLE_HEIGHT 400
151 * Extra marge for display
153 /* #define VIEW_HMARGE 38 */
154 /* #define VIEW_VMARGE 62 */
155 #define VIEW_HMARGE 19 /* horizontal marge in the display window */
156 #define VIEW_VMARGE 31 /* vertical marge in the display window */
157 /* #define VIEW_HMARGE 0 */
158 /* #define VIEW_VMARGE 0 */
159 #define RULER_WIDTH 17 /* width of the rulers in the display window */
161 #define MAX_DATA (IMAGE_WIDTH_MAX / GPIV_MIN_INTERR_SIZE) /* Maximum number of data/estimators/Interr. Areas per row */
162 #define MAX_BUFS GPIV_NIMG_MAX /* maximum number of buffers (=displays) */
164 /* #define MAX_SWEEP 6 */
166 #define CANVAS_AA /* Use Anti Aliased canvas for viewer */
167 /* BUGFIX: Color presenation for AA */
168 #define THICKNESS 1 /* line thickness to be drawn in te canvases */
169 #define ARROW_LENGTH 0.4 /* length of (piv) vector arrow head */
170 #define ARROW_EDGE 0.6 /* edge of (piv) vector arrow head */
171 #define ARROW_WIDTH 0.2 /* width of (piv) vector arrow head */
172 #define ARROW_ADD 2.0 /* additional quantity for arrow head */
173 #define ARROW_FACT 0.2 /* magnification factor of vector_scale for arrow head */
176 #define BITSHIFT_RED 24 /* bitshift for color red value (used in display_all_scalar_intregs) */
177 #define BITSHIFT_GREEN 16 /* bitshift for color green value */
178 #define BITSHIFT_BLUE 8 /* bitshift for color blue value */
180 #define ENABLE_IMGPROC
181 #undef IMGPROC_SAVE_IMG
182 #ifdef ENABLE_IMGPROC
183 #define IMG_FILTERS 5 /* number of image processes or filters in create_imgproc */
184 #endif /* ENABLE_IMGPROC
186 #define DISPLAY_ZOOMFACTOR_MIN 0.25 /* Minimum zoom factor for display viewer */
187 #define DISPLAY_ZOOMFACTOR_MAX 4.0 /* Maximum zoom factor for display viewer */
188 #define DISPLAY_ZOOMFACTOR_STEP 1.1 /* Increase / decrease change in zoomfactor */
190 #include "console_interface.h"
191 #include "display_interface.h"
195 * Image data / header will be stored to this format
210 #ifdef ENABLE_IMGPROC
220 enum ShowBackground
{
248 static float zfactor
[] = {
268 VECTOR_SCALE_7
= 128,
320 typedef struct __GpivVar Var
;
322 * Variables of gpiv that will be stored for future sessions, but are not
323 * defined as command line keys during launching gpiv:
326 enum TablabelPage tab_pos
; /* page of the notebook to be shown */
327 guint number_fnames_last
;
328 gchar
*fn_last
[MAX_LIST
]; /* last image name that has been loaded */
329 gboolean fname_last__set
; /* flag if fname_last has been set */
330 gchar
*fname_last
; /* last image name that has been loaded */
331 gchar
*fname_last_print
; /* last filename that has been printed to */
332 gboolean fname_date
; /* Extends the name with current date */
333 gboolean fname_time
; /* Extends the name with current time */
334 gfloat img_span_px
; /* spanned length that takes N mm in the img */
335 gfloat img_length_mm
; /* length in mm to be measured in img */
336 gboolean piv_disproc
; /* displaying Interrogation Areas and PIV estimator during interrogation */
337 gfloat piv_disproc_zoom
; /* magnification factor for displaying correlation in PIV evaluation tabulator */
338 guint piv_disproc_vlength
; /* vector length of PIV estimator in PIV evaluation tabulator */
339 gfloat dl_min
; /* minimum displacement of a piv data-set */
340 gfloat dl_max
; /* maximum displacement of a piv data-set */
341 #ifdef ENABLE_IMGPROC
342 guint imgproc_count
; /* number of image processes */
345 gboolean residu_stats
; /* perform residual statistics on PIV data while validating */
346 gboolean residu_stats__set
;
347 gboolean auto_thresh
; /* perform auto thresholding while validaton PIV data on outlyers */
348 gboolean auto_thresh__set
;
353 * Parameters of gpiv:
355 typedef struct __GpivPar Par
;
360 gboolean x_corr
; /* images for cross correlation */
361 gboolean x_corr__set
; /* images for cross correlation */
363 enum ImgFmt img_fmt
; /* Image data / header will be stored to this format */
364 gboolean img_fmt__set
;
366 gboolean hdf
; /* store data in hdf 5 format, with .h5 extension */
367 gboolean hdf__set
; /* store data in hdf 5 format, with .h5 extension */
369 gboolean print_par
; /* Prints parameters to stdout */
370 gboolean print_par__set
;
372 gboolean verbose
; /* Prints behaviour to stdout */
373 gboolean verbose__set
;
376 * Console related parameters
378 gboolean console__show_tooltips
; /* flag to show tooltips or hints (in pop-up window) */
379 gboolean console__show_tooltips__set
; /* flag to show tooltips or hints (in pop-up window) */
381 gboolean console__view_tabulator__set
; /* display tabulator of process parameters in main window */
382 gboolean console__view_tabulator
; /* display tabulator of process parameters in main window */
384 gboolean console__view_gpivbuttons
; /* display gpiv buttons in main window */
385 gboolean console__view_gpivbuttons__set
; /* display gpiv buttons in main window */
387 gint console__nbins
; /* number of bins to display histograms */
388 gboolean console__nbins__set
; /* number of bins to display histograms */
390 gboolean console__trigger_cam
; /* enable/disable camera and laser triggering */
391 gboolean console__trigger_cam__set
; /* enable/disable camera and laser triggering */
394 * Display viewer related parameters
396 gboolean display__stretch_auto
; /* stretch automatic window after zooming in */
397 gboolean display__stretch_auto__set
; /* stretch automatic window after sooming in has been defined */
399 enum ZoomIndex display__zoom_index
; /* index for displayed zooming */
400 gboolean display__zoom_index__set
; /* index for displayed zooming has been defined */
402 enum VectorScale display__vector_scale
; /* scale of vectors to be displayed */
403 gboolean display__vector_scale__set
; /* scale of vectors to be displayed has been defined */
405 enum VectorColor display__vector_color
; /* color representation of vectors */
406 gboolean display__vector_color__set
; /* color representation of vectors has been defined */
408 gboolean display__stretch_window
; /* stretch display window for image area */
409 gboolean display__stretch_window__set
; /* stretch display window for image area has been defined */
411 gboolean display__view_menubar
; /* view menubar of the buffer display */
412 gboolean display__view_menubar__set
; /* view menubar of the buffer display has been defined */
414 gboolean display__view_rulers
; /* view rulers of the buffer display */
415 gboolean display__view_rulers__set
; /* view rulers of the buffer display has been defined */
417 gboolean display__stretch__set
; /* stretch buffer display when zooming in */
418 gboolean display__stretch
; /* stretch buffer display when zooming in has been defined */
420 enum ShowBackground display__backgrnd
; /* display background color */
421 gboolean display__backgrnd__set
; /* display background color has been defined */
423 gboolean display__intregs
; /* display interrogation regions in display */
424 gboolean display__intregs__set
; /* display interrogation regions in display has been defined */
426 gboolean display__piv
; /* display piv vectors in display */
427 gboolean display__piv__set
; /* display piv vectors in display has been defined */
429 enum ShowScalar display__scalar
; /* displaying of scalar data */
430 gboolean display__scalar__set
; /* displaying of scalar data has been defined */
432 gboolean display__process
; /* display interrogation areas and covariance function during image analyzing process */
433 gboolean display__process__set
; /* display interrogation areas and covariance function during image analyzing process */
436 * Chain processing related parameters
438 gboolean process__cam
; /* used by gpiv toolbar to run camera */
439 gboolean process__cam__set
; /* used by gpiv toolbar to run camera */
441 gboolean process__trig
; /* used by gpiv toolbar to run trigger */
442 gboolean process__trig__set
; /* used by gpiv toolbar to run trigger */
444 gboolean process__imgproc
; /* used by gpiv toolbar to run image processing */
445 gboolean process__imgproc__set
; /* used by gpiv toolbar to run image processing */
447 gboolean process__piv
; /* used by gpiv toolbar to run piv */
448 gboolean process__piv__set
; /* used by gpiv toolbar to run piv */
450 gboolean process__gradient
; /* used by gpiv toolbar to run gradient */
451 gboolean process__gradient__set
; /* used by gpiv toolbar to run gradient */
453 gboolean process__resstats
; /* used by gpiv toolbar to run resstats */
454 gboolean process__resstats__set
; /* used by gpiv toolbar to run resstats */
456 gboolean process__errvec
; /* used by gpiv toolbar to run errvec */
457 gboolean process__errvec__set
; /* used by gpiv toolbar to run errvec */
459 gboolean process__peaklock
; /* used by gpiv toolbar to run peaklock */
460 gboolean process__peaklock__set
; /* used by gpiv toolbar to run peaklock */
462 gboolean process__average
; /* used by gpiv toolbar to run average */
463 gboolean process__average__set
; /* used by gpiv toolbar to run average */
465 gboolean process__scale
; /* used by gpiv toolbar to run scale */
466 gboolean process__scale__set
; /* used by gpiv toolbar to run scale */
468 gboolean process__subtract
; /* used by gpiv toolbar to run subtract */
469 gboolean process__subtract__set
; /* used by gpiv toolbar to run subtract */
471 gboolean process__vorstra
; /* used by gpiv toolbar to run vorstra */
472 gboolean process__vorstra__set
; /* used by gpiv toolbar to run vorstra */
475 } gp
, *default_par
, *gpiv_par
;
479 * Global parameters and variables for each process:
480 * ImagePar should be unique for each image
483 GpivCamPar
*gl_cam_par
; /* global camera parameters */
485 #endif /* ENABLE_CAM */
488 GpivTrigPar
*gl_trig_par
; /* global trigger parameters */
489 #endif /* ENABLE_TRIG */
491 #ifdef ENABLE_IMGPROC
492 GpivImageProcPar
*gl_imgproc_par
; /* global image processing parameters */
493 #endif /* ENABLE_IMGPROC */
495 GpivImagePar
*gl_image_par
; /* global image parameters */
496 GpivPivPar
*gl_piv_par
; /* global PIV evaluation / interrogation parameters */
497 GpivValidPar
*gl_valid_par
; /* global PIV validation parameters */
498 GpivPostPar
*gl_post_par
; /* global PIV post processing parameters */
502 * Other global variables
504 GnomeProgram
*Gpiv_app
;
505 GnomeCanvasItem
*gci_aoi
, *gci_line
;
507 gchar fname
[GPIV_MAX_CHARS
];
508 gboolean exec_process
, cancel_process
;
510 Display
*display
[MAX_BUFS
], *display_act
;
514 gchar
*msg_default
, msg_display
[40];
515 gchar c_line
[GPIV_MAX_LINES_C
][GPIV_MAX_CHARS
];
516 guint var_scale
, display_intregs
;
517 guint m_select_index_y
, m_select_index_x
;
519 /* flag to suppres creating intregs during load_buffer; after displaying
520 * results into correct effect */
521 gboolean view_toggle_intregs_flag
;