bug repair: loading .png image, from Adrian Daerr
[gpiv.git] / src / pivpost.c
blob085552d46fdeb18d175b57448c92d58500527f7a
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, 2003, 2004, 2005, 2006, 2007, 2008
9 Gerber van der Graaf
11 This file is part of gpiv.
13 Gpiv is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2, or (at your option)
16 any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 -----------------------------------------------------------------------------*/
30 * (callback) functions for Piv post processing window/tabulator
31 * $Log: pivpost.c,v $
32 * Revision 1.18 2007-12-19 08:42:35 gerber
33 * debugged
35 * Revision 1.17 2007-11-23 16:24:08 gerber
36 * release 0.5.0: Kafka
38 * Revision 1.16 2007-06-06 17:00:48 gerber
39 * Retreives images/data from URI using Gnome Virtual File System.
41 * Revision 1.15 2007-01-29 11:27:44 gerber
42 * added image formats png, gif, tif png, bmp, improved buffer display
44 * Revision 1.14 2006-09-18 07:27:06 gerber
45 * *** empty log message ***
47 * Revision 1.13 2006/01/31 14:28:12 gerber
48 * version 0.3.0
50 * Revision 1.11 2005/02/26 09:43:30 gerber
51 * parameter flags (parameter_logic) defined as gboolean
53 * Revision 1.10 2004/10/15 19:24:05 gerber
54 * GPIV_ and Gpiv prefix to defines and structure names of libgpiv
56 * Revision 1.9 2004/06/14 21:19:23 gerber
57 * Image depth up to 16 bits.
58 * Improvement "single int" and "drag int" in Eval tab.
59 * Viewer's pop-up menu.
60 * Adaption for gpiv_matrix_* and gpiv_vector_*.
61 * Resizing console.
62 * See Changelog for further info.
64 * Revision 1.8 2003/07/13 14:38:18 gerber
65 * changed error handling of libgpiv
67 * Revision 1.7 2003/07/12 21:21:16 gerber
68 * changed error handling libgpiv
70 * Revision 1.5 2003/07/10 11:56:07 gerber
71 * added man page
73 * Revision 1.4 2003/07/04 10:47:01 gerber
74 * cleaning up
76 * Revision 1.3 2003/07/03 17:08:02 gerber
77 * display ruler adjusted for scaled data
79 * Revision 1.2 2003/06/27 13:47:26 gerber
80 * display ruler, line/point evaluation
82 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
83 * Imported gpiv
88 #include "gpiv_gui.h"
89 #include "utils.h"
90 #include "pivpost.h"
91 #include "display.h"
95 * Public post-processing functions
98 void
99 exec_scale (PivPost *pivpost
101 /*-----------------------------------------------------------------------------
102 * Scales PIV data on a new data set, adapts rulers
105 gchar *err_msg = NULL;
107 if (display_act->pida->scaled_piv)
108 gpiv_free_pivdata (display_act->pida->piv_data_scaled);
110 if ((display_act->pida->piv_data_scaled =
111 gpiv_cp_pivdata (display_act->pida->piv_data)) == NULL) {
112 gpiv_error ("exec_scale: failing gpiv_alloc_pivdata");
115 if (display_act->pida->exist_piv && !cancel_process) {
116 if ((err_msg = gpiv_post_scale (display_act->pida->piv_data_scaled,
117 display_act->img->image->header))
118 != NULL) {
119 error_gpiv(_("exec_scale: Failure calling gpiv_post_scale"));
121 display_act->pida->scaled_piv = TRUE;
124 * Adding some comment to the scaled piv_data
126 display_act->pida->piv_data_scaled->comment =
127 g_strdup_printf ("# Software: %s %s\n", PACKAGE, VERSION);
128 display_act->pida->piv_data_scaled->comment =
129 gpiv_add_datetime_to_comment (display_act->pida->piv_data_scaled->comment);
130 display_act->pida->piv_data_scaled->comment =
131 g_strconcat (display_act->pida->piv_data_scaled->comment,
132 "# Data type: time and spatial scaled Particle Image Velocities\n", NULL);
135 #ifdef Rulers
137 * Adjusting display rulers
139 set__hrulerscale (display_act);
140 set__vrulerscale (display_act);
141 #endif
143 free_post_bufmems (display_act);
144 } else {
145 warning_gpiv (_("no PIV data"));
152 void
153 exec_savg (PivPost *pivpost
155 /*-----------------------------------------------------------------------------
156 * Calculates spatial average
159 gchar *err_msg = NULL;
162 display_act->pida->averaged_piv = TRUE;
164 display_act->pida->piv_data->mean_dx = 0.0;
165 display_act->pida->piv_data->sdev_dx = 0.0;
166 display_act->pida->piv_data->min_dx = 0.0;
167 display_act->pida->piv_data->max_dx = 0.0;
169 display_act->pida->piv_data->mean_dy = 0.0;
170 display_act->pida->piv_data->sdev_dy = 0.0;
171 display_act->pida->piv_data->min_dy = 0.0;
172 display_act->pida->piv_data->max_dy = 0.0;
175 if (display_act->pida->piv_data_scaled != NULL) {
176 display_act->pida->piv_data_scaled->mean_dx = 0.0;
177 display_act->pida->piv_data_scaled->sdev_dx = 0.0;
178 display_act->pida->piv_data_scaled->min_dx = 0.0;
179 display_act->pida->piv_data_scaled->max_dx = 0.0;
181 display_act->pida->piv_data_scaled->mean_dy = 0.0;
182 display_act->pida->piv_data_scaled->sdev_dy = 0.0;
183 display_act->pida->piv_data_scaled->min_dy = 0.0;
184 display_act->pida->piv_data_scaled->max_dy = 0.0;
188 if (display_act->pida->exist_piv && !cancel_process) {
189 exec_process = TRUE;
190 gl_post_par->subtract = 0;
192 if (display_act->pida->scaled_piv) {
193 if ((err_msg = gpiv_post_savg (display_act->pida->piv_data_scaled,
194 gl_post_par)) != NULL) {
195 error_gpiv ("exec_savg: failing gpiv_post_savg");
198 #ifdef DEBUG
199 g_warning("exec_savg:: SCALED: mean_dx = %f sdev_dx = %f min_dx = %f max_dx = %f",
200 display_act->pida->piv_data_scaled->mean_dx,
201 display_act->pida->piv_data_scaled->sdev_dx,
202 display_act->pida->piv_data_scaled->min_dx,
203 display_act->pida->piv_data_scaled->max_dx);
204 g_warning("exec_savg:: SCALED: mean_dy = %f sdev_dy = %f min_dy = %f max_dy = %f\n",
205 display_act->pida->piv_data_scaled->mean_dy,
206 display_act->pida->piv_data_scaled->sdev_dy,
207 display_act->pida->piv_data_scaled->min_dy,
208 display_act->pida->piv_data_scaled->max_dy);
209 #endif /* DEBUG */
211 gtk_spin_button_set_value (GTK_SPIN_BUTTON
212 (pivpost->spinbutton_suavg),
213 (gfloat) display_act->
214 pida->piv_data_scaled->mean_dx);
215 gtk_spin_button_set_value (GTK_SPIN_BUTTON
216 (pivpost->spinbutton_svavg),
217 (gfloat) display_act->
218 pida->piv_data_scaled->mean_dy);
220 } else {
221 gpiv_post_savg (display_act->pida->piv_data, gl_post_par);
222 #ifdef DEBUG
223 g_warning("exec_savg:: mean_dx = %f sdev_dx = %f min_dx = %f max_dx = %f",
224 display_act->pida->piv_data->mean_dx,
225 display_act->pida->piv_data->sdev_dx,
226 display_act->pida->piv_data->min_dx,
227 display_act->pida->piv_data->max_dx);
228 g_warning("exec_savg:: mean_dy = %f sdev_dy = %f min_dy = %f max_dy = %f\n",
229 display_act->pida->piv_data->mean_dy,
230 display_act->pida->piv_data->sdev_dy,
231 display_act->pida->piv_data->min_dy,
232 display_act->pida->piv_data->max_dy);
233 #endif /* DEBUG */
236 gtk_spin_button_set_value (GTK_SPIN_BUTTON
237 (pivpost->spinbutton_suavg),
238 (gfloat) display_act->
239 pida->piv_data->mean_dx);
240 gtk_spin_button_set_value (GTK_SPIN_BUTTON
241 (pivpost->spinbutton_svavg),
242 (gfloat) display_act->
243 pida->piv_data->mean_dy);
247 exec_process = FALSE;
248 } else {
249 warning_gpiv (_("no PIV data"));
255 void
256 exec_subavg (PivPost * pivpost
258 /*-----------------------------------------------------------------------------
259 * Subtracts average or zero offsets for particle image displacements or
260 * scaled velocities
263 guint i, j;
266 if (display_act->pida->exist_piv && !cancel_process) {
267 exec_process = TRUE;
268 gl_post_par->subtract = 1;
270 if (display_act->pida->scaled_piv) {
272 if (display_act->pida->averaged_piv) {
273 gpiv_post_subtract_dxdy (display_act->pida->piv_data_scaled,
274 display_act->pida->piv_data_scaled->mean_dx,
275 display_act->pida->piv_data_scaled->mean_dy);
278 * Copy parameters in Buffer structure for saving and, eventual,
279 * later use
281 display_act->pida->post_par->z_off_dx =
282 display_act->pida->piv_data_scaled->mean_dx;
283 display_act->pida->post_par->z_off_dy =
284 display_act->pida->piv_data_scaled->mean_dy;
286 } else {
287 gpiv_post_subtract_dxdy (display_act->pida->piv_data_scaled,
288 gl_post_par->z_off_dx,
289 gl_post_par->z_off_dx);
294 * Subtract from piv_data, only for displaying purposes
296 if (display_act->pida->averaged_piv) {
297 gpiv_post_subtract_dxdy (display_act->pida->piv_data,
298 display_act->pida->piv_data->mean_dx,
299 display_act->pida->piv_data->mean_dy);
300 } else {
302 * apply inverse scale factor for offsetting of partimcle image displacements
304 gpiv_post_subtract_dxdy (display_act->pida->piv_data,
305 gl_post_par->z_off_dx
306 / gl_image_par->s_scale
307 * gl_image_par->t_scale,
308 gl_post_par->z_off_dy
309 / gl_image_par->s_scale
310 * gl_image_par->t_scale
314 update_all_vectors (display_act->pida);
319 * Only apply offseting for non-scaled pivdata with values from entry
320 * or z_off_dx and z_off_dy
322 } else {
323 if (display_act->pida->averaged_piv) {
324 gpiv_post_subtract_dxdy (display_act->pida->piv_data,
325 display_act->pida->piv_data->mean_dx,
326 display_act->pida->piv_data->mean_dy);
328 * Copy parameters in Buffer structure for saving and, eventual,
329 * later use
331 display_act->pida->post_par->z_off_dx =
332 display_act->pida->piv_data->mean_dx;
333 display_act->pida->post_par->z_off_dy =
334 display_act->pida->piv_data->mean_dy;
336 } else {
337 gl_post_par->z_off_dx =
338 gtk_spin_button_get_value_as_float
339 (GTK_SPIN_BUTTON (pivpost->spinbutton_suavg));
340 gl_post_par->z_off_dy =
341 gtk_spin_button_get_value_as_float
342 (GTK_SPIN_BUTTON (pivpost->spinbutton_svavg));
343 gpiv_post_subtract_dxdy (display_act->pida->piv_data,
344 gl_post_par->z_off_dx,
345 gl_post_par->z_off_dy);
348 update_all_vectors (display_act->pida);
351 display_act->pida->post_par->z_off_dx__set = TRUE;
352 display_act->pida->post_par->z_off_dy__set = TRUE;
353 exec_process = FALSE;
355 } else {
356 warning_gpiv (_("no PIV data"));
359 /* g_warning("exec_savg:: entering"); */
360 /* g_warning(_("not connected, yet")); */
365 void
366 exec_vorstra (void
368 /*-----------------------------------------------------------------------------
371 char *err_msg = NULL;
372 GtkWidget *view_scalardata_display1 =
373 gtk_object_get_data (GTK_OBJECT (display_act->mwin),
374 "view_scalardata_display1");
375 GtkWidget *view_scalardata_display2 =
376 gtk_object_get_data (GTK_OBJECT (display_act->mwin),
377 "view_scalardata_display2");
378 GtkWidget *view_scalardata_display3 =
379 gtk_object_get_data (GTK_OBJECT (display_act->mwin),
380 "view_scalardata_display3");
383 if (display_act->pida->exist_piv && !cancel_process) {
384 exec_process = TRUE;
388 * Vorticity calculation and displaying
390 if (gl_post_par->operator_vorstra == GPIV_VORTICITY) {
391 if (display_act->pida->exist_vor) {
392 destroy_all_scalars (display_act, GPIV_VORTICITY);
393 gpiv_free_scdata (display_act->pida->vor_data);
394 display_act->pida->exist_vor = FALSE;
397 if ((display_act->pida->vor_data =
398 gpiv_post_vorstra (display_act->pida->piv_data,
399 gl_post_par))
400 == NULL) error_gpiv ("%s: %s", RCSID, err_msg);
402 create_all_scalars (display_act, GPIV_VORTICITY);
404 * Adding comment to the vorticity data
406 display_act->pida->vor_data->comment =
407 g_strdup_printf ("# Software: %s%s\n", PACKAGE, VERSION);
408 display_act->pida->vor_data->comment =
409 gpiv_add_datetime_to_comment (display_act->pida->vor_data->comment);
410 display_act->pida->vor_data->comment =
411 g_strconcat (display_act->pida->vor_data->comment,
412 "# Data type: vorticity [1/s]\n",
413 NULL);
417 * Vorticity data exist but are unsaved
418 * and are displayed as scalar data
420 display_act->pida->exist_vor = TRUE;
421 display_act->pida->saved_vor = FALSE;
422 /* gtk_check_menu_item_set_active */
423 /* (GTK_CHECK_MENU_ITEM (view_scalardata_display1), */
424 /* TRUE); */
427 * Repete vorticity calculation process for scaled piv_data
429 if (display_act->pida->scaled_piv) {
430 if ((display_act->pida->vor_data_scaled =
431 gpiv_post_vorstra (display_act->pida->piv_data_scaled,
432 gl_post_par))
433 == NULL) error_gpiv ("%s: %s", RCSID, err_msg);
435 display_act->pida->exist_vor_scaled = TRUE;
436 display_act->pida->vor_data_scaled->scale = TRUE;
439 * Adding comment to the scaled vorticity data
441 display_act->pida->vor_data_scaled->comment =
442 g_strdup_printf ("# Software: %s%s\n", PACKAGE, VERSION);
443 display_act->pida->vor_data_scaled->comment =
444 gpiv_add_datetime_to_comment (display_act->pida->vor_data_scaled->comment);
445 display_act->pida->vor_data_scaled->comment =
446 g_strconcat (display_act->pida->vor_data_scaled->comment,
447 "# Data type: time and spatial scaled vorticity [1/s]\n",
448 NULL);
454 * Shear strain calculation and displaying
456 } else if (gl_post_par->operator_vorstra == GPIV_S_STRAIN) {
457 if (display_act->pida->exist_sstrain) {
458 destroy_all_scalars (display_act, GPIV_S_STRAIN);
459 gpiv_free_scdata (display_act->pida->sstrain_data);
460 display_act->pida->exist_sstrain = FALSE;
463 if ((display_act->pida->sstrain_data =
464 gpiv_post_vorstra (display_act->pida->piv_data,
465 gl_post_par))
466 == NULL) error_gpiv ("%s: %s", RCSID, err_msg);
468 create_all_scalars (display_act, GPIV_S_STRAIN);
471 * Adding comment to the sstrain data
473 display_act->pida->sstrain_data->comment =
474 g_strdup_printf ("# Software: %s%s\n", PACKAGE, VERSION);
475 display_act->pida->sstrain_data->comment =
476 gpiv_add_datetime_to_comment (display_act->pida->sstrain_data->comment);
477 display_act->pida->sstrain_data->comment =
478 g_strconcat (display_act->pida->sstrain_data->comment,
479 "# Data type: shear strain [1/s]\n",
480 NULL);
483 * Shear strain data exist but are unsaved
484 * and are displayed as scalar data
486 display_act->pida->exist_sstrain = TRUE;
487 display_act->pida->saved_sstrain = FALSE;
488 gtk_check_menu_item_set_active
489 (GTK_CHECK_MENU_ITEM (view_scalardata_display2),
490 TRUE);
492 * Repete shear strain calculation process for scaled piv_data
494 if (display_act->pida->scaled_piv) {
495 if ((display_act->pida->sstrain_data_scaled =
496 gpiv_post_vorstra (display_act->pida->piv_data_scaled,
497 gl_post_par))
498 == NULL) error_gpiv ("%s: %s", RCSID, err_msg);
500 display_act->pida->exist_sstrain_scaled = TRUE;
501 display_act->pida->sstrain_data_scaled->scale = TRUE;
504 * Adding comment to the scaled sstrain data
506 display_act->pida->sstrain_data_scaled->comment =
507 g_strdup_printf ("# Software: %s%s\n", PACKAGE, VERSION);
508 display_act->pida->sstrain_data_scaled->comment =
509 gpiv_add_datetime_to_comment (display_act->pida->sstrain_data_scaled->comment);
510 display_act->pida->sstrain_data_scaled->comment =
511 g_strconcat (display_act->pida->sstrain_data_scaled->comment,
512 "# Data type: time and spatial scaled shear strain [1/s]\n",
513 NULL);
517 * Normal strain calculation and displaying
519 } else if (gl_post_par->operator_vorstra == GPIV_N_STRAIN) {
520 if (display_act->pida->exist_nstrain) {
521 /* destroy_all_scalars (&display_act->pida->nstrain_data, GPIV_N_STRAIN); */
522 destroy_all_scalars (display_act, GPIV_N_STRAIN);
523 gpiv_free_scdata (display_act->pida->nstrain_data);
524 display_act->pida->exist_nstrain = FALSE;
527 if ((display_act->pida->nstrain_data =
528 gpiv_post_vorstra (display_act->pida->piv_data,
529 gl_post_par))
530 == NULL) error_gpiv ("%s: %s", RCSID, err_msg);
532 create_all_scalars (display_act, GPIV_N_STRAIN);
535 * Adding comment to the nstrain data
537 display_act->pida->nstrain_data->comment =
538 g_strdup_printf ("# Software: %s%s\n", PACKAGE, VERSION);
539 display_act->pida->nstrain_data->comment =
540 gpiv_add_datetime_to_comment (display_act->pida->nstrain_data->comment);
541 display_act->pida->nstrain_data->comment =
542 g_strconcat (display_act->pida->nstrain_data->comment,
543 "# Data type: normal strain [1/s]\n",
544 NULL);
547 * Normal strain data exist but are unsaved
548 * and are displayed as scalar data
550 display_act->pida->exist_nstrain = TRUE;
551 display_act->pida->saved_nstrain = FALSE;
552 gtk_check_menu_item_set_active
553 (GTK_CHECK_MENU_ITEM (view_scalardata_display3),
554 TRUE);
556 * Repete normal strain calculation process for scaled piv_data
558 if (display_act->pida->scaled_piv) {
559 if ((display_act->pida->nstrain_data_scaled =
560 gpiv_post_vorstra (display_act->pida->piv_data_scaled,
561 gl_post_par))
562 == NULL) error_gpiv ("%s: %s", RCSID, err_msg);
564 display_act->pida->exist_nstrain_scaled = TRUE;
565 display_act->pida->nstrain_data_scaled->scale = TRUE;
568 * Adding comment to the scaled nstrain data
570 display_act->pida->nstrain_data_scaled->comment =
571 g_strdup_printf ("# Software: %s%s\n", PACKAGE, VERSION);
572 display_act->pida->nstrain_data_scaled->comment =
573 gpiv_add_datetime_to_comment (display_act->pida->nstrain_data_scaled->comment);
574 display_act->pida->nstrain_data_scaled->comment =
575 g_strconcat (display_act->pida->nstrain_data_scaled->comment,
576 "# Data type: time and spatial scaled normal strain [1/s]\n",
577 NULL);
582 } else {
583 warning_gpiv (_("exec_vorstra: non valid operation"));
585 exec_process = FALSE;
587 } else {
588 warning_gpiv (_("no PIV data"));
592 * Copy parameters in Buffer structure for saving and, eventual,
593 * later use
596 if (display_act->pida->exist_vor || display_act->pida->exist_sstrain ||
597 display_act->pida->exist_nstrain) {
599 display_act->pida->post_par->diff_type = gl_post_par->diff_type;
600 display_act->pida->post_par->operator_vorstra =
601 gl_post_par->operator_vorstra;
603 display_act->pida->post_par->diff_type__set = TRUE;
604 display_act->pida->post_par->operator_vorstra__set = TRUE;
606 gpiv_post_print_parameters (stdout, display_act->pida->post_par);
610 /* gpiv_write_scdata ( &display_act->pida->vor_data, c_line, nc_lines, */
611 /* scale, RCSID); */
619 * Piv post-processing callback functions
622 void
623 on_spinbutton_post_scale (GtkSpinButton * widget,
624 GtkWidget * entry
625 /* (GtkWidget *widget, gpointer data) */
627 /*-----------------------------------------------------------------------------
630 enum VariableType {
631 COL_POS = 1,
632 ROW_POS = 2,
633 S_SCALE = 3,
634 T_SCALE = 4
635 } var_type;
637 var_type = atoi (gtk_object_get_data (GTK_OBJECT (widget), "var_type"));
639 if (var_type == COL_POS) {
640 gl_image_par->z_off_x = gtk_spin_button_get_value_as_float (widget);
641 gl_image_par->z_off_x__set = TRUE;
642 if (display_act != NULL) {
643 display_act->img->image->header->z_off_x = gl_image_par->z_off_x;
644 display_act->img->image->header->z_off_x__set = TRUE;
647 } else if (var_type == ROW_POS) {
648 gl_image_par->z_off_y = gtk_spin_button_get_value_as_float (widget);
649 gl_image_par->z_off_y__set = TRUE;
650 if (display_act != NULL) {
651 display_act->img->image->header->z_off_y = gl_image_par->z_off_y;
652 display_act->img->image->header->z_off_y__set = TRUE;
655 } else if (var_type == S_SCALE) {
656 gl_image_par->s_scale = gtk_spin_button_get_value_as_float (widget);
657 gl_image_par->s_scale__set = TRUE;
658 if (display_act != NULL) {
659 display_act->img->image->header->s_scale = gl_image_par->s_scale;
660 display_act->img->image->header->s_scale__set = TRUE;
663 } else if (var_type == T_SCALE) {
664 gl_image_par->t_scale = gtk_spin_button_get_value_as_float (widget);
665 gl_image_par->t_scale__set = TRUE;
666 if (display_act != NULL) {
667 display_act->img->image->header->t_scale = gl_image_par->t_scale;
668 display_act->img->image->header->t_scale__set = TRUE;
671 } else {
672 gpiv_warning (_("on_spinbutton_post_scale: should not arrive here"));
679 void
680 on_button_post_scale_enter (GtkWidget *widget,
681 gpointer data
683 /*-----------------------------------------------------------------------------
686 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
687 gchar *msg = _("Calculates scaled locations and velocities");
688 gnome_appbar_set_status (GNOME_APPBAR (gpiv->appbar), msg);
693 void
694 on_button_post_scale (GtkWidget *widget,
695 gpointer data
697 /*-----------------------------------------------------------------------------
700 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
701 gint row, ibuf;
703 cancel_process = FALSE;
704 if (nbufs > 0) {
705 for (row = gpiv->first_selected_row; row <= gpiv->last_selected_row;
706 row++) {
707 display_act = gtk_clist_get_row_data (GTK_CLIST (gpiv->clist_buf),
708 row);
709 ibuf = display_act->id;
710 if (display[ibuf] != NULL
711 && display_act->mwin != NULL
712 && GTK_WIDGET_VISIBLE (GTK_WIDGET (display_act->mwin)) ) {
713 gdk_window_show (GTK_WIDGET (display_act->mwin)->window);
714 gdk_window_raise (GTK_WIDGET (display_act->mwin)->window);
716 exec_scale (gpiv->pivpost);
723 void
724 on_spinbutton_post_suavg (GtkSpinButton *widget,
725 GtkWidget *entry
727 /*-----------------------------------------------------------------------------
730 gl_post_par->z_off_dx = gtk_spin_button_get_value_as_float (widget);
731 /* g_warning("on_spinbutton_post_suavg:: z_off_dx = %f", */
732 /* post_par->z_off_dx); */
733 display_act->pida->averaged_piv = FALSE;
738 void
739 on_spinbutton_post_svavg (GtkSpinButton *widget,
740 GtkWidget *entry
742 /*-----------------------------------------------------------------------------
745 gl_post_par->z_off_dy = gtk_spin_button_get_value_as_float (widget);
746 /* g_warning ("n_spinbutton_post_svavg:: z_off_dy = %f", */
747 /* post_par->z_off_dy); */
748 display_act->pida->averaged_piv = FALSE;
753 void
754 on_button_post_savg_enter (GtkWidget *widget,
755 gpointer data
757 /*-----------------------------------------------------------------------------
760 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
761 gchar *msg = _("Calculates spatial average displacements");
762 gnome_appbar_set_status (GNOME_APPBAR (gpiv->appbar), msg);
767 void
768 on_button_post_savg (GtkWidget *widget,
769 gpointer data
771 /*-----------------------------------------------------------------------------
774 PivPost * post = gtk_object_get_data (GTK_OBJECT (widget), "post");
775 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
776 gint row, ibuf;
778 cancel_process = FALSE;
779 if (nbufs > 0) {
780 for (row = gpiv->first_selected_row; row <= gpiv->last_selected_row;
781 row++) {
782 display_act = gtk_clist_get_row_data (GTK_CLIST (gpiv->clist_buf),
783 row);
784 ibuf = display_act->id;
785 if (display[ibuf] != NULL
786 && display_act->mwin != NULL
787 && GTK_WIDGET_VISIBLE (GTK_WIDGET (display_act->mwin)) ) {
788 gdk_window_show (GTK_WIDGET (display_act->mwin)->window);
789 gdk_window_raise (GTK_WIDGET (display_act->mwin)->window);
791 exec_savg (post);
798 void
799 on_button_post_subavg_enter (GtkWidget *widget,
800 gpointer data
802 /*-----------------------------------------------------------------------------
805 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
806 gchar *msg = _("Subtracts mean displacements / offset values from PIV data");
807 gnome_appbar_set_status (GNOME_APPBAR (gpiv->appbar), msg);
812 void
813 on_button_post_subavg (GtkWidget *widget,
814 gpointer data
816 /*-----------------------------------------------------------------------------
819 PivPost * post = gtk_object_get_data (GTK_OBJECT (widget), "post");
820 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
821 gint row, ibuf;
823 cancel_process = FALSE;
824 if (nbufs > 0) {
825 for (row = gpiv->first_selected_row; row <= gpiv->last_selected_row;
826 row++) {
827 display_act = gtk_clist_get_row_data (GTK_CLIST (gpiv->clist_buf),
828 row);
829 ibuf = display_act->id;
830 if (display[ibuf] != NULL
831 && display_act->mwin != NULL
832 && GTK_WIDGET_VISIBLE (GTK_WIDGET (display_act->mwin)) ) {
833 gdk_window_show (GTK_WIDGET (display_act->mwin)->window);
834 gdk_window_raise (GTK_WIDGET (display_act->mwin)->window);
836 exec_subavg (post);
843 void
844 on_radiobutton_post_vorstra_output_enter (GtkWidget *widget,
845 gpointer data
847 /*-----------------------------------------------------------------------------
850 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
851 gchar *msg = _("Selects the differential quantity");
852 gnome_appbar_set_status (GNOME_APPBAR (gpiv->appbar), msg);
857 void
858 on_radiobutton_post_vorstra_output (GtkWidget *widget,
859 gpointer data
861 /*-----------------------------------------------------------------------------
864 PivPost * post = gtk_object_get_data (GTK_OBJECT (widget), "post");
865 gl_post_par->operator_vorstra = atoi (gtk_object_get_data
866 (GTK_OBJECT (widget),
867 "operator"));
868 /* fprintf (stderr, "on_radiobutton_post_vorstra_output:: operator_vorstra = %d\n", gl_post_par->operator_vorstra); */
870 if (gl_post_par->operator_vorstra == GPIV_VORTICITY) {
871 gtk_widget_set_sensitive (post->radiobutton_vorstra_diffscheme_4,
872 TRUE);
873 } else {
874 if (gl_post_par->diff_type == GPIV_CIRCULATION) {
875 gl_post_par->diff_type = GPIV_CENTRAL;
876 gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON
877 (post->radiobutton_vorstra_diffscheme_1),
878 TRUE);
880 gtk_widget_set_sensitive (post->radiobutton_vorstra_diffscheme_4,
881 FALSE);
887 void
888 on_radiobutton_post_vorstra_diffscheme_enter (GtkWidget *widget,
889 gpointer data
891 /*-----------------------------------------------------------------------------
894 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
895 gchar *msg = _("Selects the type of differential scheme");
896 gnome_appbar_set_status (GNOME_APPBAR (gpiv->appbar), msg);
901 void
902 on_radiobutton_post_vorstra_diffscheme (GtkWidget *widget,
903 gpointer data
905 /*-----------------------------------------------------------------------------
908 gl_post_par->diff_type = atoi (gtk_object_get_data (GTK_OBJECT (widget),
909 "diff_type"));
910 /* fprintf (stderr, "diff_type = %d\n", post_par->diff_type); */
916 void
917 on_button_post_vorstra_enter (GtkWidget *widget,
918 gpointer data
920 /*-----------------------------------------------------------------------------
923 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
924 gchar *msg = _("Calculates differential quantity");
925 gnome_appbar_set_status (GNOME_APPBAR (gpiv->appbar), msg);
930 void
931 on_button_post_vorstra (GtkWidget *widget,
932 gpointer data
934 /*-----------------------------------------------------------------------------
937 GpivConsole *gpiv = gtk_object_get_data (GTK_OBJECT (widget), "gpiv");
938 gint row, ibuf;
940 cancel_process = FALSE;
941 if (nbufs > 0) {
942 for (row = gpiv->first_selected_row; row <= gpiv->last_selected_row;
943 row++) {
944 display_act = gtk_clist_get_row_data (GTK_CLIST (gpiv->clist_buf),
945 row);
946 ibuf = display_act->id;
947 if (display[ibuf] != NULL
948 && display_act->mwin != NULL
949 && GTK_WIDGET_VISIBLE (GTK_WIDGET (display_act->mwin)) ) {
950 gdk_window_show (GTK_WIDGET (display_act->mwin)->window);
951 gdk_window_raise (GTK_WIDGET (display_act->mwin)->window);
953 exec_vorstra ();