display ruler, line/point evaluation
[gpiv.git] / src / gpiv_gtk.h
blobae47030c8840ad4d8f31a916fc3f5329bdc53e5d
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
6 libraries.
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)
15 any later version.
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_gtk.h,v $
31 * Revision 1.2 2003-06-27 13:47:26 gerber
32 * display ruler, line/point evaluation
34 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
35 * Imported gpiv
39 #ifndef GPIV_H
40 #define GPIV_H
42 #include <sys/types.h>
43 #include <sys/stat.h>
44 #include <unistd.h> /* for the "pause" function: */
45 #include <time.h>
46 #include <string.h>
47 #include <assert.h>
48 #include <math.h> /* for isnan */
49 #include <gnome.h>
50 #include <gpiv.h>
52 #define PROGNAME "GP_GUI." /* Abbreviation of program name; used for
53 error messages and parameter keys are
54 concatenated to it */
55 #define RCSID "$Id: gpiv_gtk.h,v 1.2 2003-06-27 13:47:26 gerber Exp $" /* Revision Control System (RCS) version */
56 #define ERR_IVAL = 99 /* Some arbitrary integer error value */
58 #define ADJ_MIN -50.0 /* minimum value for adjustment */
59 #define ADJ_MAX 50.0 /* maximum value for adjustment */
60 #define ADJ_STEP 0.001 /* Step increment for adjustment */
61 #define ADJ_PAGE 0.1 /* Page increment for adjustment */
64 * SVGA: 1280 x 1024
65 * Sony PCR-100 video camera: 1152 x 864
67 #ifndef IMAGE_WIDTH_MAX
68 #define IMAGE_WIDTH_MAX 1280
69 #endif
71 #ifndef IMAGE_HEIGHT_MAX
72 #define IMAGE_HEIGHT_MAX 1024
73 #endif
76 char IMAGE_WIDTH_LABEL[MAX_CHARS];
77 char IMAGE_HEIGHT_LABEL[MAX_CHARS];
80 * Extra marge for display
82 #define VIEW_HMARGE 38
83 #define VIEW_VMARGE 62
84 #define RULER_WIDTH 17 /* width of the rulers in the display window */
86 #define MAX_DATA (IMAGE_WIDTH_MAX / 8) /* Maximum number of data/estimators/Interr. Areas per row */
87 #define MAX_BUFS 10 /* maximum number of buffers (=displays) */
89 #define MAX_SWEEP 6
91 #define THICKNESS 1 /* line thickness to be drawn in te canvases */
92 #define ARROW_LENGTH 6 /* length of (piv) vector arrow head */
93 #define ARROW_EDGE 6 /* edge of (piv) vector arrow head */
94 #define ARROW_WIDTH 3 /* width of (piv) vector arrow head */
96 #define BITSHIFT_RED 24 /* bitshift for color red value (used in display_all_scalar_intregs) */
97 #define BITSHIFT_GREEN 16 /* bitshift for color green value */
98 #define BITSHIFT_BLUE 8 /* bitshift for color blue value */
101 #include "console_interface.h"
102 #include "display_interface.h"
105 GtkWidget *gpiv;
106 gchar *msg_default, *msg_error, msg_display[40], *fname_last;
108 guchar graybuf_int1[MAX_INTERR_SIZE * MAX_INTERR_SIZE];
109 guchar graybuf_int2[MAX_INTERR_SIZE * MAX_INTERR_SIZE];
110 guchar graybuf_cov[MAX_INTERR_SIZE * MAX_INTERR_SIZE];
113 /* GnomeCanvasPoints *points; */
114 GnomeCanvasItem *gci_img1, *gci_aoi, *gci_line;
115 PivData oldpiv_data, intregs_tmp;
116 gboolean exist_oldpiv;
117 gint zero_off_tmp, weight_tmp; /* used in on_radiobutton_piv_int */
118 gint setby_spinbutton; /* used in on_spinbutton_piv_int and on_radiobutton_piv_int */
120 float **int_area_1, **int_area_1, **covariance;
121 GnomeCanvasItem *text_piv_disprocess, *gci_background_piv_disprocess,
122 *gci_vector_piv_disprocess;
124 gfloat x_offset, x_lower, x_upper, y_offset, y_lower, y_upper;
125 gint enable_col_start, enable_col_end, enable_row_start, enable_row_end;
126 GtkWidget *gpiv_exit, *gpiv_close_buffer, *gpiv_preferences;
127 GdkCursor *cursor;
129 gint nd_lines, nc_lines;
130 char fname[MAX_CHARS];
132 gboolean print_par;
133 gboolean exec_process, cancel_process;
135 Display *display[MAX_BUFS], *display_act;
139 * Parameters of gpiv:
141 typedef struct _GpivPar GpivPar;
142 struct _GpivPar {
143 gboolean display_img1; /* display first image in display */
144 gboolean display_img2; /* display second image in display */
145 gboolean display_intregs; /* display interrogation regions in display */
146 gboolean display_piv; /* display piv vectors in display */
147 gboolean display_vor; /* display vorticity in display */
148 gboolean display_sstrain; /* display shear strain in display */
149 gboolean display_nstrain; /* display normal strain in display */
150 gboolean display_process; /* display interrogation areas and covariance function during image analyzing process */
151 gboolean show_tooltips; /* flag to show tooltips or hints (in pop-up window) */
153 gboolean process_piv; /* used by gpiv toolbar to run piv */
154 gboolean process_gradient; /* used by gpiv toolbar to run gradient */
155 gboolean process_resstats; /* used by gpiv toolbar to run resstats */
156 gboolean process_errvec; /* used by gpiv toolbar to run errvec */
157 gboolean process_peaklock; /* used by gpiv toolbar to run peaklock */
158 gboolean process_average; /* used by gpiv toolbar to run average */
159 gboolean process_scale; /* used by gpiv toolbar to run scale */
160 gboolean process_substract; /* used by gpiv toolbar to run substract */
161 gboolean process_vorstra; /* used by gpiv toolbar to run vorstra */
163 gboolean stretch;
164 gint zoom_index; /* index for displayed zooming */
165 gint vector_scale; /* scale of vectors to be displayed */
166 gboolean stretch_window; /* stretch display window for image area */
167 gboolean view_tabulator; /* display tabulator of process parameters in main window */
168 gboolean view_gpivbuttons; /* display gpiv buttons in main window */
169 gint nbins; /* number of bins to display histograms */
170 gint img_width; /* number of columns in image */
171 gint img_height; /* number of rows in image */
173 gboolean hdf; /* store data in hdf 5 format, with .gpi extension */
174 gboolean hdf_img; /* include image data in .gpi file (hdf 5 format) */
175 } default_par, gpiv_par;
179 * Parameters for each process:
180 * ImagePar should be unique for each image
182 ImagePar image_par;
183 PivEvalPar piv_eval_par;
184 PivValidPar piv_valid_par;
185 PivPostPar piv_post_par;
187 char c_line[MAX_LINES_C][MAX_CHARS];
188 int var_scale, nc_lines, display_intregs;
189 gint /* ibuf, */ nbufs;
192 enum ZoomIndex {
193 ZOOM_0 = 0,
194 ZOOM_1 = 1,
195 ZOOM_2 = 2,
196 ZOOM_3 = 3,
197 ZOOM_4 = 4,
198 ZOOM_5 = 5,
202 enum VectorScale {
203 VECTOR_SCALE_0 = 1,
204 VECTOR_SCALE_1 = 2,
205 VECTOR_SCALE_2 = 4,
206 VECTOR_SCALE_3 = 8,
207 VECTOR_SCALE_4 = 16,
208 VECTOR_SCALE_5 = 32,
209 VECTOR_SCALE_6 = 64,
210 VECTOR_SCALE_7 = 128,
211 VECTOR_SCALE_8 = 256
212 } /* v_scale */;
215 enum VectorColor {
216 SHOW_PEAKNR = 0,
217 SHOW_SNR = 1
218 } v_color;
221 enum WidgetSet {
222 IMG = 0,
223 IMGPROC = 1,
224 EVAL = 2,
225 INTREGS = 3,
226 VALID = 4,
227 POST = 5
228 } /* wi_set */;
231 enum MouseSelect {
232 NO_MS = 0,
233 AOI_MS = 1,
234 SINGLE_AREA_MS = 2,
235 SINGLE_POINT_MS = 3,
236 DRAG_MS = 4,
237 VLINE_MS = 5,
238 HLINE_MS = 6,
239 ENABLE_POINT_MS = 7,
240 DISABLE_POINT_MS = 8,
241 ENABLE_AREA_MS = 9,
242 DISABLE_AREA_MS = 10
243 } m_select;
246 enum ClistPut {
247 PREPEND = 0,
248 INSERT = 1,
249 APPEND = 2
253 static float zfactor[] = {
254 0.5,
255 0.83,
256 1.0,
257 1.3,
258 1.6,
263 int m_select_index_y, m_select_index_x;
266 #endif /* GPIV_H */